$twcweather Observations



Sorry… haven’t been able to post in a while.

Here’s my latest:

“Light Snow”
“Snow Shower”

“Light Snow”
“Snow Shower”

“Light Snow”
“Snow Shower”


Quote from @Koyfam:

I’m working on the latest data now…


The Wiki has been updated.

Thanks @dejavux2 and @Koyfam!!



looking for some help here, not sure what i’m doing wrong.

When I add this ($twcweather.forecast.daypart[0].narrative) to my expression, it returns the entire array.

When I add this ($twcweather.forecast.daypart[1].narrative) or any other number inside [#] it doesn’t return anything.

Same happens when I use:


I’m a total newbie with this weather data and using it in webcore.


For the next 48 hours, try:

$twcweather.forecast.daypart[0].narrative[0]   (Today AM)
$twcweather.forecast.daypart[0].narrative[1]   (Today PM)
$twcweather.forecast.daypart[0].narrative[2]   (Tomorrow AM)
$twcweather.forecast.daypart[0].narrative[3]   (Tomorrow PM)

Just keep in mind that half of the time, [0] will be null… (from approx 3pm to 3am)

Same goes with:



Thank you!

Make sense now, I was missing targeting the array values at the end with [#]


Here you go:

$twcweather.forecast.daypart[0].precipChance[0] = Today AM
$twcweather.forecast.daypart[0].precipChance[1] = Today PM
$twcweather.forecast.daypart[0].precipChance[2] = Tomorrow AM
$twcweather.forecast.daypart[0].precipChance[3] = Tomorrow PM

Just keep in mind that the one ending in [0] will be “null” half of the time.
(approx 3pm to 3am)


You can find the average by using:
( [0] + [1] ) / 2

… but you will need extra code ahead of that to determine if [0] is “null”… and if so, to just use [1] as the “average”.


One observation though…

If you have an AM with 0 percent chance of rain, and an evening chance of 90%, then your daily “average” will be very misleading at 45%.


You forgot to divide your sum by two…

Also, I have only seen even numbers, so rounding the average is likely not necessary…
(unless you decide to round more than two dataPoints)


Yes, you would need to add a step before that line of code…

Something like:

IF [0] is "null"
    Then use [1]
    Else use ( [0] + [1] ) / 2


I think you have a bit of strange syntax in your last post, as well as missing data for the “round” command.

If you want to round the answer to a whole number, here is the expression I would use:

round((sum($twcweather.forecast.daypart[0].precipChance[0],$twcweather.forecast.daypart[0].precipChance[1]) / 2),0)

Changes I made:

  • Expressions do not need curly brackets
  • Sum needs parenthesis, not curly brackets
  • Sum needs a comma, not a “+”
  • Round needs to know how many decimals places to round to


One other “food-for-thought”…

After 3pm, when [0] returns null… It is important to remember that the [0] forecast is literally done and over with.

For example, at 4pm, the data from earlier that morning [0] should not really be a factor at all for the rain you can be expecting that afternoon.

Just my two cents.

What I do in my home is to try to determine the rain chance for the next 8 hours. (since I am rarely outside longer than that). This is kind of tough though, since TWC only shows 12 hour increments. My current method is something like this:

From  4am to  8am, use [0]              (AM data thru 3pm)
From  8am to  3pm, use ([0] + [1]) / 2  (today's AM/PM average)
From  4pm to 11pm, use [1]              (PM data thru 3am)
From 11pm to  3am, use ([1] + [2]) / 2  (PM today + AM tomorrow average)

Just keep in mind that any execution that happen in the 3 o’clock hour may go either way.
(the update time varies quite a bit, as seen here)


Just as a suggestion, it might be nice to include a short paragraph at the top of the Wiki page that explains how to set up and use the $twcweather variables.

I am just getting started with weather so here are my suggestions from someone experiencing this with new eyes.

After searching for a couple of hours, I haven’t really figured out how to set up this feature and configure the specific weather station. Perhaps a brief overview of the steps to set it up, configure the weather station, and then an example piston that does something like turn on a light when the current temperature rises above a certain value.

Also, it might be nice to describe in the Wiki how often the data is updated, and whether or not you can change the interval.

Hope that this helps!

- Brad


Thanks for the feedback. If I may address these one by one:

Variables can keep track of anything, so are not limited to $twcweather.
(IE: The weather page is not the place to learn about variables)

There is nothing to setup. (other than telling SmartThings your location)
The data is always available, but it is up to us to make the query efficiently.

Here is one that checks every half hour.


There has not been any public information released, so the $twcweather Wiki contains our own personal observations. I suspect the update time is very different in different locations (since weather providers are different worldwide)

I doubt this is possible yet. I mean, you can change how frequently you make the query, but that does not mean that anything new came in yet.

Typically, I make my weather queries once per hour. Temps every 30 min. Alerts every 15 minutes.

Try to not go overboard though please, because SmartThings is billed for each and every query. We don’t want to abuse it, because they will start charging us for this data.


Try this:

  • Add a new statement
  • Add an IF
  • Add a condition
  • What to compare: Expression
  • Type $twcweather.conditions.temperature in the box
  • Decide on what kind of comparison
  • Click on Add



Perfect! It works great.

Try to not go overboard though please, because SmartThings is billed for each and every query. We don’t want to abuse it, because they will start charging us for this data.

The info about not querying too often would be excellent to include in the Wiki. Now I know to be conservative.

Thanks for your help!

  • Brad


I mentioned it on the $twcweather.alerts page.