It is very easy to use the URL calling feature to automatically trigger LIFX bulbs using event or data from any Wireless Sensor Tag. LIFX is often linked using IFTTT but this method is simpler and works with less latency.
First, go to https://cloud.lifx.com/settings to generate a token as below:
Then, from Web Interface (https://mytaglist.com/eth) open a tag, then click on ">" button and choose 'URL Calling..." to open "Custom URL Calling on Event" screen below:
Here, choose an event, such as "too hot", "too humid" or if you want the light to continuously change, "when tag sends .... update" as above, and enter the URL
https://[the token you obtained in previous step]@api.lifx.com/v1/lights/all/state
You can also enter other triggering methods described in LIFX API doc, such as selector to specify which bulb if you have more than one. Click on the ">" button next to the URL box to enter HTTP content.
In above example, we enclose math expression in <% and %> to have it evaluated before the URL is called. This expression divides temperature (in °C) by 40 and use it to set the brightness. The "min" function ensures the brightness does not go to negative. This will resulting in light being 100% bright at 40°C and completely off at 0°C and below.
Comments