Weather alert if it rains in my region


#1

1) Give a description of the problem
Trying to create an alert when it rains in my region. Based in Glasgow Scotland.

2) What is the expected behaviour?
Ideally I’d like it to come through my echo via echo speaks which I have installed and working correctly.

3) What is happening/not happening?
N/A

**4) Post a Green Snapshot of the piston![image|45x37](upload://xK8WwMCzoDkDrcB1Jf27yjtZ9b

5) Attach logs after turning logging level to Full
(PASTE YOUR LOGS HERE THEN HIGHLIGHT ALL OF THE LOGS AND CLICK ON THE </> ICON TO FORMAT THEM CORRECTLY)

REMOVE BELOW AFTER READING
If a solution is found for your question then please mark the post as the solution.


#2

There are many ways to achieve this…

If we look at the TWC_Weather page on the Wiki, we see a few choices.
I think perhaps the following is the best for your goals:

$twcweather.conditions.wxPhraseLong

There are at least 30 possible results from this, a dozen of which contain the word “Rain”.

You could create a piston to query that dataPoint every 15 minutes, and if the results contains the word “Rain”, then send you a weather alert.


Maybe something like this:

pic


Note: It might be worth adding an extra block to prevent spam on the days of non-stop rain.
(otherwise, you will get a message every 15 min)


#3

Note this example has a typo in case you want to use it. The set variable rain uses ‘conditions’ but the actual variable is ‘condition’.


#4

LOL, thanks for catching that! I did my testing, uploaded an image, and then decided I wanted the variable to be singular. I guess one “S” slipped past me.

The last image has been corrected now.


#5

Thank you very much for this. Do I have to alter this piston in any way for my particular region?

Also, what sort of if block could in use?
Sorry although I’ve used webcore for a while now I’m still fairly novice at it.

Thanks.


#6

I don’t think so… Unless TWC starts reporting in another language, LOL


My apologies… I do not understand the question.


#7

Thanks. What I meant was what would be the best ‘if’ block to use. I’ve set it to home mode only for now.

Also. Here is the piston that I’ve adapted. I haven’t heard anything yet though my LivingRoom echo so I’m
Wondering if this is set up correctly?

Thanks


#8

If you mean when should Alexa speak?
On mine, I added extra logic to prevent identical alerts from being repeated.
I also added extra code, so she only speaks if I am awake.

If you are a creature of habit, the later can also be resolved by adding a block based on time.
(IE: Speak only between 8am and 10pm)


If you mean what is the best trigger?
This portion has infinite possibilities, but it is not automatic. We have to code for it. “Every X minutes” makes sense to catch events, but I have other pistons that also checks the weather… Before I leave the house, I am automatically informed by one piston… another alerts me in my Good Morning piston… and another automatically updates me around my “dog walking” time… just to name a few.

In this regards though, it is a good habit to always be respectful when deciding how often to make a TWC weather query. (or any free API really) Unfortunately, TWC data does not change very frequently, so spamming a piston too often will not be beneficial to you (and could actually hurt all of us)

For things like weather alerts or conditions, I usually do what you did here… Every 15 min. Things like temp or humidity, I may limit my queries to once every 30 min. Things like forecast, I may only query once every 4-6 hours. Taking this concept a step farther: With special events, (like rocket launches), I may limit the request to only once or twice a day.

All of these are so I get accurate data, without spamming their weather server.
(which is currently free for us)


Not bad… Although if you use the Expression from my sample piston above
'Likely 'condition' expected soon'
you will get a more informative voice alert.

In this case, the spoken results could be:
Likely Rain Shower with Thunder expected soon


#9

Sometimes, when testing, it helps to put in fake data.

For example, on line 21 above, you could change the word “Rain” to “Cloudy”, or whatever the weather currently is.

Likewise, during testing, you can change line 18, to Every 2 minutes

Then save the piston, and wait a couple.


Once you are happy with your testing, just change those two lines back.
(you most definitely do not want to leave this one running every 120 seconds!)


#10

Thanks very much for this.
I seem to have it set up now. I’ve created a virtual switch to turn on so that I don’t get the alert every 15 minutes if it’s constantly raining throughout the day. Then I have that switch turn back off every few hours.

One thing that’s annoying me though is regarding echo speaks. It just won’t speak out my text. If I set it to something different like one of the pre made announcements within webcore like ‘say goodnight’ or ‘happy birthday’ she will speak them out, but not my own text here… :(.


#11

Perhaps try this


#12

Check your echo speaks is up to date. There has been an update today, just updated mine. I’m not sure if not doing the update would cause it to fail. The update was due to amazon changing the way they authenticate.


#13

I also found after I updated the DTH, it did not force the update out so I had to go into each device in the IDE and force an update by clicking ‘edit’ and ‘update’. Then mine started talking again.


#14

Thank you all. This worked.

Thanks again for all the help mate. :+1:


#15

Sure thing, glad to help.

Perhaps you can solution one of my posts above to help others?


#16

Done. Thank you.