Tasmota config for Sonoff Mini
Set inverted follow switch mode:
SwitchMode 2
If this is a switch where you are controlling devices through MQTT and you don't want direct relay control, like say if you have smart-plugs on the switched outlet or you just want it to control smart-bulbs in various places, you need this:
Backlog Rule1 on switch1#state=1 do publish mini4/stat/SWITCH1 {"STATE":"ON"} endon
Backlog Rule1 + on switch1#state=0 do publish mini4/stat/SWITCH1 {"STATE":"OFF"} endon
Rule1 on
Then you can set up the appropriate automation in HA based on the Mini's switch.
(The previous version of the code I have for this was before the days of MQTT HomeAssistant auto-discovery in Tasmota, via SetOption19 1. Which has now been superceded by SetOption19 0 Tasmota integration auto-discovery in HomeAssistant. Try to keep up.)
Oh. Neat. Apparently Switch<->Relay detachment is superceded with an option, if you have it... I do not, on v8.1.0. If you do:
SetOption114 1