Using the data

Posted on
Mon Jan 06, 2020 4:33 pm
DaveL17 offline
User avatar
Posts: 5274
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Using the data

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 395 times


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

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

[My Plugins] - [My Forums]

Posted on
Mon Jan 06, 2020 4:34 pm
DaveL17 offline
User avatar
Posts: 5274
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Using the data

p.s. To speak the value of the device state, you would create a schedule to run the python script.

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

[My Plugins] - [My Forums]

Posted on
Mon Jan 06, 2020 4:34 pm
Bildhauer offline
Posts: 26
Joined: Sep 30, 2019

Re: Using the data

Thx,

where did you take the screenshot? ;-)

Posted on
Mon Jan 06, 2020 4:50 pm
DaveL17 offline
User avatar
Posts: 5274
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Using the data

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 385 times

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

[My Plugins] - [My Forums]

Posted on
Mon Jan 06, 2020 4:54 pm
Bildhauer offline
Posts: 26
Joined: Sep 30, 2019

Re: Using the data

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?

Posted on
Mon Jan 06, 2020 6:22 pm
DaveL17 offline
User avatar
Posts: 5274
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Using the data

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 362 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 362 times

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

[My Plugins] - [My Forums]

Posted on
Tue Jan 07, 2020 4:35 am
Bildhauer offline
Posts: 26
Joined: Sep 30, 2019

Re: Using the data

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."

Posted on
Tue Jan 07, 2020 6:32 am
DaveL17 offline
User avatar
Posts: 5274
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Using the data

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.

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

[My Plugins] - [My Forums]

Posted on
Tue Jan 07, 2020 9:10 am
Bildhauer offline
Posts: 26
Joined: Sep 30, 2019

Re: Using the data

Thx a lot. That helped a lot …

Who is online

Users browsing this forum: No registered users and 1 guest