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

@ThomDietrich
Do you have any idea why a sensor type DS18B20 gives a comma (’,’) in its output instead of a decimal point? Could this be a configuration within the Sonoff-Tasmota firmware? I installed both Sonoffs one after the other with the same version 5.11.1. I just downloaded Theo’s binary and installed it without changing anything.

I looked into the user_config.h file but could not find a configuration setting for the decimal point character.
As you can see it is also in the web inteface of the Sonoff:

@deltabert As already written above the comma for the DS18B20 temp value is a bug in the Sonoff-Tasmota firmware. But luckily for you it is already fixed: https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino#L59 in the 5.12.0 firmware version.

Hi Markus,
Thanks for this info! I’l immediately will install the newer version.
(was just writing to Theo about this. Good that i saw your message comming in. Just in time to quit this message :wink: ) I am sorry, I should have checked the release notes! :frowning:

Update: It’s working now. Thank you all for helping me with this.

Just a couple notes with the POW’s based on what I’ve experienced recently…

Be careful flashing the latest firmware (5.12.0) via OTA from the web site or manual upload. Its left my Sonoff POW’s totally inoperable. I had some other POWs lying around on my desk so I tested flashing these via Arduino IDE with the same firmware, and found they boot up, crash, reboot over and over. However I noted that the cause of this was that the lwIPvariant was set to v2 prebuilt, so under Tools menu in IDE, change to v1.4 prebuilt then reflash and it stops the continuous reboot behaviour. I am also unsure, after I did the OTA update on my original ones, whether the lwIPvariant has a bearing on the crashing issue there, since it seems to be an IDE setting? I have yet to unplug the “dead” POWs from the wall and update directly via serial yet (hopefully tonight after work). Also don’t bother with development release 5.12.0d yet, while that boots up ok, MQTT doesn’t work. Rollback to 5.12.0 and MQTT works again.

EDIT 1: Actually, one of the Sonoffs is a basic, and that’s dead… so may be related to other models too.

EDIT 2: Removing from the wall, plugging into FTDI and testing, nothing, dead as. Re-flashing, voila, comes up and working fine again. Need to do more testing to do determine OTA flashing cause…

EDIT 3: Tested flashing the Sonoff basic OTA again, pointing to 5.12 bin file, appears to be successful, restarts, but then no response doesn’t come back up, doesn’t respond to pings. However, pulling power completely and plugging back in, it does respond again. So, tested dropping mains power to whole house, power back on, however this does NOT fix the Sonoff POW. Going to have to remove from the wall and attempt re-flashing the POW and see what happens…

EDIT 4: Removed Sonoff POW from wall (it runs my swimming pool return pump) and noticed it had a burn LIVE pin on it. I plugged in via FTDI cable to test anyway. Got zero response from it, no button press etc, just didn’t work. So, I re-flashed it via serial - it completed flashing 100%, but just wouldn’t work (connected, disconnected from serial over and over). Burnt pin,… in the bin. I am fairly positive that the burnt pin was caused by Sonoff booting up, crashing, resetting over and over. I took a video of this and uploaded to Youtube - (turn your volume up) you can hear the relay clicking on/off very fast - likely a continuous reboot, crash, startup would have created some fairly heavy surges in mains power and caused this. Scary stuff as this is a potential fire hazard…, and something I would suggest gets trapped in the firmware - say either delay a couple of seconds on start up, or some process on startup to check the “boot count” within a fixed time period, and if its on, off, on, off, within milliseconds, then stop. Obviously if the Sonoff crashes prior to the code kicking in its useless, but food for thought.

sonoff

2 Likes

Issue fixed in 5.12.0d

  • Add compiler check for stable lwIP version v1.4 (#1940)

That means that can happen to every version, if you use the unstable lwIP v.2.
Be careful if you compile versions before 5.12.0d to use lwIP v1.4!!

Is there any demo set of items and rules for AiLight?

AiLight should be equal to a RGBWWCW Led stripe in use with mqtt / OpenHab.

@muelli1967
High Jan,
you were able to show the actual version number of Tasmota without the leading “v”. Could you share your solution?

sure. here are the items in the items file:

String SonoffCurrentVersion "Sonoff fw version on public server [%s]" 
		{ mqtt="<[maddox:sonoff-version:state:REGEX(.*?(\\d+\\.\\d+\\.\\d+).*)]" }

String Sonoff1LocalVersion "Sonoff #1 running fw version [%s]" 
		{ mqtt="<[mosquitto:tele/sonoff1/INFO1:state:JSONPATH($.Version)], 
				<[mosquitto:stat/sonoff1/STATUS2:state:JSONPATH($.StatusFWR.Version)]" }

Thanks for this answer.
However, if I’m not mistaken you are using a seperate mqtt Server to get the version info of Tasmota. How did you set that up? I’m actually using the http-binding way to get the Version number, but using that way i get “v5.12.0”.

exactly, i used this post to set it up. It is an external mqtt broker.

1 Like

Thanks, I must have overlooked that one (this thread got rather long).

A note to all that would like to flash a sonoff without soldering (like me).
Trying to hold the pins into the sonoff while pushing down the button didn’t work that well. The long pushbutton, without the covering, is really unstable and I broke two of my switches while trying to come into the flash mode.
However when sticking the pins into the board and covering the switch with its cover not only the use of the pushbutton was much easier, the conections where also held quite stable (for my last remaining 4 switches I had no false try!)
Some pictures:

Now I only need to find a way to get into the flash mode on the switches with a broken push-button (the small metall foil is gone as well :weary:).

nice one. i also have a similar cable only for flashing sonoffs.

Thanks very much for the helpful tip. My ftdi programmer arrives tomorrow. I’m so glad I won’t need to solder. Shame about losing the ability to OTA update.

I ordered a couple of those switches, basic, double and TH versions. The double and TH versions were still able to OTA flashed!

1 Like

Hi all,

I have ordered 100 Pogo Pins from China for flashing some time ago and i definetely won’t need all of them.
So if someone is interested, i can give away some of them for free.
I would suggest packages of 10 Pins.

I would send them over on postal way, but only within germany. (Sorry)
If you would like to take the postal charge that would be fine but not necessary.

So if you want some of them, just message me.
There’s no reason to hide them here in my cabinet, when i won’t need them all anyways.

Hi guys a msg from a newbie on OpenHAB with some SonOffs, thanks for all these excellent hints, tips and inspiration. Specific in msg #84.

I also tried the other variant but was Not sure how often the maddox MQTT statement (#515) was “pushed” till I realised that #126 already mentioned adding an entry in mqtt.cfg :slight_smile:. However must still made a mistake or missing something because the result is:
Sonoff fw version on public server REGEX(.?(\d+.\d+.\d+).)
(not a real issue)

I also want to use the Sonoff icons from @ThomDietrich but so far i only searched them on the wrong places :confused:, Already published?

To end this story I have 2 Sonoff basic (a POW and a TH16) but only one of them gives an error on the “queryFW” command. Think this Sonoff basic works for the rest as expected:

2018-04-02 10:25:52.244 [INFO ] [.smarthome.model.script.sonoff.rules] - Sonoff Maintenance on all devices: queryFW
2018-04-02 10:25:52.257 [INFO ] [.smarthome.model.script.sonoff.rules] - Sonoff FW Query on device: [sonoff1, sonoff2]
2018-04-02 10:25:52.274 [INFO ] [.smarthome.model.script.sonoff.rules] - Sonoff FW Query on device: [sonoff1, sonoff2]

2018-04-02 10:25:52.281 [ERROR] [.mqtt.internal.MqttMessageSubscriber] - Error processing MQTT message.
org.openhab.core.transform.TransformationException: Invalid path '$.StatusFWR.Program' in '{"StatusFWR":{"Version":"5.12.0","BuildDateTime":"2018-02-09T14:54:51","Boot":6,"Core":"2_3_0","SDK":"1.5.3(aec24ac9)"}}'
	at org.openhab.core.transform.TransformationHelper$TransformationServiceDelegate.transform(TransformationHelper.java:67) [208:org.openhab.core.compat1x:2.2.0]
	at org.openhab.binding.mqtt.internal.MqttMessageSubscriber.processMessage(MqttMessageSubscriber.java:138) [215:org.openhab.binding.mqtt:1.11.0]
	at org.openhab.io.transport.mqtt.internal.MqttBrokerConnection.messageArrived(MqttBrokerConnection.java:556) [209:org.openhab.io.transport.mqtt:1.11.0]
	at org.eclipse.paho.client.mqttv3.internal.CommsCallback.deliverMessage(CommsCallback.java:475) [209:org.openhab.io.transport.mqtt:1.11.0]
	at org.eclipse.paho.client.mqttv3.internal.CommsCallback.handleMessage(CommsCallback.java:379) [209:org.openhab.io.transport.mqtt:1.11.0]
	at org.eclipse.paho.client.mqttv3.internal.CommsCallback.run(CommsCallback.java:183) [209:org.openhab.io.transport.mqtt:1.11.0]
	at java.lang.Thread.run(Thread.java:748) [?:?]

Any ideas?

We would have more ideas if you would post the setup used. Like the rule, the items…

I’m getting an error when trying to flash…

C:\sonoff\esptool>esptool.py --port COM8 write_flash -fs 1MB -fm dout 0x0 sonoff.bin
esptool.py v2.3.1
Connecting….
Traceback (most recent call last):
File “C:\sonoff\esptool\esptool.py”, line 2637, in
_main()
File “C:\sonoff\esptool\esptool.py”, line 2630, in _main
main()
File “C:\sonoff\esptool\esptool.py”, line 2349, in main
esp = ESPLoader.detect_chip(args.port, initial_baud, args.before, args.trace)
File “C:\sonoff\esptool\esptool.py”, line 223, in detect_chip
detect_port.connect(connect_mode)
File “C:\sonoff\esptool\esptool.py”, line 407, in connect
last_error = self._connect_attempt(mode=mode, esp32r0_delay=False)
File “C:\sonoff\esptool\esptool.py”, line 387, in _connect_attempt
self.sync()
File “C:\sonoff\esptool\esptool.py”, line 341, in sync
timeout=SYNC_TIMEOUT)
File “C:\sonoff\esptool\esptool.py”, line 277, in command
self._port.timeout = new_timeout
File “C:\Users\colin_000\AppData\Local\Programs\Python\Python36\lib\site-packages\pyserial-3.4-py3.6.egg\serial\serialutil.py”, line 368, in timeout
self._reconfigure_port()
File “C:\Users\colin_000\AppData\Local\Programs\Python\Python36\lib\site-packages\pyserial-3.4-py3.6.egg\serial\serialwin32.py”, line 222, in _reconfigure_port
‘Original message: {!r}’.format(ctypes.WinError()))
serial.serialutil.SerialException: Cannot configure port, something went wrong. Original message: PermissionError(13, ‘Access is denied.’, None, 5)