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