Supplement Natural Light as the sun goes down each day with Philips HUE Motion Sensor (and integrated light sensor) Without Motion

后端 未结 2 1797
梦如初夏
梦如初夏 2021-02-10 15:42

I recently fitted out my home office with Philips HUE bulbs and a Philips HUE motion sensor that has a builtin light sensor. I was hoping that I could get up the Philips HUE Mot

2条回答
  •  误落风尘
    2021-02-10 16:22

    There are a couple of ways you can achieve this if you are willing to tinker around with the Hue API. It's really well documented at their website. You can connect to your bridge using a web browser on your local network and you create rules by sending JSON formatted lists of conditions to be met and actions to be taken

    Then it's just a case of creating some rules. You can use the values from the light sensor or alternatively once you set the location of your hue then it has a built in timer for sunset/sunrise times which might be easier than working out what light levels you want to trigger on.

    You can set transition times within your rules, so here's an example how you could create a pair of rules to switch on the lights at minimum brightness an hour before sunset and then increase to maximum brightness with a transition time of 1 hour

    {"conditions": [
            {
                "address": "/sensors/1/state/daylight",
                "operator": "eq",
                "value": "false"
            },
            {
                "address": "/sensors/1/state/daylight",
                "operator": "dx"
            }
        ],
        "actions": [
            {
                "address": "/groups/0/action",
                "method": "PUT",
                "body": {
        "on": true,
        "bri": 0,
                }
            }
        ]
    }
    

    The first condition specifies that the daylight sensor must be set to false (you can adjust the offset before sunset you want this to change within the hue app), the second condition uses the operator "dx" which means the value must just have changed. Then the action for the rule turns on all lights at minimum brightness.

    The second rule would look like this

    {"conditions": [
            {
                "address": "/sensors/1/state/daylight",
                "operator": "eq",
                "value": "false"
            },
            {
                "address": "/sensors/1/state/daylight",
                "operator": "ddx"
                "value": "PT00:01:00"
            }
        ],
        "actions": [
            {
                "address": "/groups/0/action",
                "method": "PUT",
                "body": {
        "bri": 254,
        "transitiontime":36000
                }
            }
        ]
    }
    

    The first condition is the same as before, the second condition uses "ddx" as an operator. ddx means the rule will trigger a certain amount of time after the sensor value changes, specified in the value parameter which in this case is PT00:01:00, so 1 minute after the first rule fired. The actions of this rule set all the lights to max brightness with a transition time of 1 hour (transitiontime parameters 1 = 0.1 seconds). So they will take 1 hour to reach max brightness.

    Once you get into the API then Hue is really quite a powerful system that you can integrate with all sorts of other kit. There are commands to increase brightness in stages which you could couple with readings from the light sensor if you preferred to do it that way, or modify the rules above to use your light sensor as the trigger instead of the built in sunset timer.

提交回复
热议问题