NorthernMan54 / homebridge-tasmota

Plugin for Tasmota devices leveraging Home Assistant auto discovery
Apache License 2.0
35 stars 9 forks source link

Disconnected devices re-appear after Homebridge is restarted #9

Closed NorthernMan54 closed 1 year ago

NorthernMan54 commented 4 years ago

When the plugin is restarted it pulls in the retained Home Assistant Auto Discovery messages from the MQTT server for devices that no longer exist. This cause new accessories to be created, which are non-functional, that get cleaned up after the "cleanup" period.

1 - Need to provide details in the README around using MQTT Explorer to remove the retained config messages from disconnected device.

2 - Do I need to include a Online status check as part of the discovery process, and only create accessories for devices that are online ?

StumbleNOLA commented 4 years ago

Short term just junking non-online devices is fine. Longer term I think they need to be populated so you can track what may be having an issue.

So long as the plugin is just being used by people heavily invested in playing with the system just dropping offline is fine. But people who 'just want it to work' are going to forget which sensors should be there.

NorthernMan54 commented 4 years ago

After thinking about this further, I’m thinking the following in regards to removal of disconnected devices.

Get rid of the existing auto cleanup of disconnected devices and instead only clean up once the retained homeassistant messages are deleted.

NorthernMan54 commented 3 years ago

In the current beta have changed the behaviour significantly, and am leveraging Tasmota setoption19 to remove devices. If setoption19 is set to 0 ( while homebridge-tasmota is running), the homeassistant discovery messages are removed from the broker and the plugin will remove the associated accessory.

Also if setoption30 is changed ( relays are lights ) the accessory configuration will update appropriately

rcarmo commented 1 year ago

Stumbled into this, and the way I flush out retained messages is by using:

mosquitto_sub -t '#' --remove-retained --retained-only

Has worked well a couple of times already.

NorthernMan54 commented 1 year ago

@rcarmo Tks for mentioning this option, I have updated the readme to include this