mjcumming / HomieV3

Homie V3 Implementation in Python
MIT License
5 stars 7 forks source link

Humidity should be node as well #2

Closed rknall closed 5 years ago

rknall commented 5 years ago

Humidity should be transported as node as well.

mjcumming commented 5 years ago

Hi Roland, the code as written is correct. You need to supply each property with the node it belongs too. In this case the node contains both the temperature and humidity properties.

rknall commented 5 years ago

With my change this is exactly what is happening. Both humidity and temperature are contained underneath the status node. Without the change, humidity does not get assigned to the status node, but rather assigned to the parent node, which leads to a different behavior for the variable humidity than temperature has, and furthermore humidity cannot be mapped correctly in openHAB.

mjcumming commented 5 years ago

have a look at the test file I just added. this works here with the code as is.

https://github.com/mjcumming/HomieV3/blob/master/homie/example_devices/test_temp_hum.py

NFO:homie.device_base:MQTT publish topic: homie/1583e61ee00001/status/humidity, payload: 10
INFO:root:Updated Temperature 10, Humidity 30
INFO:homie.device_base:MQTT publish topic: homie/1583e61ee00001/status/temperature, payload: 10
INFO:homie.device_base:MQTT publish topic: homie/1583e61ee00001/status/humidity, payload: 30
INFO:root:Updated Temperature 90, Humidity 90
INFO:homie.device_base:MQTT publish topic: homie/1583e61ee00001/status/temperature, payload: 90
INFO:homie.device_base:MQTT publish topic: homie/1583e61ee00001/status/humidity, payload: 90
INFO:root:Updated Temperature 50, Humidity 10
INFO:homie.device_base:MQTT publish topic: homie/1583e61ee00001/status/temperature, payload: 50
INFO:homie.device_base:MQTT publish topic: homie/1583e61ee00001/status/humidity, payload: 10
INFO:root:Updated Temperature 10, Humidity 30
INFO:homie.device_base:MQTT publish topic: homie/1583e61ee00001/status/temperature, payload: 10
INFO:homie.device_base:MQTT publish topic: homie/1583e61ee00001/status/humidity, payload: 30
INFO:root:Updated Temperature 90, Humidity 90
INFO:homie.device_base:MQTT publish topic: homie/1583e61ee00001/status/temperature, payload: 90
INFO:homie.device_base:MQTT publish topic: homie/1583e61ee00001/status/humidity, payload: 90
INFO:root:Updated Temperature 50, Humidity 10
INFO:homie.device_base:MQTT publish topic: homie/1583e61ee00001/status/temperature, payload: 50
INFO:homie.device_base:MQTT publish topic: homie/1583e61ee00001/status/humidity, payload: 10
INFO:root:Updated Temperature 10, Humidity 30
rknall commented 5 years ago

Yes it does, due to the fix you introduced to temperature_humidity. It was not correct two days ago, when I pushed the pull request.