command: /api/<user name>/lights/<id>/state
method: PUT
body:
{
"on": true,
"alert": "lselect"
}
But it only persists for 15 seconds. (according to development guide)
alert | string | The alert effect, which is a temporary change to the bulb’s state. This can take one of the following values: “none” – The light is not performing an alert effect. “select” – The light is performing one breathe cycle. “lselect” – The light is performing breathe cycles for 15 seconds or until an "alert": "none" command is received.
Note that this contains the last alert sent to the light and not its current state. i.e. After the breathe cycle has finished the bridge does not reset the alert to "none".
|
so we could leverage the scheduling function to make it infinite.
command: /api/<user name>/schedules
method: POST
body:
{
"name": "Blink",
"description": "My Blink",
"command": {
"address": "/api/<user name>/lights/<id>/state",
"method": "PUT",
"body": {"alert": "lselect"}
},
"time": "R/PT00:00:15"
}
To stop blinking just delete the schedule.
command: /api/<user name>/schedules/<id>
method: DELETE
After deleting the schedule, the bulb may keep blinking a little while.
If you want to stop blinking immediately you have to add one more command to set the alert to none.
command: /api/<user name>/lights/<id>/state
method: PUT
body:
{
"alert": "none"
}
Reference:
Lights: http://www.developers.meethue.com/documentation/lights-api
Schedule: http://www.developers.meethue.com/documentation/schedules-api-0
Time Pattern: http://www.developers.meethue.com/documentation/datatypes-and-time-patterns#16_time_patterns
Note: To see the detail of development you must register and log in meethue.
黑...
沒有留言:
張貼留言