by konnected.vn (https://konnected.vn -VI)
Custom service for Home Assistant to:
- Clear all MQTT retained topics which are used to auto-configure a device or entity via mqtt auto-discovery function (https://www.home-assistant.io/docs/mqtt/discovery/)
- Remove all device trigger related to removed device
HACS repo add:
Add github.com/konnectedvn/hass_mqtt_device_clean
to your HACS custom repositories under Integration category.
Search for mqtt device clean
and install.
Manually install:
- Create
mqtt_device_clean
folder inside your Home Assistant'sconfig/custom_components
(create newcustom_components
if not exists) - Copy all files inside
github.com/konnectedvn/hass_mqtt_device_clean/custom_components/mqtt_device_clean/
to new createdmqtt_device_clean
Add line below inside your /config/configuration.yaml
:
mqtt_device_clean:
Firstly, you have to remove your physical device from network:
-
Zigbee2mqtt:
-
ask your device to leave: zigbee2mqtt docs
-
remove your device from database.db (inside zigbee2mqtt data folder)
{"id":1,"type":"Coordinator","ieeeAddr":"0x00124b0014dl...} {"id":2,"type":"EndDevice","ieeeAddr":"0x00158d000429b...} <-- remove this line with identical ieeeAddr {"id":3,"type":"Router","ieeeAddr":"0x086bd7fff...}
-
OR using any assisted tools
-
-
Tasmota: remove your physical device from network or turn off discovery option
SetOption19 0
After this step, your device will not operate anymore but still exists inside Home Assistant. Even after you remove it from entity registry, device will be auto-added in next Home Assistant or mqtt broker reboot.
Secondly, find your device_id from Home Assistant > Configuration > Integrations > MQTT > [your_device] > MQTT INFO
Finally, from Home Assistant > Developer Tools, call service mqtt_device_clean.apply
with data:
device_id: 'your device_id'
discovery_topic: '(optional, defalt: homeassistant) your Home Assistant mqtt discovery prefix'
Hey dude! Help me out for a couple of 🍻 or a ☕ (☕ is preferred, have enough beers this year)!