[Release] Tasmota Sonoff Hubitat Driver & Device Support

Ended up having some time and went ahead with merging Hubitat support into v7.1, any comments/bug reports would be highly appreciated.
Hubitat support is in the branch "release-7.1-hubitat":

Compile the "tasmota-hubitat" version to enable the Hubitat integration. As always, use "tasmota-minimal" (built from the same source as "tasmota-hubitat", otherwise you might end up having to restore through TTL) then follow with "tasmota-hubitat" to flash over http.
I recommend creating a user_config_override.h and enabling override in my_user_config.h. That way you can set wifi credentials and the HA IP in advance.
Enjoy! I will be testing this with some Tuya devices which needed new features not available before...

1 Like

Yeah, I just haven't had the time. Thanks for working on it. :slight_smile:

Looks good. I gave it a whirl and only had issues with it pulling in the hubitat IP/Port/enablement if it was only in user_config_override.h; I had to put the IP and Port in my_user_config.h and even then, only the IP made it into the device. It might have been me since this was my first time messing with compiling my own firmware.

Curious what features in 7.1 that made you interested in it?

@ericm: I understand, most of the work was already done by you and the creators of Tasmota, it's a nicely coded piece of software, easy to work in. Haven't written anything for Arduino in over a year... No time...
It would be nice to try to get this merged into the main Tasmota firmware, but I don't know yet how hard that will be to get accepted. First I probably have to clean things up and move the code out of the MQTT module. Any thoughts on this?
@brianwilson Thanks for testing it, to use the user_config_override.h approach, you need to uncomment the #define on line 39 in my_user_config.h. The README.md has details.
As for the reason why, it's the TuyaSend functionality that I need for some Tuya-based 4-way touch switches. They have a secondary MCU which the ESP8266 has to send and receive data from. The support for this does not exist in 6.7.1 even, and definitely not in 6.6.

Yeah I did that. Got my WiFi info in there as well an fit worked with the user config file. Was Just saying that I was never able to get the Hubitat port to show anything but 0, even if I changed either file. I guess I should go looking for a variable spelled incorrect.

Ok, that should not be the case, but did you also change CFG_HOLDER to a new value every time you had made a change to the config? Otherwise the new config will not be read. This is a feature to let you keep your local configuration between firmwares.

1 Like

@ericm I looked at the placement of hubitatPublish() again, and I really can't see a cleaner way than placing it here, there's too many different routes into MqttPublishDirect() from all over the code.

1 Like

Ahh. So I tried that, increased it by 1, but it didn't save my wifi info or Hubitat settings (i.e. had to setup via sonoff SSID). Appears it took my override settings (see below), but had to set up from sonoff SSID. Then tried to restore back to sonoff-minimal.bin so I could reflash to -1 and the device never came back (looks like a blue light inside my plug is blinking constantly). Oh well.

file included from tasmota/my_user_config.h:610:0, from /workspace/Tasmota-Hubitat/tasmota/tasmota.ino:32: tasmota/user_config_override.h:24:2: warning: #warning **** user_config_override.h: Using Settings from this File **** [-Wcpp]

Do make sure you have "#undef" before each #define in user_config_override.h, like this:

// -- Setup your own Wifi settings  ---------------
#undef  STA_SSID1
#define STA_SSID1         "YourSSID"             // [Ssid1] Wifi SSID

#undef  STA_PASS1
#define STA_PASS1         "YourWifiPassword"     // [Password1] Wifi password

Do you mean that you now neither get your device back on your wifi nor have it start as an AP?

Correct. It appears bricked after downgrading from 7.1 (with increased CFG #) to tasmota minimal.

There's a lot of changes to the saved config part of the code and many additions to the structure. A word of caution to others, stick to the minimal build generated from the same code base and the same compiler. It is the same cautioning ericm has at the top of the first post in this thread.
Unfortunately the way to solve it now would be through TTL, if you need any help with that, please don't hesitate to ask.

1 Like

Thanks. I’ve done it before using this guide [Release] HubDuino v1.1.7 - Hubitat to Arduino / ESP8266 / ESP32 / ThingShield Integration (ST_Anything). Let’s see if I can do it again.

Ok, good luck! At least it looks easier than what I dealt with the other day:
image

I’ve also seen some 3d printable tools for flashing ESP32 and TYWE3S and similar ones. Just insert some pogopins in the 3D printed model and it’s easy... I don’t have a 3D printer though...

Ha not much better here. Can you point me to the tools to 3D print? Any advice on what I should flash to it? I’m using esptool.

Since I haven’t got a 3D printer I haven’t looked looked very closely at this, but this is what I have in my bookmarks:
https://m.yeggi.com/q/esp+pogo/

Yes, very similar, I’m happy I don’t have to solder as much, I’m really not very good at that...

I would clear the flash and put my version of Tasmota 7.1 on it, I’ve put it on a Sonoff Mini that was a bit glitchy with the previous version, the last 24 hours it’s been rock solid. But I guess more time is needed to really know. I’ll be running this on 30 devices as soon as I have the time to write the drivers missing for some of them.

I’ve also flashed back and forth OTA between my version and Tasmota Minimal from the same codebase, and no issues.

Finally got it. Bizarre I can’t flash it at 3.3v, had to go to 5. Never could get it to run any flash when not connected to the socket; just but Eric’s original firmware on it and will let it be.

Hi
@markus and @brianwilson I have about 14 Sonoff devices and TX light switches running in Hubitat I am using @ericm 's pre complied Sonoff.ino.generic.bin (6.6.0) do you guys have the complied bin file that would take ericm's version to 7.1 or are you still working on this? Also if I upgrade the devices to the 7.1 would the drivers in Hubitat still work 100%.

Great to hear you got it to work again, with it being this hard to resurrect, if it is stable on 6.6, maybe best to keep it there? I do appreciate you testing my firmware though, important to know it works for others. Thank you for trying!

I will release this version in binary form soon, but want to wait for the official Tasmota version to release their final version of 7.1 first.
With that said, everything is very stable for me, but will continue to run it to make sure. If your devices are stable on 6.6 and you’re not missing any functionality, then don’t upgrade, at least not yet. If you want to help testing this new version I would appreciate the help, but as you can see above, you may end up having to resurrect the device through TTL.
As for driver compatibility it should be 100%, the communication code is exactly the same as in 6.6 except what has been changed by the original author of Tasmota, but the API remains the same. I’m currently writing new drivers for TuyaMCU based devices, but the Sonoff ones stay the same.

I need help. I don't know if I've missed a step or just confused.
Updating the Sonoff TH with new firmware went fine. Upon download the module did broadcast an SSID but now it's gone! I've tried shutting everything off, reflashing, etc. - Nothing seems to be working now... Any ideas??