$twcweather.forecast - Preserve data lost at 3 o'clock


#1

It is quite frustrating how TWC handles weather forecast day by day…

For example:

  • at ~3am, all the data for that night is lost…
  • at ~3pm, some the data for that day is lost…

This means currently, from about 3a-7a, TWC is unable to tell us the low temperature.
(for the night still in progress)

Likewise, from 3p-11p, TWC cannot tell you the high for the current day any longer…

This is crazy to me…

HairPull


To combat this, I have created a piston that is smart enough to update once per hour, whenever TWC actually has data. Yet the real beauty is that it retains any data that is still current. (and even one day in the past)

This means, with this piston running once per hour… I can make a simple query to find the Min or Max temp for today, yesterday, or tomorrow… with the confidence that the data returned from this piston will ALWAYS be for the right time-slot.


Here is the piston to update (& preserve) min/max forecasted temps…
(although this concept can be used for other forecasts as well)

I added some comments in green, and some in blue for quick reference.

Note: I capture the data into local variables (for piston state & logging), and then afterwards, I copy them into @globals (so other pistons can reference those dataPoints).

You can test this piston by simply importing it, but if you want the most flexibility, then 6 @globals will need to be created.

  • integer @twcHiNext (not set)
  • integer @twcHiNow (not set)
  • integer @twcHiPrev (not set)
  • integer @twcLowNext (not set)
  • integer @twcLowNow (not set)
  • integer @twcLowPrev (not set)

It will take a bit to populate the data (since TWC does not make previous data available) but then these @global variables can be referenced by other pistons, to make sure we are always getting the data that we want.


Can I use high from today and tomorrow on weather tile in a piston?
High/Low temperature alert with TWC Weather
$twcweather Observations
#2

Here is a little snippet from the logs showing all 6 dataPoints.

pic


#3

There are also customized colors in the piston state.

pic

On the Dashboard, the colors will change based on the relationship between days… A quick glance is all it takes to see the coldest and hottest days of the three…


#4

I guess to sum it up, here were my goals with this piston:

  • Midnight to 7:45a, “Low” should represent the night in progress…
    and “High” should be the day that’s just beginning…

  • From 7:45a to 7:45p, “Low” should switch to the next night (16+ hours away)…
    while “High” should be the day in progress…

  • From 7:45p to midnight, “Low” should still reference tonight…
    but “High” should switch to tomorrow’s high.

This piston is just to make sure that all of these data queries are available… 24/7…
(In spite of TWC returning null 12 hours a day)


Note: The switchable hours are slightly adjustable in the piston


#5

Pro Tip:

The two adjustable variable hours are so you (not TWC) control when to switch over daily data.

{amChangeHr} defaults to 8, (8am) but can
be set anywhere from 5-14. (5am - 2pm)

{pmChangeHr} defaults to 20, (8pm) but can
be set anywhere from 17-23. (5pm - 11pm)


If this piston ever needs updating, I will add these notes to the piston for easier reference.


#6

As a visual guide, I added brackets in red to the JPEG in my first post.

pic

This makes it easy to see what slot it pulls data from throughout the day.