Weather Underground Plugin

User avatar
wideglidejrp
Posts: 559
Joined: Sun Jan 15, 2012 4:34 pm
Location: Danbury, CT
Contact:

Re: Weather Underground Plugin

Post by wideglidejrp »

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
User avatar
DaveL17
Posts: 6845
Joined: Tue Aug 20, 2013 11:02 am
Location: Chicago, IL, USA
Contact:

Re: Weather Underground Plugin

Post by DaveL17 »

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]
User avatar
wideglidejrp
Posts: 559
Joined: Sun Jan 15, 2012 4:34 pm
Location: Danbury, CT
Contact:

Re: Weather Underground Plugin

Post by wideglidejrp »

Looks the same. Am I missing something?
John R Patrick
Author of
Home Attitude
User avatar
DaveL17
Posts: 6845
Joined: Tue Aug 20, 2013 11:02 am
Location: Chicago, IL, USA
Contact:

Re: Weather Underground Plugin

Post by DaveL17 »

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]
User avatar
DaveL17
Posts: 6845
Joined: Tue Aug 20, 2013 11:02 am
Location: Chicago, IL, USA
Contact:

Re: Weather Underground Plugin

Post by DaveL17 »

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]
User avatar
wideglidejrp
Posts: 559
Joined: Sun Jan 15, 2012 4:34 pm
Location: Danbury, CT
Contact:

Re: Weather Underground Plugin

Post by wideglidejrp »

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
User avatar
DaveL17
Posts: 6845
Joined: Tue Aug 20, 2013 11:02 am
Location: Chicago, IL, USA
Contact:

Re: Weather Underground Plugin

Post by DaveL17 »

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]
User avatar
wideglidejrp
Posts: 559
Joined: Sun Jan 15, 2012 4:34 pm
Location: Danbury, CT
Contact:

Re: Weather Underground Plugin

Post by wideglidejrp »

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
User avatar
Different Computers
Posts: 2600
Joined: Sat Jan 02, 2016 10:07 am
Location: East Coast
Contact:

Re: Weather Underground Plugin

Post by Different Computers »

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?
Sonoma on a Mac Mini M1 running Airfoil Pro, Bond Home, Camect, Roku Network Remote, Hue Lights, DomoPad, Adapters, Home Assistant Agent, HomeKitLinkSiri, EPS Smart Dimmer, Fantastic Weather, Nanoleaf, LED Simple Effects, Grafana. UnifiAP
User avatar
DaveL17
Posts: 6845
Joined: Tue Aug 20, 2013 11:02 am
Location: Chicago, IL, USA
Contact:

Re: Weather Underground Plugin

Post by DaveL17 »

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]
User avatar
DaveL17
Posts: 6845
Joined: Tue Aug 20, 2013 11:02 am
Location: Chicago, IL, USA
Contact:

Re: Weather Underground Plugin

Post by DaveL17 »

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]
User avatar
wideglidejrp
Posts: 559
Joined: Sun Jan 15, 2012 4:34 pm
Location: Danbury, CT
Contact:

Re: Weather Underground Plugin

Post by wideglidejrp »

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
User avatar
DaveL17
Posts: 6845
Joined: Tue Aug 20, 2013 11:02 am
Location: Chicago, IL, USA
Contact:

Re: Weather Underground Plugin

Post by DaveL17 »

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]
User avatar
wideglidejrp
Posts: 559
Joined: Sun Jan 15, 2012 4:34 pm
Location: Danbury, CT
Contact:

Re: Weather Underground Plugin

Post by wideglidejrp »

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
User avatar
DaveL17
Posts: 6845
Joined: Tue Aug 20, 2013 11:02 am
Location: Chicago, IL, USA
Contact:

Re: Weather Underground Plugin

Post by DaveL17 »

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]
Post Reply

Return to “WUnderground Plugin”