[SOLVED] Sitemap auto detect current status of relays

Hi there,

Is there any rule to detect OFF status or the current status of the relay?

Everytime I open Openhab on the phone or in the laptop, I can not see the status OFF of the switches:

Actually, they are all OFF, but there is no feedback every time I open the page. I have to click on OFF to highlight them.

Could you post your sitemap code, please?

Like this:

   Switch item=sonoff01 mappings=[ON="ON",OFF="OFF"]
   Switch item=sonoff02 mappings=[ON="ON",OFF="OFF"]
   Switch item=sonoff03 mappings=[ON="ON",OFF="OFF"]
   Switch item=sonoff04 mappings=[ON="ON",OFF="OFF"]
   Switch item=sonoff06 mappings=[ON="ON",OFF="OFF"]

I think I am missing something, to detect the current state.

Try removing the mappings

It does not work.

If I switch on from the device or from MQTTfx for example, the page does refresh , does not pick up the status :confused:

My items delacartions:

Switch sonoff01 “LEDS”


You need to add autoupdate=“false” in the binding {}

Hi there,
According to the documentation, this is not working for me:


I need to out the sentece like the doc here: https://github.com/arendst/Sonoff-Tasmota/wiki/MQTT-Overview#configure-mqtt-settings


Then I am using the MAP(onoff.map), it does not work. I mean, after sending a command from MQTTfx on or off, the status is not updated in the openhab BASIC/CLASIC. Of course, if I command from the BASIC page, it works, but if someone turn on the switch from the device or from other device, it is not refresh. Something I am missing…

Switch sonoff01 "LEDS" <light>
<[mosquitto:sonoff01/state:state:MAP(onoff.map)]", autoupdate="false"

In MQTTfx what topic is the update sent by the sonoff and what payload?

Can you post your onoff.map file, please?

In MQTTfx,

To publish: “cmnd/sonoff01/POWER” with the PAYLOAD ON or OFF and works with 1 and 0.
To suscrbie: “stat/sonoff01/POWER”

Everything works fine between broker an client, and witches works perfect.

in transform/onoff.map:

Switch sonoff01 "LEDS" <light>
<[mosquitto:stat/sonoff01/POWER:state:MAP(onoff.map)]", autoupdate="false"

Mmmm now, it is working fine.
What it the meaning of &lt and &gt?

Thank you very much.

OOOOOKkk the symbols < and > o_O… loooool

Copy and paste browser errors, I corrected it, see above

Good, please mark the thread as solved.