Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get data from Hue in realtime

Tags:

I'm checking the hue API and I'm wondering if I understand it correctly that the motion sensor is able to switch lights on directly via the "rules", but it is impossible to get notified via the bridge about changes?

My scenario is that I would like to detect, if there is any motion and if not to turn my TV via its rest API off.

I also read that the sensor data are just updates every 5 minutes, how can I decrease the scan interval?

like image 920
rekire Avatar asked May 20 '18 21:05

rekire


1 Answers

If you poll the Hue bridge via API, you instantly get the motion result.

It is as simple as that:

GET http://<bridgeip>/api/<userid>/sensors/<sensor-id>

{
    "state": {
        "presence": true,
        "lastupdated": "2018-11-01T13:43:00"
    },
    ...
}

For checking all 1 or 2 minutes, this will work fine (while my personal way of watching TV would not assure that the motion sensor detects my presence, as the chips are too fast gone).

However, this polling is the only way to retrieve events from Hue. If there is any need to use events instantly like e.g. the Hue dimmer switches etc. for external sources: Forget it. There is no syslog, no IFITT to the outside, no HTTP triggers, or anything you could use apart from polling. Philips answers these questions in the forum in a way:

We know the demand, it is on our roadmap, we do not commit to a date

Therefore: Buying Philips Hue sensors and switches is something which binds you to the ecosystem of the Hue Bridge.

like image 161
Georg Zzz Avatar answered Sep 28 '22 18:09

Georg Zzz