Using the data

Posted on
Sat Jan 04, 2020 5:40 pm
Bildhauer offline
Posts: 26
Joined: Sep 30, 2019

Using the data

Hello,

I would like to us the data of FWP. How can I manage it to have triggers like "if temperature is less than x than do y"?

Thanks a lot for your support!

Best Regards

Bildhauer

Posted on
Sat Jan 04, 2020 5:59 pm
DaveL17 offline
User avatar
Posts: 5274
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Using the data

All you would need to do is create a trigger and link it to the temperature state of a weather (or weather forecast) device. For example, to create a trigger that will fire when the temperature drops below freezing, you would set it like this (Fantastic Weather is the name of my current weather device). It's important to remember that the data will only be as current as your last download--so it won't always be real time. I download data every 15 minutes which I find sufficient.

Screen Shot 2020-01-04 at 5.50.33 PM.png
Screen Shot 2020-01-04 at 5.50.33 PM.png (113.38 KiB) Viewed 615 times

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

[My Plugins] - [My Forums]

Posted on
Sun Jan 05, 2020 5:46 pm
Bildhauer offline
Posts: 26
Joined: Sep 30, 2019

Re: Using the data

Thx, that helps a lot.

Where do you set up the 15 minutes updates?

Best regards

Bildhauer

Posted on
Sun Jan 05, 2020 5:54 pm
DaveL17 offline
User avatar
Posts: 5274
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Using the data

In the plugin configuration dialog, there is a setting called "Call Interval" which controls the frequency of updates to the data. You can set it as frequent as every 2 minutes; however, I would not recommend that. The data probably don't change that frequently, and the API call limit could be exceeded (unless you have registered for a higher call limit).

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 2:38 pm
Bildhauer offline
Posts: 26
Joined: Sep 30, 2019

Re: Using the data

Great, thanks!

Any chance to use data of the plugin e. g. to send an email saying "the temperature has reached now xº C."?

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

Re: Using the data

Easy. Just use the trigger above and select a notification action. There are many options if you choose to set them up. You can use Indigo's built in email facility, the Better Email plugin (recommended) or any number of messaging plugins.

I personally use Better Email to send a message to my cell phone company email and Verizon converts that to a text message.

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 3:29 pm
Bildhauer offline
Posts: 26
Joined: Sep 30, 2019

Re: Using the data

Sorry, that's not what I want.

I want to have e.g. an hourly email telling me the temperature provided by your plugin. So is there any way to read it out (e. g. using a Python script?)?

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

Re: Using the data

First a question. Do you mean "read it out" as in read it aloud?

Regardless, you can use a schedule action instead of a trigger to do it. In my system, I have standard schedules set for:
- every minute,
- every 15 minutes,
- every hour,
- every 12 hours,
- every day,
and so on.

I then add any tasks I want to accomplish on a set schedule to these individual schedules.

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 3:39 pm
Bildhauer offline
Posts: 26
Joined: Sep 30, 2019

Re: Using the data

yes, I meant "read it out"!

So there is now way to read the values out?

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

Re: Using the data

You'll have to use a short bit of Python code to do it (the Indigo server speak action doesn't support substitutions).

Code: Select all
dev = indigo.devices[12345678]
indigo.server.speak(unicode(dev.states['temperature']))

Replace the number with the device ID of your weather device. Then just run the script each hour.

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:01 pm
Bildhauer offline
Posts: 26
Joined: Sep 30, 2019

Re: Using the data

Ok, I'll try, I'm not a great programmer …

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

Re: Using the data

I'm getting an error running this script, that it doesn't find the key temperature.

And how do I get the read out value in an an email or a trigger for a specific action?

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

Re: Using the data

Just to be sure that you have all the needed parts.

Install the Fantastic Weather plugin.
Sign up for a Dark Sky API key.
Configure the plugin to use your Dark Sky account.
Create a plugin Weather Device linked to the geographic location you wan to monitor.

Then the script should work. I've tested it against my system and its working as expected.

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:25 pm
Bildhauer offline
Posts: 26
Joined: Sep 30, 2019

Re: Using the data

Everything done as describe by you. But error is still existing run the script.

Still the additional question: How do I get the value of this script into an email or trigger?

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

Re: Using the data

Log shows:

Script Error embedded script: 'key temperature not found in dict'
Script Error Exception Traceback (most recent call shown last):

embedded script, line 2, at top level
KeyError: 'key temperature not found in dict'

Who is online

Users browsing this forum: No registered users and 1 guest

cron