peter-murray / node-hue-api

Node.js Library for interacting with the Philips Hue Bridge and Lights
Apache License 2.0
1.19k stars 145 forks source link

Realtime event on lights ? #98

Closed jaumard closed 7 years ago

jaumard commented 7 years ago

Thanks for this useful module :) Is there a way to have realtime event on lights state ? For example if we open switch lights with HUE switch/tap it can be nice to have real time event to update the status of the light.

peter-murray commented 7 years ago

Hi,

The API provided by Philips does not have any subscription options, so to achieve what you are looking for you would need to be constantly polling the bridge, which would have quite an impact on how responsive it would be to other requests from other apps.

If you don't need the state of all lights and we're only interested in the status of a couple, and realtime was something like the last 2 seconds, then the bridge may be able to support that...

You cannot bind to events either for a tap, as these function over zigbee, not via the hue bridge API.

A lot of the applications that appear to show realtime status are polling periodically or are the applications actually making the change, so it knows what state the devices are in.

Does that answer your question?