Help adjusting some old $weather pistons to TWC


#1

1) Give a description of the problem
(would like to figure out the highest chance of precipitation for the next 6 hrs)

2) What is the expected behavior?
(analyze data and if any integer for chance of rain is higher than 40% within the next 6 hours then have an announcement over speaker when leaving the house)

3) What is happening/not happening?
not too sure how to use the new twc commands to achieve this the expression $twcweather.forecast.daypart[0].precipChance shows many different integers for more than 6 hours of data
Ive tried max(integer($twcweather.forecast.daypart[0].precipChance)) how ever it just gives me one big giant number


#2

Unfortunately, this is no longer possible with $twcweather. That list of 30 numbers you mentioned is the next 15 days broken down into 12 hour segments.


If you are running this piston from about 3:15am to 3:15pm, then today’s rain chance would be:
$twcweather.forecast.daypart[0].precipChance[0]

After about 3:15pm, the [0] turns to null, then the most current data would be tonights rain chance:
$twcweather.forecast.daypart[0].precipChance[1]


#3

It might be worth mentioning that you can get a 3 hour precipitation if you use the AccuWeather plugin for SmartThings, as seen here:

temp


#4

this will work perfectly for me thanks so much for your help all my pistons have been corrected


#5

Glad to help… Just remember that [0] will return “null” from about 3:15pm until 3:15am