I have 5 sensor nodes with @bruhautomation code, everyone but 1 works well.
The one i installed today just wont work, i have tried 2 ESP8266 chips and so on. When looking @ the serial monitor it works, but not in HA.
This is my HA code:
- platform: mqtt
state_topic: “deedje/sensornode5”
name: “Tvättstugan Luftfuktighet”
unit_of_measurement: “%”
value_template: ‘{{ value_json.humidity | round(1) }}’
1503091965: Client sensornode5 has exceeded timeout, disconnecting.
1503091965: Socket error on client sensornode5, disconnecting.
1503091986: New connection from 192.168.1.181 on port 1883.
1503091986: New client connected from 192.168.1.181 as sensornode5 (c1, k15, u’deedje’).
1503092075: New connection from 192.168.1.181 on port 1883.
1503092075: Client sensornode5 already connected, closing old connection.
1503092075: Client sensornode5 disconnected.
I think the next thing to check is that the MQTT message is reaching the broker, and it has the topic you are expecting. To do this, you need a simple MQTT client that just prints out the message it receives. I usually use mosquitto_sub for this, but there are other clients around for Android, Linux and PCs.
$ mosquitto_sub -t "#" -v
prints out all the topics received by the broker. You may need to add parameters for the host address, username and/or password depending on your broker set up.
If this receives the message being sent by the sensor, then you can start investigating why HA can’t see it.
Allright, found a tool for Windows 10.
I did get it to work for a few secs. Then i added it with its real name in HA and then it stop receving on that topic.
Now i did try to remove it from HA; and restarted the MQTT server + the sensornode, and still not getting anything on my mqtt server. In the Arnduio console it works and connect as normal.
There is no need to do anything with HA. The broker will distribute messages to all clients that have subscribed to a topic.
I’m not sure what you mean here. Did HA record that it received a message, or did your new Windows 10 client see something?
Are you using the Windows 10 client to detect all messages, or are you trying to match a particular message? In general, when diagnosing problems, it is best to use the wildcard character # as the topic, so the client show all messages.
Another approach , if you still can’t see anything, try enabling the debug log in the broker, so that it prints out all the messages it receives in its log.
Its not particularly unusual. Things have to be set up exactly, and its very easy to get one little bit wrong, that causes everything to fail.