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

Jup, never used it though. Also see: https://github.com/arendst/Sonoff-Tasmota/wiki/SonOTA

2 Likes

I have flashed Sonoff B1 bulb with SonOTA, worked quite well.

2 Likes

I just flashed a Sonoff Basic with this. Worked like a charm.

1 Like

is possible to have a bindings of SONOFF without flashing?

No. The original firmware is proprietary and only works with the provided app.
Sonoff-Tasmota on the other hand is free, open and extremely versatile.

1 Like

with this?

I see. Well that’s fun and all but I’d strongly suggest to install Sonoff-Tasmota. It’s a tested and working solution without wild hacks and the way to integrate in openHAB is completely described in the first posting of this thread.

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!

Thanks

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(unreach.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: https://github.com/arendst/Sonoff-Tasmota/wiki/openHAB#integration
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]" }

Hello!

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,
Davor

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…?

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

Sitemap:
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

Sorry,
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.