philips-hue

Philips Hue API: Turn on lights at fix time


I'm programming on HUE API.I want to schedule for a light turn on at one time and automatically turn off at another time. As this link is for reference (you must login before see this page). HUE API Schedules API

As I research, maybe noway for me to do that except I must separate to two schedule commands: schedule to turn on at one time and schedule to turn off at another time.

Is this true way to done this work ? Because I see that is too handy. Is there another way for HUE API does automatically ? Thanks :)


Solution

  • I think that the best way would be to create two schedules. I also think it might be the only way.

    Here is a command to turn on all your lights at 09:00

    {
        "command": {
            "address": "/api/<username>/groups/0/action",
            "body": {
                "on": true
            },
            "method": "PUT"
        },
        "time": "W127/T09:00:00"
    }
    

    Remember to replace <username>. The time I specified here means "every day of the week at 09:00 UTC". Note that the time is UTC, not your local time.

    The link that explains time patterns is currently broken in the Schedules API page. Here is a fixed link for you: Datatypes and Time Patterns

    You might also want to read this for more explanation on time patterns: Recurring schedules