Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Responding to Hue events?

Tags:

philips-hue

I'd like to respond to events from a ZGP (Tap) switch. From what I read in the API documentation, I'll have to poll by routinely GETing the sensor and looking for a buttonevent in the state description.

Certainly there's a better way. Has anyone found a way to add callbacks to a Hue bridge or any other technique to avoid constant polling?

like image 298
gerwitz Avatar asked Oct 16 '14 12:10

gerwitz


People also ask

Why are my Hue lights not responding?

Fixing Unresponsive Hue Light Bulb The bulb might be unresponsive due to a few reasons which could be: The bulb switched off at the mains. The bulb is too far from your bridge. The bulb is too far from other Hue bulbs.

Is Philips Hue ending?

As of April 30th, 2020, Philips Hue announced that there will no longer be any updates for the Hue Bridge v. 1. In addition, any online support would also be terminated at that time. As of April 30th, 2022, support for the Hue Bridge v.

How does Hue communicate?

All of Hue's bulbs and fixtures have their own built-in Zigbee radios, as does the Hue Bridge, which you keep plugged into your router. Its job is to act like a Zigbee-to-Wi-Fi translator for your home network and your lights. For instance, you send a signal to your router whenever you turn a Hue bulb on using the app.


1 Answers

As i'm checking the JSON. You first have the scene's (4, one for each button on the TAP) like:

    "OFF-TAP-1": {
        "name": "Tap scene 1",
        "lights": [
            "1",
            "2",
            "3"
        ],
        "active": true
    },

Then you have the rules that states what happens when an event (TAP button presssed) occurs

 "1": {
        "name": "Tap 2.1 Default",
        "owner": "abdbsbdbfh123",
        "created": "2014-09-14T18:29:28",
        "lasttriggered": "2014-10-17T06:03:09",
        "timestriggered": 3,
        "status": "enabled",
        "conditions": [
            {
                "address": "/sensors/2/state/buttonevent",
                "operator": "eq",
                "value": "34"
            },
            {
                "address": "/sensors/2/state/lastupdated",
                "operator": "dx"
            }
        ],
        "actions": [
            {
                "address": "/groups/0/action",
                "method": "PUT",
                "body": {
                    "scene": "OFF-TAP-1"
                }
            }
        ]
    },

So there is no need to poll the status of the TAP. If a button is pressed. The corresponding rule will fire which in turn will start the defined action. In this case it will start scene "OFF-TAP-1".

More documentation: http://www.developers.meethue.com/hue-tap-scene-programming

like image 89
Koen van der Linden Avatar answered Dec 12 '22 10:12

Koen van der Linden