What I want to do:
I would like to pull the temp from my local NOAA plugin and use it to determine the color of a lamp in my living room...a visual representation of the approximate temp outside my house.
Broken code I came up with based on other examples:
- Code: Select all
myWeatherStation = indigo.devices[##########]
temp = myWeatherStation['temperatureF']
plug = indigo.server.getPlugin("com.nathansheldon.indigoplugin.HueLights")
indigo.server.log (myWeatherStation.states['temperatureF'])
if temp <= "32":
if plug.isEnabled():
plug.executeAction("setRGB", indigo.devices["Hue Lamp 1"].id, props={"red":0, "green":0, "blue":255})
if temp <= "60" and temp > "30":
if plug.isEnabled():
plug.executeAction("setRGB", indigo.devices["Hue Lamp 1"].id, props={"red":0, "green":125, "blue":125})
if temp <= "80" and temp > "60":
if plug.isEnabled():
plug.executeAction("setRGB", indigo.devices["Hue Lamp 1"].id, props={"red":0, "green":255, "blue":0})
if temp temp > "80":
if plug.isEnabled():
plug.executeAction("setRGB", indigo.devices["Hue Lamp 1"].id, props={"red":255, "green":0, "blue":0})
Problems I see:
1. I don't know what I'm doing.
2. I don't know if the NOAA plugin reports the temp as a numeric value, because I can't get it to print to the log.
3. I'm not sure if I need to define the plugins for NOAA and HUE before I can do any of this.
Help appreciated!
- Ben