I’m trying to display the value of a string in a sitemap, using the TimeOfDay design pattern posting the forum, but it comes up empty:
item:
String TimeOfDay (gSettings)
rules:
rule "Get time period for right now"
when
System started or
Item SwTest changed to ON
then
// val morning = now.withTimeAtStartOfDay.plusHours(6).millis
val dawn = new DateTime((Dawn_Time.state as DateTimeType).calendar.timeInMillis)
val sunrise = new DateTime((Sunrise_Time.state as DateTimeType).calendar.timeInMillis)
val twilight = new DateTime((Twilight_Time.state as DateTimeType).calendar.timeInMillis)
val evening = new DateTime((Sunset_Time.state as DateTimeType).calendar.timeInMillis)
val night = now.withTimeAtStartOfDay.plusHours(23).millis
if(now.isAfter(dawn) && now.isBefore(sunrise)) updateTimeOfDay.apply("Dawn", "Night", true)
else if(now.isAfter(sunrise) && now.isBefore(twilight)) updateTimeOfDay.apply("Day", "Dawn", true)
else if(now.isAfter(twilight) && now.isBefore(evening)) updateTimeOfDay.apply("Twilight", "Day", true)
else if(now.isAfter(evening) && now.isBefore(night)) updateTimeOfDay.apply("Evening", "Twilight", true)
else updateTimeOfDay.apply("Night", "Evening", true)
end
Sitemap:
Frame label="Times" {
Text item=TimeOfDay label="Time of Day"
Text item=Azimuth
Text item=Elevation
}
Can’t help feeling there’s something glaring I’m missing, but I can’t figure it…
Cheers
J