Page 2 of 2

Re: Using the data

PostPosted: Mon Jan 06, 2020 4:33 pm
by DaveL17
The Fantastic Weather device definitely has the key 'temperature'.

Screen Shot 2020-01-06 at 4.29.00 PM.png
Screen Shot 2020-01-06 at 4.29.00 PM.png (20.79 KiB) Viewed 2962 times


The hourly forecast and daily forecast devices don't have the key 'temperature'.

Re: Using the data

PostPosted: Mon Jan 06, 2020 4:34 pm
by DaveL17
p.s. To speak the value of the device state, you would create a schedule to run the python script.

Re: Using the data

PostPosted: Mon Jan 06, 2020 4:34 pm
by Bildhauer
Thx,

where did you take the screenshot? ;-)

Re: Using the data

PostPosted: Mon Jan 06, 2020 4:50 pm
by DaveL17
The states for any custom (plugin) device can be found below the device details pane. Apple has turned off scroll bars, so people tend to not know the data are there. :D

Screen Shot 2020-01-06 at 4.49.59 PM.png
Screen Shot 2020-01-06 at 4.49.59 PM.png (26.07 KiB) Viewed 2952 times

Re: Using the data

PostPosted: Mon Jan 06, 2020 4:54 pm
by Bildhauer
Great, I found it and I corrected the script so it doesn't have any errors any more.

How can I make the hourly script "speak" the value for an action? Do you have a screenshot of such an example giving the value to an email or interpreting it for an action?

Re: Using the data

PostPosted: Mon Jan 06, 2020 6:22 pm
by DaveL17
Surely!
Screen Shot 2020-01-06 at 6.18.27 PM.png
Screen Shot 2020-01-06 at 6.18.27 PM.png (152.61 KiB) Viewed 2929 times

Screen Shot 2020-01-06 at 6.20.13 PM.png
Screen Shot 2020-01-06 at 6.20.13 PM.png (127.81 KiB) Viewed 2929 times

Re: Using the data

PostPosted: Tue Jan 07, 2020 4:35 am
by Bildhauer
Thanks a lot.

But was does this script do. Where can I query the value of the temperature provided by this script? Do you haven an example for query the temperature and putting it an email saying that the "temperature at xx:xx AM/PM was xyº Celsius."

Re: Using the data

PostPosted: Tue Jan 07, 2020 6:32 am
by DaveL17
You said above that you wanted the temperature to be read aloud. That's what the script above does. Your questions don't really have anything to do with the plugin, but rather how to work with Indigo itself.

If you want to send an email every fifteen minutes with the temperature, you would do it like any other Indigo email notification. As I said above, I would recommend the Better Email plugin. But if you wanted to use Indigo's built-in email facility, instead of the script above, you would use this script instead (we're using a script here because of the custom message you want to send). Be sure to change the device ID and put in the proper email address.
Code: Select all
dev = indigo.devices[1909647006]
temp = dev.states['temperature']
now = indigo.server.getTime()

a = u"email@mail.com"
s = u"Current Temperature"
b = u"The temperature at {0:%H:%M %p} was {1}º Celsius.".format(now, temp)

indigo.server.sendEmailTo(a, subject=s, body=b)

If you have any other questions about how to use Indigo, I would recommend very strongly that you read the documentation and post your questions to the proper forum.

Cheers.

Re: Using the data

PostPosted: Tue Jan 07, 2020 9:10 am
by Bildhauer
Thx a lot. That helped a lot …