szokeptr / homebridge-tradfri-plugin

Ikea Tradfri plugin for Homebridge
59 stars 6 forks source link

Intermittent issue with Groups in Home App #10

Closed rcarlsen closed 7 years ago

rcarlsen commented 7 years ago

I have grouped a couple bulbs via the Apple Home app (eg. multiple bulbs in one ceiling fixture). Often, when attempting to adjust this group only one of the bulbs will change and the log reports the following.

{ Error: Command failed: coap-client -u 'Client_identity' -k 'xxx' -B 5 -m PUT -e '{"3311":[{"5850":1}]}' coaps://192.168.1.132:5684/15001/65538

    at ChildProcess.exithandler (child_process.js:205:12)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:194:7)
    at maybeClose (internal/child_process.js:899:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
  killed: true,
  code: null,
  signal: 'SIGTERM',
  cmd: 'coap-client -u \'Client_identity\' -k \'xxx\' -B 5 -m PUT -e \'{"3311":[{"5850":1}]}\' coaps://192.168.1.132:5684/15001/65538' }
[5/27/2017, 1:22:22 PM] [Tradfri] Error setting state

Directly manipulating the bulb accessories succeeds. Sometimes manipulating the group succeeds (i.e. both bulbs turn on/off at the same time).

Any help?

szokeptr commented 7 years ago

The gateway is dropping requests when you are issuing them fast one after the other (that happens when you are setting the brightness). One solution would be only setting the brightness when the user releases the slider, but then you lose the realtime feedback. I am looking into other ways to solve this, any idea/help is appreciated!

rcarlsen commented 7 years ago

Do you have a sense of what the maximum request rate is on the gateway? If so, could the plugin throttle the request(s) to remain under this rate?

Hestmeat commented 7 years ago

I used to have the same issues. I now run with home assistant as bottom with homebridge plugin. Works like a charm.

jdamner commented 7 years ago

I have the same issue - looking at the lights on the hub, the tradfri hub appears to be restarting which is causing the dropped connection - it might not be maximum request rate, but instead a malformed request causing the hub to restart - probably poor error handling by the hub's firmware.

szokeptr commented 7 years ago

I improved stability with a command queue and merging subsequent PUT requests (those that are in 50ms interval - usually when setting a scene, or toggling grouped bulbs). Please update the plugin to the latest version.