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

What is? Please remember that others can only work with details you provide.

I have been using Sonoff-Tasmota for my own build LED drivers with ESP-01 --> Sonoff "own build" and javascript

Sorry about that I’m hindsight that was not the most well phrased question.

The question(s) that I wanted to ask was: does flashing firmware with sonota/tosmota also work with the LED lights from sonoff, specifically the B1 LED light?
Has any one made an implementation of the sonoff LED lights with openhab, with dimming, color change and the works?

I see. Yes it’s supported and as far as I know all of these features work. See:

I have several sonoffs with tasmota already up and running with openhab but today I added a sonoff RF bridge with tasmota. I already let it learn my rf switches’ signals but now I have the problem of adding them to openhab.

Does anyone have the code (or an idea) to do it? I get messages like this (topic / content): sonoffs/tele/sonoffRFBridge/RESULT = {“RfReceived”:{“Sync”:8130, “Low”:270, “High”:800, “Data”:“4536B4”, “RfKey”:3}}
so I guess I need to react to the right message only in Openhab.

Something like:

Switch SonoffrfBridgeBtn3 "Button 3 is: [%s]" { mqtt="<[mosquitto:sonoffs/tele/rfbridge/???]" }

where I am unsure about the last part.

Thanks for the help!

You’ll need to work with the JsonPath transformation. That is documented here: https://github.com/arendst/Sonoff-Tasmota/wiki/openHAB#integration

Switch SonoffrfBridgeBtn3 "Button 3 is: [%s]" { "<[mosquitto:sonoffs/tele/sonoffRFBridge/RESULT:state:JSONPATH($.RfReceived.RfKey)]" }

Hi not sure if this is the right post,I can’t place my sonoff basic in programming mode,I push the button on the sonoff and I’ve soldered the pins to sonoff and USB to computer but not working?

You need to:

  • power of the sonoff
  • push the button and keep it pressed
  • power on the sonoff

Now you can release the button and start programming. Did you do that? Also you have switched RX/TX lines on your programmer?

1 Like

Have tried that ,I have looked online new sonoff basic have problems getting into programming mode?

Sonoff Pow Switches state undefined after Openhab 1.8.3 startup

I’m running OpenHAB 1.8.3 on a RaspBerry with two Sonoff Pow with Arendst Tasmota firmware 4.0.3: I know these are not the last versions, but as almost everything works I am reluctant to update!
From the OpenHAB web page I can operate the two switches. If I operate the switches from their web page, the openHAB web page is updated. The problem is that at OpenHAB startup the status of the switches is Undefined (this is happening daily as I stop and restart openhab after a backup) and they appear as OFF while in reality they are ON.

Here’s my item definition (the line is split for improved readability)

Switch SonoffPow1 "Appl1 "  <heat> (SwitchStatus)  {mqtt=">[broker:cmnd/sonoff-pow1/power:command:ON:1],
>[broker:cmnd/sonoff-pow1/power:command:OFF:0],
<[broker:stat/sonoff-pow1/POWER:state:default]", autoupdate="false"} 

I’ve subscribed to the topic “stat/sonoff-pow1/POWER” with mosquitto_sub and I’ve seen that nothing appears when OpenHAB starts.

I then modified the item adding the tele/sonoff-pow1/STATE topic as follows

Switch SonoffPow1 "SAppl1 "  <heat> (SwitchStatus)    {mqtt=">[broker:cmnd/sonoff-pow1/power:command:ON:1],
>[broker:cmnd/sonoff-pow1/power:command:OFF:0],
<[broker:stat/sonoff-pow1/POWER:state:default],
<[broker:tele/sonoff-pow1/STATE:state:JSONPATH($.POWER)]", autoupdate="false"} // :.*

This solution works but I wonder if I’m following the right path or if there are some other ways to solve this problem.
Should I force OpenHAB to submit a message “stat/sonoff-pow1/POWER” in the startup rule (if yes how?) so that the item SonoffPow1 will be updated?

You could probably do something with persistence to make it so that OH remembers the last state?
But what happens if the state is changed while your OH is rebooting…
I had the same question and the Tasmota guys reckon the “tele” topic and it’s STATE is a decent approach.

1 Like

Thank for your reply.
Would it be worth updating the wiki with these findings?

Not a bad idea… Do you know how to do it cause I never have?
This is an example of the “tele” topic from a 4 channel Sonoff named “sonoff4ch01”.
I see it publishing this topic every 5 minutes.

Topic : tele/sonoff4ch01/STATE
Payload : {“Time”:“2017-11-13T07:52:27”, “Uptime”:0, “Vcc”:3.157, “POWER1”:“OFF”, “POWER2”:“ON”, “POWER3”:“ON”, “POWER4”:“ON”, “Wifi”:{“AP”:1, “SSId”:“MyWifiDontTouch”, “RSSI”:82, “APMac”:“AA:BB:CC:DD:EE:FF”}}

I understand your hesitation and concerns but still need to mention that at least once:
In my personal opinion you should upgrade to openHAB 2.1 before investing any more time improving your outdated 1.8 installation, not even to speak of the old openHAB 1.8 wiki which will soon be deprecated.

openHAB 2.1 is very stable and offers many new/improved features compared to 1.8. Old bindings still work with openHAB 2.1 while new are added every other day. There is really no sane reason to stay with 1.8 any longer. The only valid reason is of cause the initial effort. See http://docs.openhab.org/tutorials/migration.html

2 Likes

I would be very interested in knowing how you set it up I’ve tried on Ubuntu 16.04 LTS and it cannot find the sitemaps. I noticed with the raspberry Pi3 when you changed a sitemap or items a lot was written to the events file (or was it syslog) that doesn’t happen with ubuntu

can you help me in connecting the switch to openhabb server

Hello Samir, please do not hastily post a single sentence (without even checking your spelling) and expect anyone to either know what you are asking or helping with that. Please see the following links and come back with a more detailed response:

Best and good luck

1 Like

Thanks, however unfortunately there are no easy topics for novoices

I have yet to find a video or page where someone has gone step by step from installating tasmota firmware to configuring mqtt and then openhab to interact with sonoff

Even in one of the links you provided on sonoff its just basic code without any explanation on how to use it or for that matter there are no details on how to configure mqtt server.

We assume everyone using this would have on how to configure mqtt which is not the case

Again I am not blaming or criticising anyone but giving my prospective as a novoice if you see there are many well illustrated article and videos on how can install tasmota on sonoff but none which in detail give you all the steps on connecting and controlling the same from openhab

Hello Samir,
I can work with that message, thanks.

Yes getting started is not easy. Home Automation is a diverse field and you’ll need to get up your system step by step. There is no single video or page because multiple steps are involved and not all of them are relevant for everyone. E.g. most users will already have an MQTT broker set up and running. Hence there is no need to learn how to set one up. That’s why there are multiple resources you have to look into.

  1. First you should install an MQTT broker and integrate it in openHAB. There is a bullet-proof tutorial over here: MQTT Binding (v1.11) Getting Started 101 - Be sure to also follow relevant links.
  2. Now you need to flash tasmota to your Sonoff: https://github.com/arendst/Sonoff-Tasmota/wiki/Upload - So far this involved soldering and connecting a serial programmer but it just got a lot easier by the SonOTA method: https://github.com/arendst/Sonoff-Tasmota/wiki/Upload#sonoff-factory-ota-mechanism-experimental - I did not use the method yet but many have successfully and if you need help, you will find tutorials via google.
  3. Now you can configure the module to connect to your Wifi and Broker. That’s pretty easy and shouldn’t be an issue via the web frontend of the module.
  4. After everything went well and you’ve got a Sonoff module sending data to your MQTT broker, with this broker being connected with the openHAB MQTT binding, you can set up openHAB items for your module: https://github.com/arendst/Sonoff-Tasmota/wiki/openHAB

And there you have it. Your one single guide to success :wink: Happy Hacking!

1 Like

I installed openhab snapshot like described in the docs. with apt-get