Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: communicating with device. Make sure nothing else is trying ... #2

Open
avenger11 opened this issue Apr 1, 2018 · 9 comments
Labels
help wanted Extra attention is needed

Comments

@avenger11
Copy link
Owner

I'm able to get the status of the device and discuss with it.

But I receive this error when I try to set a value.
NB: apps closed, try timeout, removed persist and accessories folder

I see two options:

  • the command to set a value is not right
  • something else is connected but I don't know how to detect it.
@drumfreak
Copy link

Is it connected to an Alexa Skill by chance?

Also, try to increase your timeout levels in the config.json

@avenger11
Copy link
Owner Author

No alexa.
what your suggestion for api min and api max ?

@drumfreak
Copy link

drumfreak commented Apr 1, 2018

I use on my network:

{
               "accessory": "TuyaColorLight",
                "name": "Fountain Light",
                "ip": "192.168.104.30",
                "productId":"IcS079IpUJb333whW",
                "devId": "xxxxxxx",
                "localKey": "xxx",
                "apiMinTimeout" : 100,
                "apiMaxTimeout" : 3000,
                "apiRetries": 2,
                "apiDebug" : true,
                "refreshInterval" : 360,
                "debugPrefix" : "~~ ColorLight ",
                "debug" : true,
                "deviceEnabled" : true
            }

You can tweak those values out but the big one is the apiDebug so you can see what's going on. Show me some logs, comment out your localKey when you share.

Thanks!

@avenger11
Copy link
Owner Author

here are a log file.

homebridge.log

@drumfreak
Copy link

Ahhh!!!

Humidifier] ˜---Humidifier { '[object Object]': undefined }
[4/1/2018, 12:42:42 PM] [Oittm Humidifier - Humidifier] ˜---Humidifier DPS Values: {}
[4/1/2018, 12:42:42 PM] [Oittm Humidifier - Humidifier] ˜---Humidifier

Look at the dps values you’re sending. It’s really silly but....

dps[“1”] is how it’s required, not dps[1] like we would assume...

I had hell with this, and that’s why I forked the tuyapi in the first place.

Next, if you send a bad value to the device function points (dps) it will cause the light to not respond. Open up the original app, change the values then completely exit the Tuya app and try to change the settings again. Repeat until you figure it out... this was a blast to “hack” into the Tuya color lights.

I hope you get it working!

@drumfreak
Copy link

also look in my homebridge-tuya-colorlight code, I believe I switched the dps to an object..

So it constructs like this:

var dps = {};

dps[‘“1”’] = false;
dps[‘“2”’] = something

I’m on mobile at the moment but if you can’t figure it out I’ll look when I get back...

@drumfreak
Copy link

colorlight code:

var dpsTmp = {
'1' : true,
'2' : this.colorMode,
'3' : apiBrightness,
'4' : temperature,
'5' : lightColor
// '6' : hexColor + hexColor + 'ff'
};

this.tuyaColorLight.set(this, {'id': this.devId, 'dps' : dpsTmp}).then(result => {
// foo
})....

@avenger11
Copy link
Owner Author

avenger11 commented Apr 2, 2018

I updated index.js with the latest change I made and your suggestion.
I think i'm closer but still doesn't work

here the latest log
homebridge.log

@drumfreak
Copy link

drumfreak commented Apr 3, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants