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

@Justblair, @Csongor_Varga are you sure you chose the right firmware? You should consider switching over to arendst very good Sonoff specific firmware…

I’m using a raspberry Pi2, with the latest Openhab2 and the Mosquitto broker. MQTT is installed using Paper Ui. There is nothing to configure other than the mqtt.cfg file:

mybroker.url=tcp://localhost:1883

In ‘items’ I currently have a simple switch:

Switch Light_Computer  "Security Light"    (gCR, Lights) {mqtt=">[mybroker:home/sonoff/1:command:ON:1],>[mybroker:home/sonoff/1:command:OFF:0]"}

I use MQTTLens (from Chrome) on my PC to test for MQTT messages.

I’m using the Arduino IDE (arduino.cc) with the ESP8266 Board Manager plug-in.

I agree with @ThomDietrich that those unfamiliar with ESP8266 programming should use specific firmware like arendst. I just like programming with Arduino/ESP8266 so use my own simple code.

Sorry guys, I only got the notification now. After a lot of digging I found out that it is listening to topic gpio/12 and I send 1 or 0 to active. It was just not clear to me. I thought I need to configure an output in the devices and that got me down that rabbit hole.

Anyway, I managed to get it working with but I still need to play around with rules.

I am sure. If you just want to switch on a light the simpler firmware looks good. But I have added sensors to some of my devices. Yes I could code myself to add this function, but espeasy already reads the sensors that I need, and I like the rules it offers as well.

Thanks for the info. My Sonoff is still waiting in the box to get unpacked and because I like ESPEasy (I’m using it for my nodemcu ESP8266) I will try it …

Hello

Right now I am using the arendst firmware.
I can switch on/off the relay of the SONOFF TH10 but I am not able to read out the temp and humi…

Is there anyone that can share the item file for SONOFF products with arendst firmware?

Number Temperature "Temperature [%.1f °C]"      <temperature>           {mqtt="<[broker:/tele/TH10/DHT/TEMPERATURE:state:default]"}
Number Humidity "Humidity [%.1f %%]"            <climate>               {mqtt="<[broker:/tele/TH10/DHT/HUMIDITY:state:default]"}
Switch Relay                                    <switch>                {mqtt=">[broker:/cmnd/TH10/power:command:ON:1],>[broker:/cmnd/TH10/power:command:OFF:0]"}

I do not own a TH10. Things that come to mind: Did you configure your device to send these values? Did you subscribe to the topic yourself to see if values are actually coming in?

Yes I did and I can see the temp when I am subscribing to this topic:

pi@raspberrypi:/ $ mosquitto_sub -t "tele/TH10/DHT/TEMPERATURE"
22.4

and I can´t see in the Log that OpenHAB is reading this value.

You need to subscribe to the same topic in your items file:

Number Temperature "Temperature [%.1f °C]" <temperature> {mqtt="<[broker:tele/TH10/DHT/TEMPERATURE:state:default]"}

Note the absence of the leading slash!

1 Like

It is working

Thanks :smile:

1 Like

You’ve got the sharp eye :thumbsup: @klond it’s often these little details that drive us crazy :wink:

1 Like

I’m curious if anyone uses a button control with Arendst firmware?
I can control a relay from OH but for some reasons I cannot read a status of the button.
I see an update in mosquitto_sub:

root@rpi:~# mosquitto_sub -t cmnd/# -v
cmnd/sonbutt1/POWER ON

In the event.log:

WiFiButton1 state updated to ON

this is my Item:

Switch WiFiButton1 “Sonoff #1 (mqtt)” { mqtt=“<[rpilocalbroker:cmnd/sonbutt1/POWER:state:ON]” }

this is a basic rule:

// Sonoff button
rule “Button”
when
Item WiFiButton1 changed to ON
then
logInfo(“sonoff”, “button pressed”)
end

See this error in the log:

Error during the execution of rule ‘Button’: Index: 1, Size: 1

Edit: sorted out, made a mistake in logger name.
Anyway, will appreciate all the comments on this configuration.

There is a new device Sonoff SC.
https://www.itead.cc/sonoff-sc.html

It can measure humidity, temperature, pollution, sound …

Is there a way to include this in openhab too?

Wow that’s cool :wink: I’ll definitely look into that.
Can be integrated for sure. Just like with the other Itead devices the firmware will need reflashing (details) and a firmware to flash it with. I’m betting on arendst or some contributor to provide a firmware soon.

I’ve seen that there are two wiki websites referring to ITEAD products:

  1. the official one accessible from the ITEAD wiki
  2. the raspberryinfo website raspberrywiki linked from banggood.com
    The second one seems just a reseller website, but it shows products not available on the official ITEAD website: are these prototypes, or discontinued products? Does someone know something more about these “non official” products?
    Thank you for your attention

Outdated products I believe. The page doesn’t seem like a complete source for information.

On a side note: I’ve ordered 15 Sonoff modules a few days ago :smiley: I’ll finally add a full tutorial here for everyone to follow easily while doing the flashing and setting up myself. Stay tuned.

3 Likes

Does anybody know how accurate power measurements and temperature / humidity measurement is?

And where will you place the SONOFF for Temp/Humidity measurement?

It´s much to big for “under the wall” (in german: Unterputz).

I don’t think any sensor is meant to be installed “Unterputz” or flush mounted :grinning:

Do you have a good idea to make a mounting with high waf (woman acceptance factor)? My wife will kill me if i will mount it onto the wall.

The SONOFF for energy measurement is not the problem, this can be placed behind the furniture, but the SONOFF TH for Temp/Humidity must be placed in good visible areas.