[RELEASE] Sonoff (Connect)

Edit: I have been playing with adding a Hubitat / SmartThings driver to Tasmota (which is totally separate code from this project). My github fork for that is here: https://github.com/erocm123/Sonoff-Tasmota/tree/master. Firmware is here: https://github.com/erocm123/Sonoff-Tasmota/raw/master/sonoff/sonoff.ino.generic.bin. Drivers will be posted in my Hubitat repository (with Tasmota in the name) https://github.com/erocm123/Hubitat/tree/master/Drivers. After some progress, I will probably open a new thread). New thread is here: [Release] Tasmota Sonoff Hubitat Driver & Device Support

I've been working on porting my Sonoff Connect over to Hubitat in my spare time. I have the discovery app working, firmware updated, and the driver for the Sonoff Basic done. The drivers are taking a little extra work as I've had to use some alternate LAN communication methods to get Basic Authentication working. That is for those that want to password protect their Sonoff devices.

There is a wealth of knowledge on the SmartThings forums. Probably a little too much knowledge and I haven't had time to keep up on it.

Note: If you are having problems getting the AP after flashing, please see this post: [RELEASE] Sonoff (Connect) - #100 by ericm

Here is the Connect app for Hubitat:
https://github.com/erocm123/Hubitat/blob/master/Apps/sonoff-connect.src/sonoff-connect.groovy

Here are the driver and firmware links. Source is here.

Sonoff Basic, S20, & Touch
Basic Firmware, S20 Firmware, Touch Firmware
Driver

Sonoff 4CH / 4CH Pro
Firmware
Driver
Child Driver

Sonoff TH
Firmware
Driver

Sonoff Dual
Firmware
Driver

Sonoff POW
Firmware
Driver

Sonoff IFan02
Firmware
Driver
Child Driver

I'll work on the drivers that aren't finished yet, but if you take a look at what I had to do with the "Basic" driver, you can probably figure it out. If anyone does update them in the meantime, let me know!

20 Likes

i have a few of these lying around ... by releasing this you have inspired me to actually get these hooked up to hubitat and find a use for them. :slight_smile:

always appreciate the great work you do ... thank you much.

2 Likes

Was wondering if anyone has been able to get a Sonoff TH or POW to work yet? I've got 6 Sonoff Basic devices (flashed to basic firmware) working very well with HE. Thanks!

I haven't had a chance to work on them yet, but I hopefully will soon.

2 Likes

Hi @ericm,

I installed the driver for the TH16 I have which initially threw an error.

dev:3332018-07-10 19:24:52.755:errorgroovy.lang.GroovyRuntimeException: Could not find matching constructor for: hubitat.device.HubAction(hubitat.device.HubAction, null) on line 121 (updated)

I updated line 121 from
if (cmds != []) response(cmds)

To
if (cmds != []) sendHubCommand(cmds)

This then allowed, a Configure, and I can see in the logs its pulling back the data, but now having an issue with the Temp sensor connected, attempting conversion I think?

dev:3332018-07-10 19:28:28.994:errorgroovy.lang.MissingMethodException: No signature of method: dev1531247265336797493147.convertTemperatureIfNeeded() is applicable for argument types: (java.lang.Float, java.lang.String) values: [25.56, C] on line 175 (parse)

Any ideas? As I can see the Temp is being picked up.

Cheers

Yeah, that driver wasn't quite finished. In the main post, if the "Driver" link is grayed out then I haven't fully converted them.

Good news is that I did just post the link for the TH though. I haven't had a chance to test the temperature conversion so I need to see if that is still throwing an error. Everything else is seeming to work though.

3 Likes

Ah, apologies and noted.

I updated, and its working GREAT! Many thanks for this @ericm, this was one piston I was really missing. Have to keep a check on the Aquarium :wink: I don't see any errors being thrown, and have it SMS the Temp which is also triggering very well.

Many thanks again.
Cheers

Just tried the new TH and POW drivers and they working like a charm. Getting Temp, humidity, and power values reported. A hearty thanks for you help!!

1 Like

HI Eric,

I just moved my devices (about 20 or so s20's) into Hubitat from ST. Currently with the firmware I flashed onto em when I first set them up with ST. They don't report when they're turned on locally. I.E. Someone walks up to the thing and presses the button on the s20, and it doesn't report in Hubitat unless I go into the device settings and manually refresh it. Is there a difference between the ST and Hubitat firmwares? OR is auto refreshing not something that hubitat will do? I just want to know before I start opening all of them and re-flashing them.

1 Like

Correct, there's a difference. ST polls every (ZWave) device every 10 seconds. For devices that a) don't need status and b) devices that return status already (Zwave Plus) it's a waste of Mesh resources. Hubitiat's in-built refresh rate is ZERO, as in Never. You can however, create a Rule Machine Rule to run periodically and refresh ONLY the few devices that need the status.

1 Like

@ericm

Great work! Any update on your incredible SmartLife RGBW DH and APP?

THAT IS BRILLIANT! I'm doing this right now...

::scrabbles at keyboard::

Just a note, if you don't have the latest firmware for the s20 flashed it won't report status to Hubitat. Updating the firmware to what is posted above will fix that.

@aaron I have done some converting and testing of the RGBW controller. I haven't made a post about it, but believe it is working with the changes made.

The firmware is in my SmartThings github.

The App and Driver is in my Hubitat github

1 Like

Do I need to flash the H801's again with this firmware?

That was for zwave devices (yay z-wave sniffer!) I did not check to see if they did it for zigbee or lan devices.

1 Like

My Mistake! I'm a ZWave only kinda guy... I think in only ZWave.

I have two Zigbee (motion) devices attached to my 2nd Hub, along with a mandatory (it seems) Peanut plug. I don't really look for Zigbee devices when I need a device.

Actually, to be honest, I have only tested with an older firmware. I would try first with the firmware you currently have (with the Hubitat driver and App).

Eric,

Good news! The new firmware works with your current HE drivers and code.

Since you are still in development one of the coolest features in HE for SmartLife RGBw could be the new Scenes capabilities. As of now the DH doesn't support what is needed to capture color. @mike.maxwell posted recommendations here for standardizing color for scenes to capture. Not sure if you can look at this and make changes too.

@ericm Didn't expect to find you here! Have you switched to Hubitat or just playing with both for now?

Oh, hi @cjcharles!

I've mostly switched over, but have a few things still running on SmartThings. There are just a few things that I am waiting on before I can be completely switched over. :slight_smile:

3 Likes