Tasmota - martikainen87/Home-Automation GitHub Wiki

Sonoff flash

esptool.py --port COM6 erase_region 0x0F4000 0x008000

esptool.py --port COM6 erase_flash

esptool.py --port COM6 write_flash -fs 1MB -fm dout 0x0 sonoff.bin

SetOption30 1

SetOption19 1

LedState 0

Clearing retained messages in HA

Check all retained topics

mosquitto_sub -h 192.168.1.X -p 1883 -u mqttuser -P mqttpass -v -d -R -t '#'

Output will be like this

Client mosqsub/32422-Docker received PUBLISH (d0, q0, r1, m0, 'homeassistant/light/F89DB0_LI_1/config', ... (386 bytes))
Client mosqsub/32422-Docker received PUBLISH (d0, q0, r1, m0, 'homeassistant/light/F89E85_LI_1/config', ... (368 bytes))
Client mosqsub/32422-Docker received PUBLISH (d0, q0, r1, m0, 'homeassistant/light/A74444_LI_1/config', ... (389 bytes))

Copy the topics and use this command to clear it

mosquitto_pub -h 192.168.1.X -p 1883 -u mqttuser -P mqttpass -t "homeassistant/light/F89DB0_LI_1/config" -r -n
mosquitto_pub -h 192.168.1.X -p 1883 -u mqttuser -P mqttpass -t "homeassistant/light/F89E85_LI_1/config" -r -n
mosquitto_pub -h 192.168.1.X -p 1883 -u mqttuser -P mqttpass -t "homeassistant/light/A74444_LI_1/config" -r -n

Delete the core.entity_registry file and the core.entity_registry file restart HA and the entities should be gone from Congfiguration -> Integration -> MQTT. For any device you want auto discovery on, issue command SetOption19 1 in the console (tasmota)