Open ccutrer opened 1 month ago
Are there besides the merged PR any additional steps needed to finish cleanup when components are removed?
Yes. It should automatically remove those components' topics from the Thing configuration (at least for managed things). And it probably needs to do this even if it doesn't see the "delete" message - i.e. if it happens when openHAB isn't running, and then the binding starts, and doesn't receive a new discovery message within some timeout.
Expected Behavior
If I remove something in MQTT from Home Assistant discovery, I expect the channels for that component to disappear in openHAB, otherwise I'm left with cruft, especially if I'm say designing a new device in ESPHome and adding and removing components from it often. It should happen right away if the discovery topic receives a message explicitly deleting it (as opposed just not sending the discovery message again in the future, when not using retained discovery messages).
Current Behavior
I believe the configuration topic gets removed from the Thing configuration, but the channels remain.
Possible Solution
Probably set a time after a thing initializes, and go through all the channels to ensure their component still exists. Can be triggered right away if a topic is removed from the thing config.
Steps to Reproduce (for Bugs)
Your Environment