LIFX Developer Zone

Tasker HTTP POST (android)

Hi! I am trying to use taskers HTTP POST function to send cURLs to control my bulbs. Or at least I would love to. Google isn’t of any use. There seems to be very little information about this. I know there are plugins to do this but I would love to share my projects as apps so I’d like to reduce dependencies.

Is anyone doing this already and could help me out? Thank you!

Edit: I figured it out (kinda). It seems the native HTTP POST routine of tasker isn’t able to send a custom header. I have to use the plugin “RESTask”. At least it’s free. If someone can make it work without any additional plugins, I’d really appreciate it!

this still seems to be the case in 2019. it took a lot of trial and error to figure out how to do it so i figured i would post it here for anyone else that is searching for it.
.

the task to use is “HTTP Request”.
if you want to toggle your light then use the POST method and this URL:
https://api.lifx.com/v1/lights/SELECTOR/toggle

(change SELECTOR in the URL with whatever selector you want to use. see the lifx api docs)

if you want to change the state of the light then use the PUT method and this URL:
https://api.lifx.com/v1/lights/SELECTOR/state
in the BODY put the json you want to use:

{
    "power": "on", 
    "duration": 3,
    "color": "#FF0000"
}

the Headers is the same for either one:

Accept: */*
Authorization: Bearer %LIFX_TOKEN

i have my token saved in global variable called “LIFX_TOKEN” in case i ever need to change it