Closed stickpin closed 1 year ago
Today the sensors become unavailable because they are. What is the benefit of keeping them active with a N/A state? On the practical side there would be two issues with implementing something like that:
Hi @ekutner,
Well, technically you are right, sensors are "currently" unavailable because the appliance is off. The problem is that Home Assitance doesn't have this temporary state and some of the sensors can even be deleted because of this:
My idea is to have some kind of "default" values for sensors that are "currently" unavailable and was previously discovered once the appliance was on. Btw, I don't think we have a problem with binary_sensors
at least on my 3 appliances all of them keeping the last_known_state
or it kept by BSH (Home Connect). The only problem that I currently see is with the sensor
and those can be addressed with N/A, Unknown, Inactive, etc... Whatever default value will make sense.
I think that even BSH themselves using this strategy for some sensors:
Deleting sensors is a manual process so I doubt anyone would do that but even if they did nothing will happen because they will just be created again, with the same device_id, when the appliance reconnects.
To be honest, I don't really see the use case and I definitely don't believe sensors should show values which are known to be wrong (i.e. the previous state). That said, if other people will see value in such a behavior I'll be ok with merging a PR that did it, as long as it was optional and reliable. If you want to follow through with it I suggest you open a thread in the discussion thread and see what other people have to say about it. In the mean time you may want to think how you would implement something like that, in particular the case of publishing previous sensors after HA restart. You should find some inactive code in the init file that used to save a cache of the internal state. That should help you with what you're trying to do but know that I disabled it because it created some inconsistencies that made it just easier to live without it.
Is your feature request related to a problem? Please describe. Today when you turn off your appliance many sensors become
unavailable
.Describe the solution you'd like My suggestion is to save the last appliance state in the file when you turn the appliance off, as zigbee2mqtt does for example. If the last sensor state doesn't make sense when the appliance is turned off, I would suggest changing the state to
N/A
for example. This will allow sensors to stay "active".@ekutner if you agree with the proposal, I can try to implement it.