ITEAD Sonoff switches and sockets - cheap ESP8266 Wifi+MQTT hardware

Hi all, Just got my first Sonoff relays set up though im miffed if I know how to control a Sonoff Dual - could someone post and example of their .items for a dual? Not sure how to refer to the two relays!


my first post :wink:

Hey James!

Welcome to the community!
The solution is simple:

// Sonoff Dual
Switch WZ_Eulenlicht_Unten "Eulenlicht Unten" <light> (WZ,gLight) ["Lighting"] { mqtt=">[broker:tasmota/sonoff-E7659E/cmnd/POWER1:command:*:default], <[broker:tasmota/sonoff-E7659E/stat/POWER1:state:default]" }
Switch WZ_Eulenlicht_Oben "Eulenlicht Oben" <light> (WZ,gLight) ["Lighting"] { mqtt=">[broker:tasmota/sonoff-E7659E/cmnd/POWER2:command:*:default], <[broker:tasmota/sonoff-E7659E/stat/POWER2:state:default]" }
Number WZ_Eulenlicht_RSSI "Eulenlicht RSSI [%d %%]" (gRSSI) { mqtt="<[broker:tasmota/sonoff-E7659E/tele/STATE:state:JSONPATH($.Wifi.RSSI)]" }
Switch WZ_Eulenlicht_Unreach "Eulenlicht unreachable" <siren> (gUnreach) { mqtt="<[broker:tasmota/sonoff-E7659E/tele/LWT:state:MAP(]" }

Besides that I guess it would be great for you to know how to be able to find the solution by yourself. I’ve documented the process here:
Let us know if something stayed unclear!

Best! Thomas

Thomas, thank you for your reply - super speedy
Ahh that simple huh - awesome

Thanks for the link too!

1 Like

Hi guys,

I’ve setup my first Sonoff POW and am just starting off getting the on/off functionality working. Can someone take a look at my item entry below? At the moment the switch in my sitemap activates the POW just fine but I’m noticing that the updates are not showing in other user interfaces.

For example if I turn on the POW using OpenHAB app on my phone then the relay acivates but the state change is not reflected in the basic UI in my browser on my machine… If I refresh my browser and reload the page then the state is updated.

Switch SonoffPOW01 "Washingmachine" <washer> { mqtt=">[mosquitto:cmnd/sonoffpow01/POWER:command:*:default],<[mosquitto:stat/sonoffpow01/POWER:state:default]" }


If you switch it directly on the Sonoff (via hardware button), does it change status in OpenHAB (with or without refresh)? I’ve had problem with reporting status change when using hardware button, and then I’ve found out that my topic’s syntax differs from the examples I’ve found. This is a switch configuration for my Sonoff Touch with Tasmota firmware:

Switch Lights_Switch_Lobby “Lobby” {mqtt=">[mosquitto:cmnd/SonoffTouchLobby/POWER:command:*:default], <[mosquitto:tasmota/SonoffTouchLobby/stat/POWER:state:default]"}

The best way to find relevant topics (both in and outgoing) is to use mosquitto_sub, to have those topics reported when used (in case topics are the problem you’re having).

Best regards,

for me it works so well, look, maybe this will help you:

Hmmmmmm just tested this out on my “play” environment which is running OH2.1 vs OH2.0 in my “live” environment. This works perfectly in OH2.1 but does not reflect the proper state in OH2.0…

Switch SonoffPOW01 "Washingmachine" <washer> { mqtt=">[mosquitto:cmnd/sonoffpow01/POWER:command:*:default],<[mosquitto:stat/sonoffpow01/POWER:state:default]"}

Okay next challenge… I’ve got the current “Power” from the POW using this item.

Number SonoffPOW01_Power "Washingmachine Power [%.0f Watts]" <energy> (AllItems, LogRRD4J) { mqtt="<[mosquitto:tele/sonoffpow01/ENERGY:state:JSONPATH($.Power)]"}

Is is that is shows nicely in my sitemap but never changes. If I refresh my browser then it does show the new value. If I use MQTTBox on Windows I can see the POW broadcasting its information every 10 seconds like I’ve told it to.

I can’t figure out why it’s not updating in the browser as the change happens though?

Hey, you need to differentiate between the MQTT binding specific events and the presentation in e.g. Basic UI.
From what I’ve read the Item is updated correctly and you are facing presentation issues in Basic UI. This issue would be unrelated to the Sonoff, MQTT or the binding but rather to item updates in general. I’d recommend to check the timing of update events (via events.log), then create a new issue for the Basic UI issue.

I have a Sonoff on my pool filter / return pump, which I report wattage usage to OH. I want to have it appear red (aka, OFF) if watts are < 10 (as it does use a little bit of power while idle) or appear green if >10 watts. Oddly, it shows up blue. Surely this is something simple…?

Number poolPumpWATTS "Pump Watts [%.1f W]" <energy> (gPool) { mqtt="<[mqttbroker:openhab/sonoff/pool/ENERGY:state:JSONPATH($.Power)]" }

Text item=poolPumpWATTS valuecolor=[>10="green", <=10="red"]

Definitely Sonoff unrelated.

That said, I don’t think that is normal and would suspect a caching error or similar. Does it stay blue after an openHAB restart?

Issue was due to using “green”, didn’t show properly on iOS, updated to RGB colour instead and works fine, eg “#008000

Not sure if my question is answered already, but need some hints. I have bought Sonoff Touch EU version and flashed it to Tasmota firmware successfully. It seems to work fine but somehow not as I want it to be and I’m a bit confused with all settings it have.
Originally after flashing if you press the button it sends MQTT message with xxx/POWER ON or OFF. This is fine, but:

  • I don’t want built-in relay to toggle on this. My load is connected elsewhere and controlled via MQTT
  • I would like to receive MQTT message when button is pressed OR depressed. No toggle, no saying how many clicks were done, just these two messages.

Do you know how this can be accomplished with settings? I tried to add ButtonTopic, and now built-in relay seems to stop working, but device sends only xxx/POWER TOGGLE message and only when button is depressed and I don’t have any idea how to change this.

And some other topic - does this device have built-in temperature sensor, or is it possible to add one by soldering it to some pins of ESP? Would be nice mod for this switch.

Note that the quality of the Sonoff devices is what you pay for…
2 out of 4 devices I ordered, S20 and smart switch, are not working anymore within a year (and their warrant period is only 90 days).

One defect worries me a lot because it almost started a fire (the power switched by the device was well below the maximum). So I am looking for a better quality alternative

1 Like

This is indeed worrisome. I am only using them for low-consuming devices and did not have any issues yet. (Round about 40 devices in three homes)

There are many alternatives out there. However if you look for “better quality” you need to look at vendors located in better regulated countries. Established products do not work over WiFi. You’ll probably look at expensive components on Z-Wave or other specialized technologies… If someone knows of other devices that work via Wifi and are not enslaved by some dubious cloud, let me know!

Out of interest, what sort were the other two (the ones that are still working?)

The S20 and Smart switch don’t have any electrical safety certification. The ones that do have CE, the TH16, TH10, POW and DUAL look to have a PCB that is better designed for safety with better barriers etc.

The other Sonoffs are fine for ‘playing’ but really shouldn’t be used ‘full-time’ in your house because of risk of fire or electrocution.


Yeah that’s not ideal… I got 3 of the 4CH models to put into my switch panel to control lights centrally. The boards look to be of a decent quality.
Might have to put a temp sensor on each to possibly warn me of anything bad…

It looks like you’re ok.

The 4CH and 4CH Pro are certified too with their own compliance certificates.
Here’s the link to the page (the certificate links are at the bottom of the page).

i have two S20 and two smart switches (basic). One of each broke down.

it is not clear to me that they cannot be used for day to day usage:
The basic has a CE certificate (including safety):

The Sonoff Basic certification is fairly new (June 2017) which is why I hadn’t seen it before and these devices have been available for more than a year.
It looks like the Smart sockets also has certification now too.

Anyway, it’s great that Itead are taking this all seriously and getting their products approved even if they’re still catching fire!