Frame label="Alarm" {
Text item=Alarm_MasterTime icon="presence-on" visibility=[Alarm_Master==ON] {
Frame label="Master Alarm" {
Switch item=Alarm_Master
Text item=Alarm_MasterTime
Setpoint item=Alarm_MasterTimeMins minValue=0 maxValue=600 step=5
}
}
Text item=Alarm_MasterTime icon="presence-off" visibility=[Alarm_Master==OFF] {
Frame label="Master Alarm" {
Switch item=Alarm_Master
Text item=Alarm_MasterTime
Setpoint item=Alarm_MasterTimeMins minValue=0 maxValue=600 step=5
}
}
}
So a little explanation. Basically you are specifying the alarm time as a number from 0-600 mins (i.e. 0-10 hours). The base time is midnight, so this corresponds to a time between midnight and 10am. Obviously very easy to change the Setpoint config in your sitemap to extend or restrict this. I have it set to 'step' in 5 min increments, but you could make this 15 mins to make it easier to quickly set coarse alarm times if you wanted.
Whenever you change the alarm time mins item using the Setpoint widget, the alarm time is calculated and a display item is updated, so you can show the nicely formatted alarm time in the sitemap. This item is not used for anything other than display.
The reason I have two frames for displaying the alarm details is so I can merge both the alarm switch and time items into one sitemap widget. So if the alarm is enabled I hardcode the presence-on icon and display the alarm time, if it is disabled I hard-code the presence-off icon. By doing this I can display the alarm time and have an icon showing the alarm state. Drilling down into that frame gives you the option to disable the alarm and change the time.
I am pretty happy with the end result - I can now easily change my alarm times via the UI and view the current time at a glance.