Is rain forecasted for today?


#1

1) Give a description of the problem
Hi Everyone, l am trying to create a piston that simply sends me an email notification if Rain or Showers, etc is expected at any point during the current day.

2) What is the expected behavior?
Sends me a daily email notification at 8:32am if Rain or Showers etc. i.e. (wet weather notification) is forecasted for that same day.

3) What is happening/not happening?
When executing the following piston, it keeps returning a ‘False’ variable response even if that value expression shows ‘Rain’ - I was expecting this to return ‘True’ and therefore sending the email notification

4) Post a Green Snapshot of the pistonimage

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)

Would greatly appreciate if someone could advise please as why this is not returning true.

Thanks in advance!


#2

Try it in this format… contains("Going to rain today","snow")


#3

Also be aware that the code:
$twcweather.forecast.daypart[0].wxPhraseShort
returns forecasts for the next 15 days (30 dataPoints).

Today’s AM forecast is:
$twcweather.forecast.daypart[0].wxPhraseShort[0]

Today’s PM forecast is:
$twcweather.forecast.daypart[0].wxPhraseShort[1]

(the numbers 2-29 are for the next 14 days)


You will probably not encounter this last bit at 8:32am, but for others reading this later:
I should note, the AM forecast [0] will be null 12 hours a day. (approx 3:15pm-3:15am)


#4

Hi Guys,
Thanks for your advice, l have changed things around a little, however, l am not to get it to trigger even the values does match but it still returns False - I suspect it’s to do with the way in which wrote the comparison on line 20 i.e. 'is any of … etc.
Appreciate if you could take a second peak and advise what is written incorrectly


Thanks again


#5

I don’t think you can match that way. You need to use an expression like this:

contains($twcweather.forecast.daypart[0].wxPhraseShort[1],"Rain")||contains($twcweather.forecast.daypart[0].wxPhraseShort[1],"Showers")||contains($twcweather.forecast.daypart[0].wxPhraseShort[1],"Shwrs")||contains($twcweather.forecast.daypart[0].wxPhraseShort[1],"Storms")

Then you compare this expression to the value ‘true’.

Let me suggest a possibly easier way if you are just interested in whether it might rain or not. simply look at:

$twcweather.forecast.daypart[0].precipChance[1] is greater than 20 [or whatever % you feel comfortable with]


#6

Perfect! I will that a shot

Many thanks guys!!!