KraigM / homebridge-wink

Wink hub plugin for HomeBridge
54 stars 37 forks source link

Quirky Powerstrip Not Working #32

Open nicknewlin14 opened 8 years ago

nicknewlin14 commented 8 years ago

It is listed as supported, but I can't seem to get the Quirky Powerstrip to work with HomeKit apps.

Eve gives the most information and it says "HomeKit reported a communication failure."

Homebridge outputs "[Wink] Changing target property 'powered' of the undefined called OutletB to 0", and when loading it says "[Wink] Initializing platform accessory 'OutletB'...".

Homebridge has also output this at one point while loading: ,"desired_state":{"powered":false},"last_reading":{"powered":false,"powered_updated_at":1453737818.2041435,"desired_powered_updated_at":1453737818.7502193}},{"powered":false,"scheduled_outlet_states":[],"name":"Outlet #2","outlet_index":1,"outlet_id":"50049","icon_id":"4","parent_object_type":"powerstrip","parent_object_id":"25024","desired_state":{"powered":false}

Which leads me to believe it may be looking for a true/false string input as opposed to 1/0?

corymccarty commented 7 years ago

I am currently having this problem too. If I'm reading the debug output correctly, it doesn't look like it's even trying to send the request to wink. I wonder whether the fact that it's calling it "the undefined" rather than "the outlet" or something along those lines indicates that it's not properly categorizing it as an outlet. In any case, I'd love a solution!

flochtililoch commented 7 years ago

Wink API states that the Quirky Powerstrip is a legacy device that requires special handling:

As a legacy device, the power strip is a bit unique. The device itself has no desired state or last reading, instead, it has an array of two outlet objects that have individual states.

This plugin assumes that the desired state should be set.

Since I also experienced this issue and only own a Power strip from wink, I wrote a striped down homebridge plugin (homebridge-pivot-power-genius) that takes care of these power strips only - feel free to give it a shot and report any issues you may have with it.

reddlew commented 7 years ago

The issue here is not that the Wink API doesn't provide a last_reading.connection state (it does for the quirky powerstrip), but more that the code is assuming a "device" is each individual outlet of the strip which does not have a connection state and thus the error "unconnected" it seems many of us are getting.

I couldn't think of an elegant solution so I just commented out that check since it seems a bit on the cautious side there are already handlers for no response or no feedback. Maybe the original author can find a better way to fix it. If not and are impatient for a workaround I went ahead an forked it over here you can install git and do a git npm install if you are impatient and want to use this package.

corymccarty commented 7 years ago

I went ahead and commented out the lines in my local copy of homebridge-wink. That solved the problem.

Would it be possible to query the device to see if it's an outlet and the parent device (if there is one) is the Quirky powerstrip, and then check the connected property for that? I agree that the check is cautious, but it seems like it's still not a bad check to make, and this would be the correct way.

I'm not good enough with JavaScript/Node yet to go digging to see if the right properties exist.

reddlew commented 7 years ago

Yes the data is in the refresh request (but on the device not the outlet) so you could do something like this to fix it.