Closed RogerSelwyn closed 2 months ago
This would be useful for me for our Siemens washer and dryer. I have a gauge for the progress, but when at 100% the gauge is gone.
The integration indeed doesn't know in advance which entities exist for each appliance, they are dynamically created when they are exposed by the API, exactly as you guessed ( and as I have explained many times in the past). Deleting entities is not a trivial problem because it's hard to delete something which the integration doesn't even know exists. However, even if there is a way to do it I don't believe it's a good idea because it will break automations and UIs in all sorts of weird ways. An automation can check if an entity is unavailable and handle that but can't handle a totally missing entity. The same applies for UIs that can be configured to handle themselves gracefully when the entity is unavailable but not when it's totally gone.
Is your feature request related to a problem? Please describe. When a program is started/selected I can see a whole range of new sensors are created via the
add_appliance
logic. However, when the program stops these become unavailable and when HA is restarted they are marked asrestored
.Describe the solution you'd like My guess is that you don't really know what all the sensors are that may be required at HA startup for all types of devices, and they're dynamically created based on the data from the HC api. So you can't maintain them on an ongoing basis.
If that is the case, is it possible to dynamically delete them instead of just marking them unavailable? This would ensure that the HA environment is left clean. Potentially within the available method at line 153 do an entity delete (not sure if an entity can delete itself) if unavailable.
Describe alternatives you've considered As above.
Additional context I'm tend to monitor for unavailable and restored entities in my environment because that indicates an issue, and this leaves many items in one of those states.
This is also true of the core integration.
I could probably code this myself and submit a PR, but I'd rather have the discussion first in case you see any issues.