{"metadata":{"image":[],"title":"","description":""},"api":{"url":"/lights/:selector/state/delta","auth":"required","settings":"","results":{"codes":[{"name":"","code":"{\n  \"results\": [\n    {\n      \"id\": \"d3b2f2d97452\",\n      \"label\": \"Left Lamp\",\n      \"status\": \"ok\"\n    }\n  ]\n}","language":"json","status":"2XX"}]},"method":"post","examples":{"codes":[{"code":"curl -X POST \"https://api.lifx.com/v1/lights/all/state/delta\" \\\n     -H \"Authorization: Bearer [[app:Token]]\" \\\n     -d \"brightness=0.1\"","name":"cURL","language":"curl"},{"language":"php","code":"<?php\n\n$link = \"https://api.lifx.com/v1/lights/all/state/delta\";\n$authToken = \"[[app:Token]]\";\n\n$headers = array('Authorization: Bearer ' . $authToken);\n\n$data = 'brightness=0.1';\n\n$ch = curl_init($link);\ncurl_setopt($ch, CURLOPT_HTTPHEADER, $headers);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, $data);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"POST\");\n$response = curl_exec($ch);\n\n?>"},{"language":"python","code":"import requests\n\ntoken = \"[[app:Token]]\"\n\nheaders = {\n    \"Authorization\": \"Bearer %s\" % token,\n}\n\npayload = {\n    \"brightness\": 0.1,\n}\n\nresponse = requests.post('https://api.lifx.com/v1/lights/all/state/delta', data=payload, headers=headers)"},{"language":"go","code":"package main\n\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\n\nfunc main() {\n\n\tbody := strings.NewReader(`brightness=0.1`)\n\treq, err := http.NewRequest(\"POST\", \"https://api.lifx.com/v1/lights/all/state/delta\", body)\n\tif err != nil {\n\t\t// handle err\n\t}\n\treq.Header.Set(\"Authorization\", \"Bearer [[app:Token]]\")\n\treq.Header.Set(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\t// handle err\n\t}\n\tdefer resp.Body.Close()\n\n}\n"}]},"params":[{"name":"selector","type":"string","default":"","desc":"The [selector](doc:selectors) to limit which lights are controlled.","required":true,"in":"path","ref":"","_id":"55810ef004ae5b0d00262877"},{"name":"power","type":"string","default":"","desc":"The power state you want to set on the selector. `on` or `off`","required":false,"in":"body","ref":"","_id":"55810f5504ae5b0d0026287b"},{"name":"duration","type":"double","default":"1.0","desc":"How long in seconds you want the power action to take. Range: `0.0` – `3155760000.0` (100 years)","required":false,"in":"body","ref":"","_id":"55810f5504ae5b0d0026287a"},{"name":"infrared","type":"double","default":"","desc":"The maximum brightness of the infrared channel.","required":false,"in":"body","ref":"","_id":"5823fc3a0c90d02d00fe65cf"},{"name":"hue","type":"double","default":"","desc":"Rotate the hue by this angle in degrees.  Range: `-360.0` – `360.0` degrees","required":false,"in":"body","ref":"","_id":"592f80058cd4eb002d39b875"},{"name":"saturation","type":"double","default":"","desc":"Change the saturation by this additive amount; the resulting saturation is clipped to `[0, 1]`.","required":false,"in":"body","ref":"","_id":"592f80058cd4eb002d39b874"},{"name":"brightness","type":"double","default":"","desc":"Change the brightness by this additive amount; the resulting brightness is clipped to `[0, 1]`.","required":false,"in":"body","ref":"","_id":"55ece0f254a67b1700edcf45"},{"name":"kelvin","type":"double","default":"","desc":"Change the kelvin by this additive amount; the resulting kelvin is clipped to `[2500, 9000]`.","required":false,"in":"body","ref":"","_id":"592f80058cd4eb002d39b873"}]},"next":{"description":"","pages":[]},"title":"State Delta","type":"endpoint","slug":"state-delta","excerpt":"","body":"Parameters other than `power` and `duration` change the state of the lights by the amount specified. \n `power` and `duration` act like they do for the [Set State](doc:set-state) endpoint.\n\nFor example, to make all lights 10% brighter, and turn those that are off on over 5 seconds, send:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"// POST /v1/lights/all/state/delta\\n{\\n  \\\"power\\\": \\\"on\\\",\\n  \\\"brightness\\\": 0.1,\\n  \\\"duration\\\": 5  \\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]","updates":[],"order":4,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"592f794c7fd3210025f6d6e5","project":"54ebb40d6423300d003672c0","version":{"version":"1","version_clean":"1.0.0","codename":"","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["55f28172f9f3991900f38a14","55f28172f9f3991900f38a15","55f28172f9f3991900f38a16","55f66acb297b37170058accb","5d229ff5e59b8e003ab3a9da"],"_id":"55f28172f9f3991900f38a13","project":"54ebb40d6423300d003672c0","releaseDate":"2015-09-11T07:23:30.065Z","createdAt":"2015-09-11T07:23:30.065Z","__v":3},"category":{"sync":{"isSync":false,"url":""},"pages":["55f28173f9f3991900f38a1d","55f28173f9f3991900f38a1e","55f28173f9f3991900f38a1f","55f28173f9f3991900f38a20","55f28173f9f3991900f38a21","55f28173f9f3991900f38a22","55f28173f9f3991900f38a23","55f28173f9f3991900f38a24","55f28173f9f3991900f38a25","55f28173f9f3991900f38a26","55f28173f9f3991900f38a27","55f63d46fe4cce21005c785e","55f65cc16be5ea0d00bbbf4c"],"title":"API Endpoints","slug":"api-endpoints","order":2,"from_sync":false,"reference":false,"_id":"55f28172f9f3991900f38a16","__v":3,"createdAt":"2015-06-17T05:23:31.147Z","project":"54ebb40d6423300d003672c0","version":"55f28172f9f3991900f38a13"},"user":"58e43269015a960f00849c4e","createdAt":"2017-06-01T02:17:48.779Z","githubsync":"","__v":3,"parentDoc":null}

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Path Params

selector:
required
string
The [selector](doc:selectors) to limit which lights are controlled.

Body Params

power:
string
The power state you want to set on the selector. `on` or `off`
duration:
double1.0
How long in seconds you want the power action to take. Range: `0.0` – `3155760000.0` (100 years)
infrared:
double
The maximum brightness of the infrared channel.
hue:
double
Rotate the hue by this angle in degrees. Range: `-360.0` – `360.0` degrees
saturation:
double
Change the saturation by this additive amount; the resulting saturation is clipped to `[0, 1]`.
brightness:
double
Change the brightness by this additive amount; the resulting brightness is clipped to `[0, 1]`.
kelvin:
double
Change the kelvin by this additive amount; the resulting kelvin is clipped to `[2500, 9000]`.

Examples


Result Format


Documentation

Parameters other than `power` and `duration` change the state of the lights by the amount specified. `power` and `duration` act like they do for the [Set State](doc:set-state) endpoint. For example, to make all lights 10% brighter, and turn those that are off on over 5 seconds, send: [block:code] { "codes": [ { "code": "// POST /v1/lights/all/state/delta\n{\n \"power\": \"on\",\n \"brightness\": 0.1,\n \"duration\": 5 \n}", "language": "json" } ] } [/block]

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}