This page last changed on Oct 11, 2011 by mredeker.

Based on the discussion here I started to implement a DateTime protocol. I am thinking about the following:

DateTime commands can be used to display date or time on the console or use certain DateTime events to trigger rules.
To calculate sunrise and sunset the location has to be given as longitude, latidude and timezone.
Timezone is the string identifier which is available in Java eg. Europe/Berlin

The following commands will be available:

  • date (returns a date/time as string depending on the given formatter)
  • sunrise (returns the sunrise time as string depending on the given formatter)
  • sunset (returns the sunset time as string depending on the given formatter)
  • minutesUntilSunrise (returns an integer with the minutes until sunrise)
  • minutesUntilSunset (returns an integer with the minutes until sunset)
  • isDay (returns a boolean string)
  • isNight (returns a boolean string)

Other DateTime based information (something like isWeekend, isWeekday, isHoliday) could be added.

To create a command which display the time you would design it with these parameters:

command = date
timezone = Europe/Berlin
format = HH:mm:ss

Or if you want to display date and time you would use:

command = date
timezone = Europe/Berlin
format = dd.MM.yyyy HH:mm:ss

Any ideas and comments are appreciated.

Marcus,

Fits perfectly my needs. Nothing to add.

Rick

Posted by rickcn at Oct 11, 2011 14:30

Hallo Marcus,

you are talking about KNX, and nothing but KNX, right? In a world with NTP I cannot really make sense of it otherwise.

Please allow me to recommend the Sunrise-Sunset Library in Java by Mike Reedell. It does everything you want, including sunrise/sunset for arbitrary declinations (not just the official ones), it is written in Java, is free ("open source") software under the Apache License. (I have even submitted a patch to it once), It lowers my external blinds every evening when the sun is exactly 3° under the horizon. Since years..,

Posted by barf at Oct 11, 2011 17:14

That is exectlay the library I am using

And no, I am not talking about KNX. It's based on the time the controller has (which would probably be NTP) and to use that to either fill label fields on console our use it as events for the rule engine eg. if movement and isNight then turn light on.

Posted by mredeker at Oct 11, 2011 17:29

A first version is checked-in under my SVN workspace directory in a subdirectory called "Controller_EP_SNAP_DateTime_WOL".
This will probably make it into the 2.0 release.

Posted by mredeker at Oct 13, 2011 16:33

Is there a way to use DateTime Protocol to start a counter? For example, when a user pushes a button on the GUI (to turn on a light), a counter starts to display how long that light has been on. Then when the light is turned off, the counter stops.

Posted by brandoncreel at Jun 27, 2013 16:34

Sounds more like a rule

Posted by mredeker at Jun 27, 2013 20:01
Document generated by Confluence on Jun 05, 2016 09:30