homieiot / homie-esp8266

💡 ESP8266 framework for Homie, a lightweight MQTT convention for the IoT
http://homieiot.github.io/homie-esp8266
MIT License
1.36k stars 308 forks source link

Node $properties are sometimes null #597

Open tantive opened 5 years ago

tantive commented 5 years ago

Hi all,

I experience a strange behavior with one of my nodes. Normally, upon startup everything works as expected and the esp32 correctly registers itself by publishing the following MQTT messages:

homie/3c71bfcd1cf8/$homie 3.0.1 homie/3c71bfcd1cf8/$name M5Stick Environment homie/3c71bfcd1cf8/$mac 3C:71:BF:CD:1C:F8 homie/3c71bfcd1cf8/$localip 192.168.1.85 homie/3c71bfcd1cf8/$nodes humidity,pressure,temperature homie/3c71bfcd1cf8/$stats uptime homie/3c71bfcd1cf8/$stats/interval 65 homie/3c71bfcd1cf8/$fw/name M5Stick Environment homie/3c71bfcd1cf8/$fw/version 1.0.0 homie/3c71bfcd1cf8/$fw/checksum d27f70b5a5bc601c4e9558e042941439 homie/3c71bfcd1cf8/$implementation esp32 homie/3c71bfcd1cf8/$implementation/config {"name":"M5Stick Environment","wifi":{"ssid":"tantive"},"mqtt":{"host":"192.168.1.4","port":1883},"ota":{"enabled":true},"device_stats_interval":60,"settings":{"device_update_interval":60,"device_display_state":true}} homie/3c71bfcd1cf8/$implementation/version 3.0.0 homie/3c71bfcd1cf8/$implementation/ota/enabled true homie/3c71bfcd1cf8/humidity/$name Humidity homie/3c71bfcd1cf8/humidity/$type humidity homie/3c71bfcd1cf8/humidity/$properties percent homie/3c71bfcd1cf8/humidity/percent/$name Humidity homie/3c71bfcd1cf8/humidity/percent/$datatype float homie/3c71bfcd1cf8/humidity/percent/$unit % homie/3c71bfcd1cf8/pressure/$name Pressure homie/3c71bfcd1cf8/pressure/$type pressure homie/3c71bfcd1cf8/pressure/$properties pascal homie/3c71bfcd1cf8/pressure/pascal/$name Pressure homie/3c71bfcd1cf8/pressure/pascal/$datatype float homie/3c71bfcd1cf8/pressure/pascal/$unit hPa homie/3c71bfcd1cf8/temperature/$name Temperature homie/3c71bfcd1cf8/temperature/$type temperature homie/3c71bfcd1cf8/temperature/$properties degrees homie/3c71bfcd1cf8/temperature/degrees/$name Temperature homie/3c71bfcd1cf8/temperature/degrees/$datatype float homie/3c71bfcd1cf8/temperature/degrees/$unit ºC homie/3c71bfcd1cf8/$state ready

Using the same bin file and just rebooting the esp32 sometimes leads to the situation that only a part of the above pasted MQTT messages is published because the node $properties are null and thus are not correctly set:

homie/3c71bfcd1cf8/$homie 3.0.1 homie/3c71bfcd1cf8/$name M5Stick Environment homie/3c71bfcd1cf8/$mac 3C:71:BF:CD:1C:F8 homie/3c71bfcd1cf8/$localip 192.168.1.85 homie/3c71bfcd1cf8/$nodes humidity,pressure,temperature homie/3c71bfcd1cf8/$stats uptime homie/3c71bfcd1cf8/$stats/interval 65 homie/3c71bfcd1cf8/$fw/name M5Stick Environment homie/3c71bfcd1cf8/$fw/version 1.0.0 homie/3c71bfcd1cf8/$fw/checksum d27f70b5a5bc601c4e9558e042941439 homie/3c71bfcd1cf8/$implementation esp32 homie/3c71bfcd1cf8/$implementation/config {"name":"M5Stick Environment","wifi":{"ssid":"tantive"},"mqtt":{"host":"192.168.1.4","port":1883},"ota":{"enabled":true},"device_stats_interval":60,"settings":{"device_update_interval":60,"device_display_state":true}} homie/3c71bfcd1cf8/$implementation/version 3.0.0 homie/3c71bfcd1cf8/$implementation/ota/enabled true homie/3c71bfcd1cf8/humidity/$name Humidity homie/3c71bfcd1cf8/humidity/$type humidity homie/3c71bfcd1cf8/humidity/$properties (null) homie/3c71bfcd1cf8/pressure/$name Pressure homie/3c71bfcd1cf8/pressure/$type pressure homie/3c71bfcd1cf8/pressure/$properties (null) homie/3c71bfcd1cf8/temperature/$name Temperature homie/3c71bfcd1cf8/temperature/$type temperature homie/3c71bfcd1cf8/temperature/$properties (null) homie/3c71bfcd1cf8/$state ready

The problem seems to be kind of non-deterministic, as one of the above mentioned behaviors occurs upon every reset/reboot (with a higher likelihood of the broken case without correct $properties).