[DEPRECATED]TuyaHubitat - (jinvoo, smart life, tuya smart - switches only)

Thanks I'll try this tonight.

Right. So... my current plan - which I might even get fixed this evening with a following wind (will be friday if not - I'm in work all day tomorrow), is to simply cheat. Tasmota really wants MQTT, but it looks to be to be pretty trivial to abuse the console page to simply shout HTTP at it. http:///ax?c1= looks to execute, although I might have to some faintly 'orrible parsing to pull back the JSON if I actually want return values. Simply lobbing HTTP at it blind would probably work most of the time, though.

So... I've got a nasty hacked up driver that can currently do the following:

  1. Turn the light on and off.
  2. Set the colour. My HSV calculations are currently off - the bulb looks to accept a number between 0 and 360... but we don't specify it like that. More research required there.
  3. Set the bulb to white mode. Easy to do... but I need to dig a little, as this bulb looks to be RGBW, not RGBWW, so it doesn't do colour temperature as such. Not sure what the preferred command for switching modes is yet.

What it doesn't yet do is parse any of the responses it gets, or properly track the light's state (which it'd have to by keeping track internally, and maybe periodically polling to catch up with other people controlling it).

So... anyway... nearly there. OH ... one thing I would say, though... is that Tasmota clearly expects the PWM channels to be in 'RGBW' order, not 'WRGB', as I'd mistakenly initially configured it.

-- Jules

1 Like

Well I think i just bricked my socket. A little digging shows it is similar to sockets other have reported as bricked. Not sure I will be ordering any more. :frowning:

OK gang.

So... here's my VERY early attempt at a working DH for Tasmota RGBW bulbs.

It just about does colour and, while it doesn't do Color Temperature (I don't think the bulb itself does), selecting a temperature will move it over into 'white' mode.

It's very early, very nasty, and might do almost anything up to and including eat your hub alive. It's also based off some of @ericm's code, and I've set about destroying all his good work in the name of prototyping getting this to work. Sorry, Eric!

Anyway... have a play... let me know if it works for you. I'll tidy it up in the coming days, I'm sure.

-- Jules

1 Like

@cwwilson08 What were you doing when it bricked?

following the walkthrough for the ota.

Got near the end - seems the device should have reset then setup an access point for the final steps - after reset though nothing.

here is the console output

Starting Access Point with SSID ZAGDU-789
Giving Access Point IP address 10.44.57.2, pid is 1147
Redirecting device 192.168.1.75 to use Access Point ZAGDU-789
**** New device detected. ID: 12000222c3ae817a6f0 IP:192.168.1.75
Asking device to move networks and upgrade...
Redirecting device 192.168.1.75 to use Access Point ZAGDU-789
**** Redirect appears successful
DHCP Discover 2c:3a:e8:17:a6:f0 10.44.57.203
DHCP Request 2c:3a:e8:17:a6:f0 10.44.57.203
**** Device 12000222c3ae817a6f0 has changed IP from 192.168.1.75 to 10.44.57.203
Received DNS query for mq.gw.tuyaus.com.
Sending 10.44.57.2 as response
Accepting MQTT connection, forwarding to mq.gw.tuyaus.com.
Received DNS query for a.gw.tuyaus.com.
Sending 10.44.57.2 as response
Receiving www request
Fetching Request Content
URL: /gw.json?a=s.gw.update
Response: HTTP/1.1 200 OK
{"t":1548178042,"e":false,"success":true}
Receiving www request
Fetching Request Content
URL: /gw.json?a=s.gw.dev.update
Response: HTTP/1.1 200 OK
{"t":1548178043,"e":false,"success":true}
Receiving www request
Fetching Request Content
URL: /gw.json?a=atop.online.debug.log
Response: HTTP/1.1 200 OK
{"result":true,"t":1548178045,"e":false,"success":true}
Receiving www request
Fetching Request Content
URL: /gw.json?a=tuya.device.upgrade.silent.get
Sent upgrade response
Receiving www request
Fetching Request Content
URL: /gw.json?a=s.gw.upgrade.updatestatus
Response: HTTP/1.1 200 OK
{"t":1548178045,"e":false,"success":true}
Received DNS query for fakewebsite.
Sending 10.44.57.2 as response
Receiving www request
Sending firmware image_user2-0x81000.bin
Receiving www request
Sending firmware image_user2-0x81000.bin
Sending bytes 51-239270 from offset 0
Shutting down...
Setting up IP Address 192.168.4.2 for Final Stages
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Setting up wifi scan
Setting up listener for FinalStage
Shutting down...
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Finished
Exiting....
Shutting down...
1 Like

@cwwilson08 Ok your not bricked. It is the same issue I am having right now. The device is not asking for an update so it just sits there on a different wifi network in limbo.

The Fix is turn it off and on by button 3 times with 1 sec in between each push of the button. Then it should start to flash. After that add back to the tuya or smartlife app and your back to square one.

@JulesT Unfortunately it doesn't work for my bulbs. But once the new tasmota update is rolled out it should then have support and work with your DH. So I'm stuck waiting. Great work though and I'm glad your making headway!

I get no response from pushing the button on the device. When plugged in it powers up. Button presses do no do anything.

@cwwilson08 Ok I just saw that yours actually did take a firmware update. If you look on your phone for wifi networks im guessing you dont see a finalstage SSID?

indeed not - which is why i was thinking bricked. Even if the pi for some reason couldnt see it. i would think one of my other devices would.

Like a fool just ran the script on my power strip - it is now dead as well. Seems to be in same state.

@cwwilson08 Yes definitely should see it from a different device. That sucks.

Oh No!! They can still be flashed but need the device to do so

No biggie. The devices are cheap - I knew I was rolling the dice. You live and you learn.

And it looks like amazon will be sending a new small socket anyways. Gotta love em...

I was ready for brickage too.
Luckily after power cycling my light bulb 3 times the stock firmware kicked in and let me re-join my SSID.

@keithcroshaw Good to hear. There are several people working on this issue and hopefully, there is a resolution to this soon. I have a handful of devices that need to be moved over still.

1 Like

I'll try what you recommended tonight.
I don't have any other Tuya devices, otherwise I'd gladly help out some more.

If you have anything else you want me to try let me know.
Same goes to @JulesT .

Hi Keith.

From the '3 power cycles' back to stock firmware thing, I'm guessing that you've got it flashed tasmota - if that's the case, then you're more than welcome to try my 'orrible driver.

Basically... you first need to configure the bulb to work properly if it's not a type that tasmota already understands. My bulb, which is an RGBW type, needs settings like this:

Once you've configured the module, you can use the console (in the bulb web interface) to know if it works - obvious commands are:

power on
power off
color with RR GG and BB in hex - 00 to ff.
(alternatively - hsbcolor h,s,v - h looks to be between 0 and 360, I think)
white - where brightness is between 0 (off) and 100 (pretty damned bright in my case)

If all that's working, then I've reasonable confidence that the driver that I posted higher up will work, at least in part.

Give it a go, and let me know how you get on.

-- Jules

Unfortunately not.
It doesn't seem to be accepting the new IP Address or something.
I get the following response:

Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Using WiFi device wlan0 for Access Point
Starting Access Point with SSID ZAGDU-789
Giving Access Point IP address 10.44.57.1, pid is 2209
Redirecting device 192.168.1.177 to use Access Point ZAGDU-789
Shutting down...
Setting up IP Address 192.168.4.2 for Final Stages
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Setting up wifi scan
Setting up listener for FinalStage
Shutting down...
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Finished
Exiting....
Shutting down...

I'm able to re-join it to my SSID via the Smart Life app after the failure.

@cwwilson08 Great news. I bricked my power strip and Touch Light switch last night.

So I opened them up and soldered wires to the correct leads and was able to flash tasmota onto both of them. So both are working and I have a device to get functioning now. Ready to help when you have all the parts together.

2 Likes

Hmmm. OK. That's a shame.

I wish I could help more - mine didn't really fight me that hard, once I worked out that I needed to have my Pi visible on the wired network,and to have it's wireless network worked on as well.

-- Jules

2 Likes