The last part I get. Whenever the openHAB switch receives a command, it sends the switch state as payload to topic cmnd/SonoffS20-1/POWER (which is then processed by Tasmota).
But I wonder how does openHAB tell Tasmota to publish information for topic stat/SonoffS20-1/POWER? In other words, how does openHAB know about current switch state?
I noticed when sending an empty payload to the topic cmnd/SonoffS20-1/POWER, Tasmota will reply with the required stat topic. Is this what happens when openHAB initializes the binding?
Thanks. Does this mean that openHAB doesnât know anything about the real status as long as Tasmota hasnât provided any information? Tasmota will only provide the information via stat topic if either someone presses the physical switch button or uses the openHAB switch item.
Btw: I double checked the tele information. Thanks for the hint.
The OH2 Item will subscribe to the MQTT topic and get the status message from the Broker (where the Sonoff publishes). The Broker keeps (retains) the (current) message and provides it to the subscribers.
OH2 will not âpollâ the Sonoff. Since you have a Broker in the middle, all comms are via the Broker (no direct exchange of info between OH2 & Sonoff).
Well⊠of course yes⊠how else would OH2 know the status?