studioimaginaire / phue

A Python library for the Philips Hue system
Other
1.52k stars 267 forks source link

Observe light bulb changes #88

Closed vanniktech closed 6 years ago

vanniktech commented 7 years ago

I'd like to observe light bulb changes.

Instead of querying every X seconds and asking for the state of the light bulbs it would be cool if I could somehow register myself to light changes and observe changes.

So far I haven't found this in the README nor do I know whether the bridge itself supports something like this.

demosdemon commented 7 years ago

The bridge provides no api to long poll or subscribe to events. So, there's no way to detect when a light has changed values without continuously polling for its values.

vanniktech commented 7 years ago

Alright that's what I thought. However the hue android app is capable of that so maybe all they're doing internally is also just a simple poll.

demosdemon commented 7 years ago

The bridge can handle the polling. I can't find it anymore, but the official docs said the bridge can handle something like 5ops/s.

vanniktech commented 7 years ago

How are the Android Apps doing it though? When I turn off the light the app immediately notices the light change. I can't imagine that the Android App is pulling every second for each lamp the state.

caedn commented 7 years ago

Maybe they are polling group 0, which gets you the state for all lights. That can be feasibly done once per second.

vanniktech commented 6 years ago

Got the change to talk to one of the engineers. They do just poll it every second. Hence I'll close this issue.