KNX Datetime from openhab

Hi all,

does anybody send the current Datetime to the KNX Bus? I tried but failed :frowning:

Extesive discussion -

1 Like

Sure, easy:

UID: knx:device:bridge:generic
label: Generic Channels
thingTypeUID: knx:device
configuration:
  pingInterval: 600
  readInterval: 0
  fetch: false
bridgeUID: knx:ip:bridge
channels:
  - id: time
    channelTypeUID: knx:datetime-control
    label: Uhrzeit und Wochentag
    description: ""
    configuration:
      ga: 10.001:15/7/10

As openHAB is the “owner” of the status, use datetime-control. My devices have week timers (Wall switches) and they need a DPT 10.001. As these Channels are “property” of openHAB, the device must not have an address.

1 Like

Hi all. I am also trying to send, like once a day, the current time onto the KNX bus. Udo what you posted, if I understand correctly, shows the channel definition only. So one would then need to combine this with some kind of rule that actually sends the time over that channel periodically, right?

Yepp, that’s correct.

Complete as text configuration:
my.things:

Bridge knx:ip:bridge "knx/IP Interface" [ 
    ipAddress="192.168.178.45", 
    localIp="192.168.178.55", 
    type="TUNNEL"
 ] {
    Thing device Virtuell "virtuelle" @ "KNX" [ 
     ] {
        Type datetime-control : wochenzeit "Zeit und Tag" [ ga="10.001:15/7/10" ]
    }
}
Thing ntp:ntp:local "Lokale Zeit" [
    hostname="192.168.178.1",
    refreshInterval=120, 
    refreshNtp=30, 
    locale="de_DE", 
    timeZone="Europe/Berlin"
]

my.items:

DateTime LokaleZeitDateTime "Datum: [%1$tA, %1$td.%1$tm.%1$tY %1$tH:%1$tM]" <time> (gOhne) ["Status","Timestamp"] {channel="ntp:ntp:local:dateTime", channel="knx:device:bridge:Virtuell:wochenzeit"}
String   LokaleZeitString   "Datum und Zeit"                                <time> (gOhne) ["Status","Timestamp"] {channel="ntp:ntp:local:string"}

The ntp Addon will update the Item once every 120 Seconds. Every 30th Update it will issue a request to the ntp server (here the local router).
Every update of the Item will cause an update of the linked control-channel as well.

Works like a charm, thanks!

BTW for all people who - like me - need a separate date and time item as well, I defined my Thing as:

    Thing device env "Umgebung" [
//        readInterval=3600
    ] {
        Type datetime-control : DatumUhrzeit "Uhrzeit und Datum"        [ ga="19.001:0/0/2" ]
        Type datetime-control : Datum "Datum"                           [ ga="11.001:0/0/4" ]
        Type datetime-control : Uhrzeit "Uhrzeit"                       [ ga="10.001:0/0/6" ]
   }

and my Item simply as:

DateTime LokaleZeitDateTime "Datum und Uhrzeit [%1$tA, %1$td.%1$tm.%1$tY %1$tH:%1$tM]" <time> ["Status","Timestamp"] {channel="ntp:ntp:local:dateTime", channel="knx:device:bridge:env:DatumUhrzeit", channel="knx:device:bridge:env:Uhrzeit", channel="knx:device:bridge:env:Datum"}