I upgraded to ver. 0.52 and this broke my MySensors setup. I’m using an MQTT-client gateway an it has worked flawlessly until now. Reverting to ver. 0.51.2 removes the issue.
edit: @martinhjelmare do you have any input on this? Any help is greatly appreciated!
Interesting. I’ve tested the MQTT gateway with Python 3.4 and the protocol_version set to ‘2.0’ and that works. I also tested just now to just run the offending line 31 in mysensors/__init__.py, in Python versions 3.5.3 and Python 3.6.2, which also works.
Specifically what version of python are you using for home assistant?
Same problem here. One of my sensor nodes somehow sends None as protocol version and there is a bug in the pymysensors library that crashes the mysensors stack altogether when mysensors version is None.
I made a temporary fix in pymysensors:
On my computer the file path is: /srv/homeassistant/lib/python3.5/site-packages/mysensors/init.py
I have changed line 496 to read:
except (TypeError, ValueError, AttributeError, vol.Invalid) as exc:
And that solved the problem with the mysensors stack crashing but the reported sensor data does not get processed anymore.
I could not find any pointers as to what am I missing in that sensor firmware, so for now it is better than nothing.
I’m thinking this has to do with the persistence file having protocol_version saved with null as value under a sensor. Does any of you have the possibility to confirm that?
Same here, I have multiple sensors that have reported null as protocol_version. I will do as shprota and edit the persistence file manually when I get home from work. That does seem like a quick fix only, would be good to find the root cause.
In pymysensors 0.10 protocol_version was initialized as None. In 0.11 it’s initialized as '1.4'. If for some reason the message that presented the node didn’t have the protocol version as payload the None value would remain for protocol_version and be stored in the persistence file. That’s my current explanation.
I’m working on a hotfix that should catch and inform of the error and also validate the payload for node presentations specifically.
Thank you for the explanation. I think, it is also important to have pymysensors catch the null version condition to not crash the whole mysensors stack in such case.
I can confirm that clearing the null values from the persistence file fixes the problem. Had to clear null values for sketch_version as well before it started working.
Thanks for reporting back. A null value for sketch version should not cause an exception, just prevent the sensor from being added to home assistant. Can you confirm that in your experience?