Editable DateTime in Sitemap?


I’m trying to build an alarm clock, fading in lights when I should wake up. My idea was this:

  • Have a DateTime item that represents the time I want to get up (just a ‘time’ item would be even better…)
  • Build a rule that starts a script when the respective time is close, with the script fading up the lights
  • Have some way in the UI to set that DateTime item

I’m fairly sure I can do point 2, but what about point 3? Are there any widgets that allow manipulation of DateTime items? So far it seems like you can only display them with the “Text” widget…?

Thanks a lot,

I spent some time looking and I think this is a use case that is not easily achievable in openHAB. The problems I see:

  1. You can have a DateTime Item that represents the time you want to get up but there is no way to get that item to generate an event to trigger a rule by itself. What you would have to do is have a rule run once a minute using a Time cron trigger and see if the time matches (throwing out the seconds of course) and executing your wakeup logic then.

  2. I can find no way to enter text into the openHAB GUI. You can get around this by creating your own “Alarm” GUI and push the new time to your DateTime Item through the REST API. You can also experiment with the Slider element of the sitemap and create a rule to map the position of the slider to a DateTime and populate the alarm time Item from a rule. It isn’t a perfect mapping though and keeping the UI in sync with the slider and the actual DateTime will be a major challenge. I don’t think you could do it on one line.

I am not sure it fits your requirements 100% but I know that @ben_jones12 came up with a proposal (actually a working example, I think) in this post (old Google groups):


1 Like