Weather alert if it rains in my region


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?

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

5) Attach logs after turning logging level to Full

If a solution is found for your question then please mark the post as the solution.


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:


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:


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)


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


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.


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.



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

My apologies… I do not understand the question.


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?



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


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!)


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… :(.


Perhaps try this


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.


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.


Thank you all. This worked.

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


Sure thing, glad to help.

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


Done. Thank you.