MQTT: Did I understand how it works? [spoiler alert] no

Hello everyone

I have been following the project since at least version 3, I have installed it several times, without being able to properly manage my peripherals correctly.. I will talk about it another time, but ZWAVE (the hardware, not the integration in Gladys) has never worked well, big disappointment.

Last week, I saw the video by @Pierre-Gilles (whom I salute for his immense work here), and it gave me the idea to start over with an install, in 4.5, to take advantage of the multi-dashboard
I am also waiting for the data curves, because the old ones were not great!!

The point that is bothering me now is MQTT with a broker on my local network
Gladys seems to access it well

On my broker, I am in the test/integration phase, I have the following topics

When I test for example mqtt:Internet:data:Indice_UV, I get an error message

In short, I don’t understand how it works. I looked at the messages here, but no, I didn’t understand anything..

If you see where it fails, I am a taker.
Thanks in advance
Olivier

I’m referring to the API MQTT doc → MQTT API | Gladys Assistant
The service doc → MQTT | Gladys Assistant


It seems you want to read values from your broker

Gladys enforces a specific structure, while you have Internet/data/#

Gladys requires gladys/master/device/:device_external_id/feature/:device_feature_external_id/state

Which in your case would give

gladys/master/device/mqtt:Internet/feature/mqtt:Internet:IndiceUV/state for example

I don’t know how you push your data to your broker, but you will need to review this part to comply with Gladys MQTT API schema

Once this is done, you must create in Gladys a device ‹ Internet › with features such as UV Index, Air Quality, etc…

Thanks @VonOx for the quick response

So, yes, I want to fetch information from the internet and store it in a broker
And also add information from my sensors…this won’t be on the internet..

Now, I need to figure out how to store the information, there’s nothing set in stone on my broker, everything is to be done, but it needs to be simple

But now, with the docs and the explanations, I understand NOTHING. I specify, I am a computer scientist, I do bash, python, ansible all day, but here no, I don’t understand anything.

The syntax seems redundant and complicated

Let’s say I have a temperature sensor located in the living room based on DS1820 that publishes the temperature in Celsius

I would like to have on my MQTT broker a topic LivingRoom/Temperature with the temperature, and maybe the date of the last temperature recorded.
So that would give

  • LivingRoom/Temperature/Temperature
  • LivingRoom/Temperature/Last_Temperature_Date

How do I configure this in Gladys? And is there a generic syntax like VALUE={{PROTOCOL}}:{{HOST}}:{{PORT}}:{{TOPIC}}

Thanks in advance
Olivier

The simplest way is to create your MQTT device in Gladys and copy the link provided at the end of the form. This is the topic where you post the value you want Gladys to receive… Does that help?

@GBoulvin is absolutely right

In your post, you see that you create a device but without functionality. As a result, it’s an empty shell.

When you add features, Gladys will give you the right topic

The structure may seem complicated, but it is necessary (it’s an API), it’s the only way for Gladys to make the correspondence between text on the mqtt side and a device with features, a temperature refers to a unit, etc…

Daccord, MQTT must adapt to Gladys, and not the other way around.

Well, I create a MAURICE device whose feature is Temperature located in the living room.

I understood that I should publish the value of MAURICE on the topic that Gladys imposes on me in MQTT Topic.

The error occurs when I save.
So what am I doing wrong?

External ID of the feature, you have not provided it, the unit can also be useful.

mqtt:temperature for example

OK, it works now


Thanks to both of you…I will proceed by analogy to insert other things. Thanks again

You’re all set to create other features or other devices + features! :slight_smile:

Another tip, you don’t need to provide a timestamp => Date_derniere_Temperature
Gladys handles storing the value in its own database with the timestamp. (To exploit the history via curves, etc.)

It’s noted for the timestamp, not necessarily necessary for Gladys… On the other hand, I might need it elsewhere…

Remember to include a unit for the temperature, it looks a bit empty without the unit there :slight_smile:

Well done, that’s true it’s much better already… :grinning: