devbobo / homebridge-lifx-lan

LiFx LAN platform plugin for Homebridge
MIT License
84 stars 27 forks source link

stuck at updating.. if a light is offline #21

Open jaghond777 opened 7 years ago

jaghond777 commented 7 years ago

I have 3 Lifx 2nd lights, 0.1.8 works extremely well when all are online. But if one of the bulbs is switched off, then the homekit controls get stuck at updating.. both in home app and control center. i can trigger the lights but it takes longer to respond even though all the buttons buttons continue showing updating.. . This is consistently reproduced. Currently running on Raspberry Pi first gen

devbobo commented 7 years ago

Try version 0.1.9, hopefully it works better

jaghond777 commented 7 years ago

Thanks, tried that. Doesn't help. Have to hunt down any bulb which is off to get everything working again.

ryanmaxwell commented 7 years ago

+1 I had to stop using this plugin due to a off bulb breaking the entire homekit stack. I'd like to know when this is improved.

fiddypal commented 7 years ago

Damn maybe this explains why all my Accessories started not responding and acting strange. I recently shut the light off before we left for holidays.

Sent via mobile device

On Jan 3, 2017, at 3:18 PM, Ryan Maxwell notifications@github.com wrote:

+1 I had to stop using this plugin due to a off bulb breaking the entire homekit stack. I'd like to know when this is improved.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

jaghond777 commented 7 years ago

This may be a problem with how Homebridge is implemented. I recently added Tado smart AC control to Homebridge and the plugin speaks to the Tado cloud account to control the accessory. Now whenever I access Control center or Home app, all of the controls take a second to "Update". This I believe is because the entire Homebridge stack is waiting on the Tado plugin. If the internet is down, everything gets stuck at updating. Eventually the Home app shows "Apple TV not responding" and X number of accessories not responding.
To remove dependency on internet connectivity, my only option at the moment would be remove the Tado plug in.

ridn commented 7 years ago

i can't imagine that there wouldn't be a way to fix this, through the plug in itself. Is there no way to just tell homebridge that the device is offline, hence don't wait for a response from the device?

my experience with node is non-existent so, it'd be great to get some input. @devbobo


edit:

based on the optional parameters provided from he config file, it does look like that these should be sufficient to solve the issue, but if im not mistaken, they do have default values, (very close to the ones provided as an example). Which would mean that it should already be working after a slightly longer wait. However, that does not seem to be the case :(


edit 2:

after tinkering with the optional package parameters i seem to have found a solution that works, but likely isnt the best. Using the following parameter, home kit should give up on trying to get an update on the device, and homebridge should provide an error (as the description states)

"messageHandlerTimeout": 45000,   // optional: in ms, if not answer in time an error is provided to get methods

setting this to a shorter time (i have it set to 10000ms or 10s) will cause the updating message to be stuck of only 10 seconds before you have control of devices again. Obviously the shorter the time the faster the response, but i imagine thats not the best idea to make the response time so low (since lifx bulbs have been known to drop connections, you have less of a chance of getting the connection back in time). The default value appears to be 45000 ms or 45s. That being said, looks like the bridge will wait the full handler timeout time you set for as long as there are devices that are offline/unreachable. (So you'll be wait ex. 10s every time you want to flip a switch if there is an offline bulb)

To use this "fix" just add the parameter above to your config.json as noted in homebridge-lifx-lan/index.js and lower the value appropriately. Then restart homebridge

#### **[homebridge-lifx-lan/index.js](https://github.com/devbobo/homebridge-lifx-lan/blob/master/index.js#L5-L22)** ```js "platforms": [ { "platform": "LifxLan", // required "name": "LiFx LAN", // required "duration": 1000, // optional, the time to fade on/off in milliseconds ** optional node-lifx parameters ** "broadcast": '255.255.255.255', // optional: Broadcast address for bulb discovery "lightOfflineTolerance": 3, // optional: A light is offline if not seen for the given amount of discoveries "messageHandlerTimeout": 45000, // optional: in ms, if not answer in time an error is provided to get methods "resendPacketDelay": 150, // optional: delay between packages if light did not receive a packet (for setting methods with callback) "resendMaxTimes": 3, // optional: resend packages x times if light did not receive a packet (for setting methods with callback) "debug": false, // optional: logs all messages in console if turned on "address": '0.0.0.0' // optional: specify which ipv4 address to bind to } ], ```
beatmag commented 7 years ago

I have the same problem. I've made the timeouts super short but still it has problems. Are there any fixes for this? I've noticed the lifx bulbs going offline and instantly going online.

ridn commented 7 years ago

if you happen to be using control center to control devices, removing the devices which get powered off from your favorites should stop them from attempting to load each time. Obviously not a "solution", but helpful.

devbobo commented 7 years ago

Please try version 0.2.1 and let me know if it resolves this issue.