-
Notifications
You must be signed in to change notification settings - Fork 54
Make status titles available as state attribute on NibeSystemSensor #187
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This adds it to all system sensors, that is wrong. Add a new system sensor description, and with a state fn grabbing the first status. Then you can extend the description structure with a new optional function grabbing extra attributes.
My plan was to go that route initially. I'll look into it and then we'll see what you think. |
The first entry in the list is the currently prioriatiszed action. So that make sense as state. |
Well if the intended functionality is for the Sets in Python are unordered by design and therefore are not guaranteed to be iterated in the same order they where added (Python docs). Whether this is a bug or not depends on if something else relies on the order of |
Well all statuses är "wanted" actions. But yes that would pose a problem. I think i made this this way since if you have multiple compressors (unlikely) two things could be active at the same time. So im not sure what to do here ;) |
Would the solution in my latest commit suffice? (Files changed) I'm totally with you to not bloat every system sensor with the The primary objective with this PR is to get access the list of statuses in HA. The sensor state isn't really that important. But i think it should be something stable, and not whatever entry in the |
@jelgblad, it's a welcome feature! |
Could you make it a count value instead. I len(statuses) and call it status_count. |
Done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
With this change a user will be able to access a list of heat pump status titles in the
statuses
attribute on the state of all NibeSystemSensor-entities.For example a template string like this
{{ state_attr('sensor.last_activity', 'statuses') }}
will return the following list:I'm using this to log compressor-status with a template binary_sensor like this:
Would also be useful if one wanted to replicate the status icons on their NIBE-system in HomeAssistant, to get a glance at what the unit is doing right now, without having to open the NIBE Uplink app.
As previously stated, I'm currently using this in my current system with great success.