devbobo / homebridge-lifx-lan

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

Plugin crashing Homebridge randomly #6

Closed greenywd closed 8 years ago

greenywd commented 8 years ago

Hey there!

I have two LIFx Color 1000 bulbs (one in my bedroom and other in the living room) and a Raspberry Pi with which I am running homebridge on. I haven't been able to reproduce consistently (hence randomly :p) but every now and again homebridge-lifx-lan crashes homebridge. I have a feeling however, that the issue is with the two bulbs - the power to the living room light was turned off all day and homebridge hadn't crashed at all until that light came back on. This is the error that is thrown when the crash occurs:

buffer.js:830
    throw new RangeError('Index out of range');
    ^

RangeError: Index out of range
    at checkOffset (buffer.js:830:11)
    at Buffer.readUInt16LE (buffer.js:876:5)
    at Object.Packet.headerToObject (/usr/lib/node_modules/homebridge-lifx-lan/node_modules/node-lifx/lib/lifx/packet.js:124:18)
    at Object.Packet.toObject (/usr/lib/node_modules/homebridge-lifx-lan/node_modules/node-lifx/lib/lifx/packet.js:141:14)
    at Client.<anonymous> (/usr/lib/node_modules/homebridge-lifx-lan/node_modules/node-lifx/lib/lifx/client.js:161:18)
    at emitTwo (events.js:106:13)
    at Socket.emit (events.js:191:7)
    at UDP.onMessage (dgram.js:540:8)

If you need anything else from me, I'll gladly help!

Edit: Figured I should attach my config for LIFx - the one platform picks up both lights, not sure if it's a bug or feature ¯_(ツ)_/¯ :

"platforms": [
    {
       "platform": "LifxLan",
       "name": "Bedroom Light"
    }
  ],
devbobo commented 8 years ago

@GreenyDev this looks like node-lifx is crashing, are you able to file a bug against that project ?

MariusRumpf commented 8 years ago

@devbobo Just released v0.6.0, which logs invalid package headers error instead of throwing an error. Should fix it.

devbobo commented 8 years ago

@MariusRumpf thanks mate 👍

devbobo commented 8 years ago

I just released version 0.1.2 which includes the new version of node-lifx