MQTT sends only Value of Sensor - no Topic

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
stanus74
New user
Posts: 1
Joined: 16 Aug 2023, 16:52

MQTT sends only Value of Sensor - no Topic

#1 Post by stanus74 » 16 Aug 2023, 17:09

Hello,

I am a new user of ESPEasy.

I use Home Assistant with MQTT Broker. Zigbee2Mqtt works with the broker.

Now I want to use the DHT11 sensor with ESP8266.

The values of the sensor are displayed under Device.

I have set "Send to Controller" to Enable.

However, the controller only sends the sensor values without setting the topic in front.

MQTT Settings:
Image

Here is a log from the MQTT Broker:
{"battery":100,"illuminance":27458,"illuminance_lux":557,"led_indication":null,"linkquality":0,"motion_sensitivity":"low","occupancy":false,"occupancy_timeout":0,"temperature":25.11}
27.30
73.50
{"Time":"2023-08-16T15:55:40","Uptime":"0T00:11:11","UptimeSec":671,"Heap":25,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"POWER":"ON","Wifi":{"AP":1,"SSId":"Garten_Fritz","BSSId":"3C:37:12:1E:E0:17","Channel":3,"Mode":"11n","RSSI":50,"Signal":-75,"LinkCount":1,"Downtime":"0T00:00:06"}}
27.30
73.50
27.30
73.50
Using version mega-20230623 on a Wemos D1.

Thank you

TD-er
Core team member
Posts: 8756
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: MQTT sends only Value of Sensor - no Topic

#2 Post by TD-er » 16 Aug 2023, 17:38

How do you look at these published messages on the MQTT broker?

Can you have a look at tools like MQTT explorer?
This tool gives a lot more insight in what is happening.

As you can see in the controller settings, there is a number of system variables being used to create the topic to which the message is published.

So make sure you have a sysname set in ESPEasy and the task for your DHT sensor does have a unique name and set a task value name.

So the topic should be something like "ESPEasy/DHT/temp", assuming your node is called "ESPEasy", the task is called "DHT" and the task value name is "temp".

User avatar
Ath
Normal user
Posts: 3521
Joined: 10 Jun 2018, 12:06
Location: NL

Re: MQTT sends only Value of Sensor - no Topic

#3 Post by Ath » 26 Aug 2023, 21:58

stanus74 wrote: 16 Aug 2023, 17:09 Hello,

I am a new user of ESPEasy.

I use Home Assistant with MQTT Broker. Zigbee2Mqtt works with the broker.

Now I want to use the DHT11 sensor with ESP8266.

The values of the sensor are displayed under Device.

I have set "Send to Controller" to Enable.

However, the controller only sends the sensor values without setting the topic in front.

MQTT Settings:
Image

Here is a log from the MQTT Broker:
{"battery":100,"illuminance":27458,"illuminance_lux":557,"led_indication":null,"linkquality":0,"motion_sensitivity":"low","occupancy":false,"occupancy_timeout":0,"temperature":25.11}
27.30
73.50
{"Time":"2023-08-16T15:55:40","Uptime":"0T00:11:11","UptimeSec":671,"Heap":25,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"POWER":"ON","Wifi":{"AP":1,"SSId":"Garten_Fritz","BSSId":"3C:37:12:1E:E0:17","Channel":3,"Mode":"11n","RSSI":50,"Signal":-75,"LinkCount":1,"Downtime":"0T00:00:06"}}
27.30
73.50
27.30
73.50
Using version mega-20230623 on a Wemos D1.

Thank you
I just now see that the Controller Publish field has an error. "%sysname%/%tskname%/%valname'" should be "%sysname%/%tskname%/%valname%", so for some reason the last percent sign was replaced by a single quote. If you fix that, it should work as intended :o
/Ton (PayPal.me)

Post Reply

Who is online

Users browsing this forum: No registered users and 38 guests