[Release] Tasmota Sonoff Hubitat Driver & Device Support

Note: This is a fork of the amazing Tasmota firmware.

Note: Another community member (@markus) has taken this project to the next level and has added support for many more esp8266 devices. I recommend that you check out his project: [DEPRECATED] Tasmota 7.x/8.x firmware for Hubitat + Tuya, Sonoff and other drivers

Warning: I don't know which method you first flashed your devices with so there may be issues with the OTA from regular Tasmota to this version if your current firmware was compiled a different way. First, after the flash, check to see if the device is broadcasting its SSID and needs to be setup again. If for some reason the OTA does not take, then you may have to flash with the UART headers.

Some may know that I have created an alternate firmware for some esp8266/esp8285 devices (Sonoff, H801, Arilux, etc.) I haven't had the time to keep up with the dozens of devices being released based on the ESP chips. So, I have decided to create a "driver" for Hubitat/SmartThings essentially adds support into the Tasmota firmware.

My plan is to add support to the Tasmota releases (6.4, 6.5, etc.) and not the development branch (since it is a moving target). So, for the 6.5 release you can see the work here 6.6 is up now:

Source

https://github.com/erocm123/Sonoff-Tasmota/tree/6.6

This is a work in progress so any additions to that fork are welcome. Right now I have pretty much everything working (Device discovery, control, device reporting, etc.) but things can definitely be modified and added.

One thing that is lacking is the Hubitat driver list. There are dozens of devices supported by Tasmota so drivers need to be created for the ones you want. The drivers are easy to create though. You basically need to create the events for the attributes that are being reported in the parse method and create a few command methods for the type of things you control (on, off, refresh, etc.). Here are the drivers that I have created and any others will be in my Hubitat git with "tasmota" attached to the name.

Hubitat Drivers (if you make some please contribute)

Sonoff S31
Sonoff SC
Sonoff Bridge (this unique device needs a lot of work)
Sonoff S20
Sonoff 4Ch
Sonoff 2Ch
Sonoff 3Ch (Generic 3Ch)
Sonoff TH

Compiled Firmware

Here is the compiled firmware if you don't want to build it from source. I used the recommended building settings from Tasmota, so you should be able to upgrade to it like you would the regular firmware (first OTA the minimal firmware and then OTA this firmware). I don't know which method you first flashed your devices with so there may be issues with the OTA if your current firmware was compiled a different way. If for some reason the OTA does not take, then you may have to flash with the UART headers.

Compiled Firmware

Device Discovery

You can use my device discovery App to find the devices on your network, add them, and manage them. You will need to enable the Hue Bridge Emulation from the device web configuration for this to work.

https://github.com/erocm123/Hubitat/blob/master/Apps/sonoff-connect.src/sonoff-connect.groovy

Overview of Steps:

  1. Flash device with modified Tasmota firmware above and connect it to your wifi network.
  2. Install Sonoff (Connect), Hubitat Tasmota Drivers, & any child device drivers that are needed.
  3. Turn on Hue Device Emulation from the device web page (for device discovery).
  4. Start the device discovery from within Sonoff (Connect) and add the detected devices. You may have to wait a few minutes for the devices to be discovered.
  5. Add the device. Check the web interface of the device to make sure that Hubitat support got enabled and that your Hubitat IP address and port number are in the configuration page. I recommend that you give your Hubitat hub a static IP or DHCP reservation. The Sonoff devices do not need static IPs since the Sonoff (Connect) app will update their IPs if necessary, but doing so definitely won't hurt.

7 Likes

@ericm I am an avid fan of SmartLife firmware and device drivers you have created. What is the natural evolution of this? Should we be moving to tasmota? If so do we lose some of the capabilities of SmartLife such as the lighting app capabilities (cycling colors, police lights, etc)?

I'd say if your device isn't currently supported by my other firmware (H801, older Sonoffs) then Tasmota would be the path going forward. Since it supports more devices than I can keep up with. If the other solutions are working for you, there isn't a reason to change. Especially with the H801 since there are several functions in the SmartLife firmware that aren't in Tasmota.

2 Likes

I used tuya-convert to update my Xenon plug to Tasmota 6.5. All worked just fine. Then I used firmware update feature using FILE/OPEN instead of a URL to upload Erics firmware. It bricked the plug. So I hesitate to use this firmware but I see no other support for Hubitat/Sonoff without this patch.

I was excited at first, but now I am taking a step back....IFTTT and SmartLife have always worked just fine for me but just sometimes get out of sync so I was trying to eliminate that. I'll probably stay with SmartLife for now...

1 Like

This can sometimes happen if the firmware is compiled differently for one version vs what you are trying to OTA. I used the recommended compile settings here:

The device likely isn't "bricked", but needs to be re-flashed over UART. If it doesn't have easily accessible headers, that could be a problem. Also, check and make sure it isn't just broadcasting the "Sonoff" SSID and needs to be configured for wifi.

I have a notice about the compilation incompatibility in the first post, but I'll make it stand out more.

1 Like

I'm getting an error using any of the hubitat drivers when trying to save:

"unable to resolve class physicalgraph.device.HubAction @ line 340, column 19. unable to resolve class physicalgraph.device.HubAction @ line 353, column 19."

Are you sure you're trying the hubitat version of the drivers?

I am having few issues with my first device conversion to your firmware. Device is a Brilliant Wifi smart plug. ( Brilliant USB Charger)
The device flashed ok and is configured on the network. I can browse to the device IP and control it but when I try to add it to Hubitat it will not auto connect. Port has been set to 39501 with the IP for my hubitat. Hubitat enabled and Hue Bridge selected.
I did a manual connect and changed the device ID to the MAC address. I am getting debug reports as follows.

result: [Time:2019-06-15T07:26:33, Uptime:0T00:25:29, Vcc:3.462, SleepMode:Dynamic, Sleep:50, LoadAvg:19, POWER:ON, Wifi:[AP:1, SSId:NETGEAR51, BSSId:CC:40:D0:5C:7F:C0, Channel:8, RSSI:76, LinkCount:1, Downtime:0T00:00:05]]

result: [StatusSNS:[Time:2019-06-15T07:26:30]]
result: [StatusSNS:[Time:2019-06-15T07:26:25]]
result: [StatusSNS:[Time:2019-06-15T07:26:20]]

When ever I try to control the device from the device page I get the following error: This was for an ON command.

[error]groovyx.net.http.HttpResponseException: Not Found on line 213 (on)
[debug]on()

Have i done something wrong ?? Incorrect setup - maybe ?? Not sure where to go from here.
I have 10 other devices I want to flash but I do not want to stuff them all up until I get this 1 sorted.
Thanks in advance for your support.

Program Version 6.5.0(sonoff)
Build Date & Time 2019-05-29T11:39:28
Core/SDK Version 2_5_0/3.0.0-dev(c0f7b44)
Uptime 0T00:18:01
Flash write Count 22 at 0xF6000
Boot Count 7
Restart Reason Software/System restart
Friendly Name 1 Switch5
AP1 SSId (RSSI) NETGEAR51 (74%)
Hostname sonoff_switch5-4267
IP Address 192.168.1.185
Gateway 192.168.1.1
Subnet Mask 255.255.255.0
DNS Server 192.168.1.1
MAC Address XX:XX:XX:XX:XX:XX(blanked for security)
MQTT Host 192.168.1.25
MQTT Port 1883
MQTT User AJ240
MQTT Client DVES_BB30AB
MQTT Topic sonoff_switch5
MQTT Group Topic sonoffs
MQTT Full Topic cmnd/sonoff_switch5/
MQTT Fallback Topic cmnd/DVES_BB30AB_fb/
Emulation Hue Bridge
mDNS Discovery Disabled

So further to the issue above, I have been doing further investigating.
It looks like device discovery is not working as expected. If I flash with the standard Tasmota firmware then they are seen as UPNP devices on the network as a Hue Hub.
With this firmware they are not seen at all when I do UPNP discovery using a thrird party tool.
Yes: Hue Bridge emulation is on
Yes: Hubitat/smartthings enable is on.

Network discovery inside Hubitat detects the device.
192.168.1.188 84F3EB3774A3 urn:schemas-upnp-org:device:Basic:1
http://192.168.1.188:80/description.xml

Sonoff connect seems to see the device but not connect to it.
app:2292019-06-17 08:52:26.879 am debug quired
app:2292019-06-17 08:52:26.877 am trace description.xml response (application/xml)

I can see the description XML of the device and it is being identified as "quired" which seems a bit strange ??
root xmlns="urn:schemas-upnp-org:device-1-0">
<specVersion>
<major>1</major>
<minor>0</minor>
</specVersion>
<URLBase>http://192.168.1.188:80/</URLBase>
<device>
<deviceType>urn:schemas-upnp-org:device:Basic:1</deviceType>
<friendlyName>quired</friendlyName>
<presentationURL>index.html</presentationURL>
<manufacturer>iTead</manufacturer>
<manufacturerURL>http://smartlife.tech</manufacturerURL>
<modelDescription>iTead Intelligent Systems Co., LTD</modelDescription>
<modelName>quired</modelName>
<modelNumber>929000226503</modelNumber>
<modelURL>http://smartlife.tech</modelURL>
<serialNumber>3774a3</serialNumber>
<UDN>uuid:38323636-4558-4dda-9188-cda0e63774a3</UDN>
</device>
</root>

I am not sure what else to try ?

Hey Eric. Do you not have a Basic driver for Tasmota? Or is it the same as your regular Sonoff Basic driver? I also can't seem to find the hubitat version of the driver. The drivers you have linked up above don't load in Hubitat. I get the following error:

No signature of method: Script1.parseXml() is applicable for argument types: (java.lang.String) values: [ Default: Off Automatically turn the switch off after this many seconds. Range: 0 to 65536 Default: 0 (Disabled) In seconds Range: 0 to 65536 Default: 60 In seconds Range: 0 to 65536 Default: 60 In seconds Range: 0 to 65536 Default: 60 Send uptime reports at this interval (in seconds). Range: 0 (Disabled) to 65536 Default: 300 ] Possible solutions: parse(java.lang.Object)

@ericm, the driver I've downloaded doesn't seen to be working with Tasmota Version 6.5.0(sonoff) Build 2019-05-29T11:39:28,

I've adapted part of the driver changing some commands as for example "/on" to "/cm?cmnd=Power%20On" and now it looks to be working for a switch. But others features doesn't seeing to be working.

Do we have to update the driver to this firmware version, os is there a "better" firmware version that fits this driver ?

Thanks.

For the basic, you should be able to use the S20 driver. Sorry, I haven't had time to create the driver for the basic module but the S20 is about the same.

S20 Driver

@luis.c.amaral Are you also using a Sonoff Basic? You can also try using the S20 driver.

Edit: Oops, I just realized the driver links were for the SmartThings versions. This has been fixed.

Thanks @ericm, I did figured out how to adapt the drivers for the basic and everything is working fine with automation rules and Google Home Assistant.

Now I am playing with an Acemax powerstrip that I could flash tasmota on it and trying to understand how to update the child devices with the status and how to turn off all the relays simultaneously.

All this is new for me as I've just started my adventures with hubitat a week ago. Trying to get up to speed on my spare time.

Thank you for replying back,
Luis

1 Like

Do you have to use your Sonoff Connect software in order to use your firmware? Because I was able to patch together a driver that accepts reports from your firmware so local changes are captured without having to use the connect. Has really impacted the size of my system log events.

What are the chances of this working on these devices: AWP02L-N. I used this walkthrough and it works great, but the current other drivers aren’t real two-way with Hubitat. Since these don’t have easily accessible headers I guess we’d have to sacrifice one to find out if this would work?

I posted this over on the SONOFF Connect thread but figured I would ask here as well. Has anyone figured out how to connect the iFan03 or SONOFF Mini to Hubitat yet?

I try to flash couple of switch that are running tasmota 6.5 and it fail.

Upload Failed

Upload buffer miscompare

Were you doing it over OTA or a serial adapter? If OTA, did you first flash the Minimal firmware? The firmware is too large to flash from one version to the other. So, they developed the minimal file that just does OTA and takes up less space.

If serial, did you boot to flash mode?

OTA, I did the sonoff.bin. So i need to do the sonoff-minimal.bin and then i should be able to flash the Hubitat sonoff.bin ? i will try that.

Thanks

@Ryan780 quick question what driver should i use for a basic light switch ?

1 Like