BRUH senor nodes

Hi

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) }}’

  • platform: mqtt
    state_topic: “deedje/sensornode5”
    name: “Tvättstuga Tempratur”
    unit_of_measurement: “°C”
    value_template: ‘{{ value_json.temperature | round(1) }}’

  • platform: mqtt
    state_topic: “deedje/sensornode5”
    name: “Tvättstuga Rörelsesensor”
    value_template: ‘{{ value_json.motion }}’

Just the same as sensornode4, and that one work.

What could the problem be?

I can see this in the logs:

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.

This normally means that you have two MQTT clients with the same client_id trying to connect to the broker at the same time.

It looks like you have to set the client_id manually in the code, so you need to make sure that each sensor has unique client_id.

Well i Will try too change the name, but should not be the case

Did try to rename it once more.

This is what i see in the logs now:

1503248194: New client connected from 192.168.1.182 as sntvattstuga (c1, k15, u’deedje’).

So it all just looks normal, but in my HA setup I se no data, in Arduino serial console I can see it working just fine.

WiFi connected

IP address:
192.168.1.182
Ready
IPess: 192.168.1.182
Attempting MQTT connection…connected
Setting LEDs:
r: 0, g: 0, b: 0
{“state”:“OFF”,“color”:{“r”:255,“g”:255,“b”:255},“brightness”:255,“humidity”:“53.90”,“motion”:“standby”,“ldr”:“1023”,“temperature”:“21.10”}

What else could I try?

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.

Yes , Can I do this with hassio? Or do i need to connect some kind of other app to it?

Strange thing is that all other sensors is working just fine. i will try to make a total new one next week, with only new components

If you are using hass.io you will need to do it from another app or computer, since you don’t have command line access.

It would be a waste to discard this sensor for the sake of some simple tracing.

Thanks! What kinda tool could i use?

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.

very strange this problem

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.

1 Like