A forecast is one of the most common widgets. Is it one of the simplest to make? Yes. And no.
This tutorial is divided in two parts. The first part is for the simple daily forecast and the second upgrades it with hourly intervals.
Calculation is based on a horizontal stack of condition groups. Each weather condition group is a vertical stack group containing all the weather info.
To control the forecast, create 2 number globals:
For the forecast info, create 6 text globals with these formulas:
gv(index)Can be different based on how you set up groups.
gv(time)"EEE d" is an example. Formula can display almost anything from the df() section.
gv(wicon)Returns the equivalent of $wi(icon)+ai(isday)$. Change based on the weather icon pack.
gv(temp)Can also display wf(temp, if you don't use the next global.
Making the Group
Make a horizontal stack group;
in it create a vertical stack group;
inside add text objects linking them to one of the global formulas above (link gv(wicon) to the fonticon/bitmap).
Just copy and paste the vertical stack group as many times as you like and the forecast will be generated automatically.
Adding hourly intervals to the forecast requires the same group structure, the only difference are the global formulas which have to do more heavy-lifting.
The number globals that control the forecast change their function:
gv(interval)description: hours between forecasts (1 = every hour, 2 = every 2 hours, etc.) - 24 is daily
gv(offset)description: start of the forecast (0 = now, 1 = 1 hour from now, 2 = 2 hours from now, etc.)
Upgrade these forecast info text globals:
gv(wicon)Change based on the weather icon pack.
To hide the minimum temperature (because there's no point in displaying it every hour) use this formula for its color:
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
Kustom formatted version