home-assistant-libs / zwave-js-server-python

Python library to interact with a Z-Wave JS server.
Apache License 2.0
56 stars 18 forks source link

Update nodes internal state data #996

Closed raman325 closed 3 weeks ago

raman325 commented 3 weeks ago

When making updates to the lib's last seen state, we were not updating its internal state (node.data). The sensor entity uses node.data to populate its state, and if there is no last seen state data, the entity becomes unknown as a result.

I'm separately wondering if we should update the statistics sensor entity descriptions to use the actual model (e.g. node.last_seen) instead of the node's internal state (node.data["lastSeen"])). Do we generally want to avoid accessing the internal state of things in the lib from the integration code? If so, I'm guessing there are other places we are doing that as well.

Thanks @kpine for finding the issue!