drumfreak / homebridge-tuyapi-extended

Extended version of the tuyapi for homebridge
MIT License
0 stars 3 forks source link

Oittm-Humidifier #2

Closed avenger11 closed 6 years ago

avenger11 commented 6 years ago

Hi drumfreak,

I adapted your code (tuyapi extended and color light) to control an Oittm smart diffuser. Homebridge can perfectly read the status of the device but impossible to send a command. I receive the error "communicating with the device. make sure nothing else is trying to control.."

if i'm able to read I should be able to send a command, right ?

Thanks,

drumfreak commented 6 years ago

Hi! That's really cool. I have a diffuser and was about to do this myself, it's one from Amazon using that same Tuya type of setup.

In regards to not being able to communicate, this happens anytime something else is communicating with it. So close out your Tuya app, make sure nothing is controlling the diffuser and give it a shot.

Also, the timeout settings in the config, increase those and you'll prevent the api from skipping over the connection if it's taking too long.

Let me know how the diffuser goes!!

avenger11 commented 6 years ago

The humidifier is really cool. I don't think it's the best one but it's smart :) Yes, I close the tuya apps. I change the timeout. Still the same error...

Do you know a way to detect if something else is connected ?

drumfreak commented 6 years ago

Were you able to get the details from Charles app such as localKey and do you have the IP of the device? Did you clear out the .homebridge/accessories/cachedAccessories ?

avenger11 commented 6 years ago

Yes and yes, and with the debug function I see that my homebridge have a nice conversation with the humidifier :)

drumfreak commented 6 years ago

the tuyadebug... haha that was a lot of fun, and takes up most of the code. I had to figure out what the hell the two HEX values + 2 extra chars were in the tuya color light dps[4] setting... Im sure you saw that in there. It's a long explanation, but basically it was:

dps[4]: FF0000FFFFFF00

RGB HEX1: FF0000 (RED)

RGB HEX2: FFFFFF (Full bright white) Saturation layer... or color brightness, or color lightness. I figured out that it was from white to black on a scale of 255.

Then there was 2 extra chars like FF or 00. I still can't quite figure them out, but I believe it's a scale of 255 in alpha settings.

That was a party and all the Tuya docs are in chinese...

Somehow... the f'n light works beautifully on all colors, in fact, sitting next to a philips hue color light, the Tuya lights with this plugin blow them away in color!

avenger11 commented 6 years ago

Not an easy one ! Sorry for the misunderstand. They have a conversation but I still have error sending command to the humidifier. I open a thread : https://github.com/avenger11/Homebridge-Oittm-Humidifier/issues/2