Weather Underground Plugin

Posted on
Sat May 13, 2017 5:49 am
wideglidejrp offline
User avatar
Posts: 494
Joined: Jan 15, 2012
Location: Danbury, CT

Re: Weather Underground Plugin

Good morning, Dave. Thanks for the script. I had the impression when editing the settings that there was a choice for standard, without unit of measure. No? What I am trying to do is create a morning announcement. I used it today for first time and it worked quite nicely, although the F sounds unneeded. Do you use Ivona? I works very nicely but Amazon is making some major changes to how they offer it and not sure what impact that will have on the Sonos Plugin. I will check with Nick Lagaros on that. I look forward to chatting with you about how weather and home automation go hand in hand.

John R Patrick
Author of
Home Attitude

Posted on
Sat May 13, 2017 5:50 am
DaveL17 offline
User avatar
Posts: 5347
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Weather Underground Plugin

It occurs to me that there was a request to replace the dot decimal with a comma decimal within strings for spoken forecasts (that I regrettably never responded to). Here is a pattern match that will replace the dot with a comma for temperatures but leave other values unchanged.

Code: Select all
line = re.sub('([0-9]+)\.([0-9]+)([F|C])', '\g<1>,\g<2>\g<3>', dev.states['foreText1'])

Thunderstorms during the morning will give way to cloudy skies this afternoon. High 23.1C. Winds E at 10.1 to 15 mph. Chance of rain 90%.

Becomes:

Thunderstorms during the morning will give way to cloudy skies this afternoon. High 23,1C. Winds E at 10.1 to 15 mph. Chance of rain 90%.

[Edit: fixes typo in re.sub source]

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

[My Plugins] - [My Forums]

Posted on
Sat May 13, 2017 5:54 am
wideglidejrp offline
User avatar
Posts: 494
Joined: Jan 15, 2012
Location: Danbury, CT

Re: Weather Underground Plugin

Looks the same. Am I missing something?

John R Patrick
Author of
Home Attitude

Posted on
Sat May 13, 2017 5:59 am
DaveL17 offline
User avatar
Posts: 5347
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Weather Underground Plugin

wideglidejrp wrote:
Good morning, Dave. Thanks for the script. I had the impression when editing the settings that there was a choice for standard, without unit of measure. No? What I am trying to do is create a morning announcement. I used it today for first time and it worked quite nicely, although the F sounds unneeded. Do you use Ivona? I works very nicely but Amazon is making some major changes to how they offer it and not sure what impact that will have on the Sonos Plugin. I will check with Nick Lagaros on that. I look forward to chatting with you about how weather and home automation go hand in hand.

Hi John - you are correct, but it's a bit of apples and oranges. The settings within the plugin for units are handled under the hood thusly. Most discrete values (like temperature) have an 'actual' value and a 'UI value'. In this way, I can make a float of 12.0000000000123 look like '12.0 mph' for display in the Indigo UI and on control pages. The forecast text is a long string where the value and the UI value are the same.

I'm a bit hesitant to create options to customize the string values because it feels like it might be opening a bit of a Pandora's box. I'm afraid that the number of potential options could become unwieldy in the plugin configuration UI. I'm not opposed to the idea though, so if there is great demand I'll look for a manageable way to address it. :D

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

[My Plugins] - [My Forums]

Posted on
Sat May 13, 2017 6:03 am
DaveL17 offline
User avatar
Posts: 5347
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Weather Underground Plugin

wideglidejrp wrote:
Looks the same. Am I missing something?

Do you mean these two lines?

Code: Select all
re.sub('([0-9]+)[F|C]', '\g<1>', dev.states['foreText1'])
re.sub('([0-9]+)\.([0-9]+)([F|C])', '\g<1>,\g<2>\g<3>', dev.states['foreText1'])


(note that I had a typo in the second example and will fix that.)

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

[My Plugins] - [My Forums]

Posted on
Sat May 13, 2017 6:07 am
wideglidejrp offline
User avatar
Posts: 494
Joined: Jan 15, 2012
Location: Danbury, CT

Re: Weather Underground Plugin

No, I meant the following two:

Thunderstorms during the morning will give way to cloudy skies this afternoon. High 23.1C. Winds E at 10.1 to 15 mph. Chance of rain 90%.

Becomes:

Thunderstorms during the morning will give way to cloudy skies this afternoon. High 23,1C. Winds E at 10.1 to 15 mph. Chance of rain 90%.

John R Patrick
Author of
Home Attitude

Posted on
Sat May 13, 2017 6:15 am
DaveL17 offline
User avatar
Posts: 5347
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Weather Underground Plugin

wideglidejrp wrote:
No, I meant the following two:

Thunderstorms during the morning will give way to cloudy skies this afternoon. High 23.1C. Winds E at 10.1 to 15 mph. Chance of rain 90%.

Becomes:

Thunderstorms during the morning will give way to cloudy skies this afternoon. High 23,1C. Winds E at 10.1 to 15 mph. Chance of rain 90%.


Oh, sorry. In the second example, the script replaces the dot with a comma as the separator for the temperature value.

I seem to remember a request from somewhere near the Arctic Circle requesting that (for use with Ivona!)

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

[My Plugins] - [My Forums]

Posted on
Sat May 13, 2017 6:20 am
wideglidejrp offline
User avatar
Posts: 494
Joined: Jan 15, 2012
Location: Danbury, CT

Re: Weather Underground Plugin

What I am trying to do is mimic a short local forecast. I don't need to hear F or C or Knots or MPH. Ivona simply says whatever text you give it. I'll experiment with your script when I get back from Mexico on Monday. Another thing I want to build into my automation is alerts. Which variables would you recommend for that? I am thinking only significant one, like high winds or heavy rain, not just wind or rain. Then I would need to figure out how to create a trigger, and then that would fire an action to have Ivona make the announcement throughout the house. Might look for an MP3 clip preceding it. "Attention for Weather Alert". Might even be able to find a professionally recorded sound byte somewhere.

John R Patrick
Author of
Home Attitude

Posted on
Sat May 13, 2017 12:07 pm
Different Computers offline
User avatar
Posts: 1966
Joined: Jan 02, 2016
Location: East Coast

Re: Weather Underground Plugin

I'm scratching my head a bit on using WU to trigger lights.

I have an Action Group called Cloudy Day Lights. Unsurprisingly, I would like to have it triggered when it becomes cloudy. Or Overcast. Or Rain. or Fog. You get the idea.

Trouble is, to make a trigger react to the WU forecast device state, as best as I can figure I would have to make a trigger for every one of those possible current conditions. Can't make it work the other way around by looking for NOT "sunny" because there's clear, and sun, and partly cloudy, etc.

Anyone got a work around or better idea?

SmartThings refugee, so happy to be on Indigo. 10.13.6 on an i5 MBP w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKit Bridge, MatplotLib, Plex, uniFAP, Wunderground, Nanoleaf, LED Simple Effects, Airfoil Pro, Grafana.

Posted on
Sat May 13, 2017 8:36 pm
DaveL17 offline
User avatar
Posts: 5347
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Weather Underground Plugin

wideglidejrp wrote:
What I am trying to do is mimic a short local forecast. I don't need to hear F or C or Knots or MPH. Ivona simply says whatever text you give it. I'll experiment with your script when I get back from Mexico on Monday. Another thing I want to build into my automation is alerts. Which variables would you recommend for that? I am thinking only significant one, like high winds or heavy rain, not just wind or rain. Then I would need to figure out how to create a trigger, and then that would fire an action to have Ivona make the announcement throughout the house. Might look for an MP3 clip preceding it. "Attention for Weather Alert". Might even be able to find a professionally recorded sound byte somewhere.

I can help you build a custom string for announcements. No worries there.

The Weather Device has support built in for up to five severe weather alerts; I'd recommend starting there and seeing whether that fits what you need. It includes a description, an expiration, a message, a type and a flag (if there are any active alerts, the flag will be set to true). So you might see something like this:

Description: Severe Thunderstorm Warning
Expiration: 2017-05-13 21:00
Message: There is a severe thunderstorm warning for the counties of Cork, etc, etc.
Type: WRN
Flag: true

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

[My Plugins] - [My Forums]

Posted on
Sat May 13, 2017 8:42 pm
DaveL17 offline
User avatar
Posts: 5347
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Weather Underground Plugin

Different Computers wrote:
I'm scratching my head a bit on using WU to trigger lights.

I have an Action Group called Cloudy Day Lights. Unsurprisingly, I would like to have it triggered when it becomes cloudy. Or Overcast. Or Rain. or Fog. You get the idea.

Trouble is, to make a trigger react to the WU forecast device state, as best as I can figure I would have to make a trigger for every one of those possible current conditions. Can't make it work the other way around by looking for NOT "sunny" because there's clear, and sun, and partly cloudy, etc.

Anyone got a work around or better idea?

Couldn't you make just one trigger (trigger on any state change) and add the conditions (if any are true):

Current Weather is equal to cloudy
Current Weather is equal to rain
Etc.

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

[My Plugins] - [My Forums]

Posted on
Sun May 14, 2017 1:40 am
wideglidejrp offline
User avatar
Posts: 494
Joined: Jan 15, 2012
Location: Danbury, CT

Re: Weather Underground Plugin

Yes, I am sure that could work and I plan to experiment with the idea next week. I will share results.

John R Patrick
Author of
Home Attitude

Posted on
Sun May 14, 2017 4:15 am
DaveL17 offline
User avatar
Posts: 5347
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Weather Underground Plugin

Hi John - This how to may also be useful for you.

How to Make Indigo Speak WUnderground Information

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

[My Plugins] - [My Forums]

Posted on
Sun May 14, 2017 9:38 am
wideglidejrp offline
User avatar
Posts: 494
Joined: Jan 15, 2012
Location: Danbury, CT

Re: Weather Underground Plugin

Very helpful information. I have not tried Indigo speak. I use Ivona. It is highly customizable with male/female, speed, accent, etc. Amazon is changing things with Ivona though, and I have not yet looked into the implications.

John R Patrick
Author of
Home Attitude

Posted on
Mon May 15, 2017 5:24 am
DaveL17 offline
User avatar
Posts: 5347
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Weather Underground Plugin

Glad that was helpful.

I've played with Ivona, but we don't use announcements in our install so I've never gone to deeply into it.


Sent from my iPhone using Tapatalk

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

[My Plugins] - [My Forums]

Who is online

Users browsing this forum: No registered users and 1 guest