- Hardware: Raspberry Pi 3B+
- OS: Raspbian Buster
- Java Runtime Environment:
openjdk version “11.0.7” 2020-04-14
OpenJDK Runtime Environment (build 11.0.7+10-post-Raspbian-3deb10u1)
OpenJDK Server VM (build 11.0.7+10-post-Raspbian-3deb10u1, mixed mode)
- openHAB 2.5.5 (Release Build)
Hello OpenHAB Community,
I am using the OpenWeather binding to display multi-day forecasts in a sitemap, with each day’s forecast in a separate frame. I’m using groups to do this, but the labels for the groups soon become rather confusing to the user. To overcome this, I’ve created a rule, which I’ve successfully implemented as a test for “Today”. See below.
One thing that puzzles me though is why the following does not set the label of gTodays_Weather_Forecasts as expected.
gTodays_Weather_Forecasts.label = gTodays_Weather_Forecasts_Label.label // Results in "Label: Weather Forecasts for", instead of "Weather Forecasts for Wednesday, May 27, 2020 (Today)"
Does anyone have any explanations?
DateTime Weather_Forecasts_Date "Date [%1$tA, %1$tB %1$td, %1$tY]" String gTodays_Weather_Forecasts_Label "Weather Forecasts for [%s] (Today)" Group gTodays_Weather_Forecasts "Today's Weather Forecasts" <weather> (gDaily_Weather_Forecasts)
rule "Update Label Test" // Test for dynamically updating the label of Today's weather frame. when Time cron "0/30 0/1 * 1/1 * ? *" // Fires every 30 seconds for test puposes since I don't want to wait until midnight //Time is midnight then Weather_Forecasts_Date.postUpdate(now.plusDays(0).toString) gTodays_Weather_Forecasts_Label.postUpdate(Weather_Forecasts_Date.state.format("%1$tA, %1$tB %1$td, %1$tY").toString) gTodays_Weather_Forecasts.label = String::format("Weather Forecasts for %s (Today)", gTodays_Weather_Forecasts_Label.state) logInfo("openweather.rules", "Update Label Test rule completed") end