KraigM / homebridge-wink

Wink hub plugin for HomeBridge
54 stars 37 forks source link

Installed and recognized all devices, can't actually control them #71

Open charlesthomas opened 7 years ago

charlesthomas commented 7 years ago

I got homebridge and the plugin working, and I see all of my Wink devices in homekit, and they're even reading the correct statuses (on vs off at the time of config) but I can't actually control any of them in the iOS Home app.

charlesthomas commented 7 years ago

This is all I'm getting in the console:

[12/6/2016, 2:07:22 PM] [Wink] Changing target property 'powered' of the light_bulbs called Office Overhead to 1 [12/6/2016, 2:07:54 PM] [Wink] Changing target property 'powered' of the light_bulbs called Office Overhead to 1 [12/6/2016, 2:07:55 PM] [Wink] Changing target property 'powered' of the light_bulbs called Office Overhead to 0 [12/6/2016, 2:07:56 PM] [Wink] Changing target property 'powered' of the light_bulbs called Office Overhead to 1 [12/6/2016, 2:07:56 PM] [Wink] Changing target property 'powered' of the light_bulbs called Office Overhead to 0 [12/6/2016, 2:07:57 PM] [Wink] Changing target property 'powered' of the light_bulbs called Office Overhead to 1 [12/6/2016, 2:07:57 PM] [Wink] Changing target property 'powered' of the light_bulbs called Office Overhead to 0 [12/6/2016, 2:08:01 PM] [Wink] Changing target property 'powered' of the light_bulbs called Office Overhead to 1 [12/6/2016, 2:08:10 PM] [Wink] Changing target property 'powered' of the undefined called Coffee Pot to 1 [12/6/2016, 2:08:12 PM] [Wink] Changing target property 'powered' of the undefined called Coffee Pot to 1

dakkathx commented 7 years ago

Exactly the same issue here

microb0x commented 7 years ago

Also having this same issue

scoobyshi commented 7 years ago

I'm having the same issue as well. The plug-in worked for me probably about 6+ months ago, but I haven't really tried using it again until recently, which is when I've observed this problem. Has anyone had any luck, or tried forking this and adding some additional debugging?

scoobyshi commented 7 years ago

So, with a few additional debug statements, I found that the device "desired_state" on the initial request was empty:

{"object_type":"light_bulb","object_id":"1338xxx","uuid":"cdb488fc-7d56-4c61-b7fe-xxxx","icon_id":"71","icon_code":"light_bulb-light_bulb","desired_state":{}" . .

and this line in lib/wink-accessory.js was then causing the app to error out and never actually submit the requested desired_state (on/off):

else if (this.device.desired_state[sProperty] == undefined)

I commented this section out and while I can now successfully control my devices there are few inconsistencies I'd like to understand. I'm not sure why the desired_state payload is empty first of all, given that when I call the API directly (for example through Postman) it returns data there.

charlesthomas commented 7 years ago

I tried this too, and it worked as expected. After that, I was getting a lot of messages about retries, though. Lights were turning on or off as appropriate, but then would change back and I'd see retry messages in the console output. I commented out the retry line in the block where I found the logs. Not an ideal solution, but it's working now.

ckdake commented 7 years ago

Same issue here, commenting out the undefined detection worked for me as well. Same as Charles, lots of retries.

scoobyshi commented 7 years ago

So, I have a fork and pull request that resolves the ability to control, the retries, and the dimness controls: https://github.com/KraigM/homebridge-wink/pull/75, just waiting on either some feedback or an accept. I've been using it for a few weeks and it's behaving quite well.

ckdake commented 7 years ago

@scoobyshi nice! This works perfectly for me.

microb0x commented 7 years ago

@scoobyshi Your changes seem to be working for me. I'm still having some retries but they are very infrequent.