How To: How to Make Indigo Speak WUnderground Information

Posted on
Thu Oct 30, 2014 6:49 pm
DaveL17 offline
User avatar
Posts: 5364
Joined: Aug 20, 2013
Location: Chicago, IL, USA

How To: How to Make Indigo Speak WUnderground Information

If you don't use Indigo speech in your setup, no need to read further. However, if you want to know how to get Indigo to announce weather information, read on...

First, let's get the hard part out of the way:
Code: Select all
# This is the device ID to use for the weather information:
dev = indigo.devices[949793465]

# Set up the values that we are going to use:
alert_description    = dev.states["alertDescription1"]
alert_status         = dev.states["alertStatus"]
chance_of_rain       = str(int(round(dev.states["forePop1"])))
current_temperature  = str(int(round(dev.states["temp"])))
current_weather      = dev.states["currentWeather"]
fore_conditions      = dev.states["conditions2"]
fore_rain            = str(int(round(dev.states["forePop2"])))
fore_temp            = str(int(round(dev.states["foreHigh2"])))
location_city        = dev.states["locationCity"]
relative_humidity    = str(int(round(dev.states["relativeHumidity"])))
today_high           = str(int(round(dev.states["foreHigh1"])))

# This is what Indigo will speak.
indigo.server.speak("{0} weather.".format(location_city))
indigo.server.speak("Current conditions are {0} with a temperature of {1} degrees.".format(current_weather, current_temperature))
indigo.server.speak("Relative humidity level of {0} percent.".format(relative_humidity))
indigo.server.speak("Today's high temperature is forecast to be {0} degrees and there is a {1} percent chance of precipitation.".format(today_high, chance_of_rain))
if alert_status:
   indigo.server.speak("There is currently a {0}".format(alert_description))
indigo.server.speak("Tomorrow's weather is {0} with a high of {1} degrees and {2} percent chance of precipitation.".format(fore_conditions, fore_temp, fore_rain))
Create a new Action Item and then take the above code and save it as an embedded script.

For the line that says:
Code: Select all
dev = indigo.devices[123]
You should replace '123' with the Indigo device ID number of your favorite Wunderground device.

The variables come next and are references to WUnderground device states. To get device state information, scroll down in the device window, right click on a custom state and copy the Python reference. Note that non-string values need to be converted to strings in order for Indigo to be able to speak them.
Screen Shot 2014-10-30 at 7.42.35 PM.png
Screen Shot 2014-10-30 at 7.42.35 PM.png (28.85 KiB) Viewed 1086 times
Then, add a corresponding 'indigo.server.speak' block to the next section to establish what Indigo will say, and how it will say it.

The above is just an example to show the kinds of things you can do. And there are many more WUnderground states to choose from.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest