homebridge-ikea
homebridge-ikea copied to clipboard
Adding a more fail safe handling of coap-client lookups.
- utils.js -- Added timeout to execsync. Sometimes the call to coap-client just hangs indefinitely. Can be to a bulb gone missing or some other issues in the ikea gateway.
- index.js -- Try catch wrappers on lots of calls. When an error is trapped, just do a callback("no_response") instead of failing (and breaking the entire homebridge). This way it recovers in subsequent updates from Homekit.
TODO: Sometimes the bulbs start att 100% when turned on (even if that wasn't the setting). This can be on these checks
if(typeof device.light[0]["5706"] === 'undefined' ||
device.light[0]["5706"] && device.light[0]["5706"].length < 6){
I change from !== 'undefined' to === that seemed more as the intention. Logging says return value in this cases is always 0, maybe that is a correct value?
Looks like so really nice cleanups! Nice job. I'll look it over more carefully as soon as I can and merge.