[FIXED] Sending NTP time to KNX in OpenHAB2?

Tags: #<Tag:0x00007f15d6b00fc0> #<Tag:0x00007f15d6b00e30> #<Tag:0x00007f15d6b00cf0>

(Toby) #1


the old NTP binding could be configured to automatically send time updates to KNX using:

DateTime    Date    "Date and Time: [%1$tA, %1$td.%1$tm.%1$tY %1$tT]"  (Status)    { ntp="Europe/Berlin:de_DE", knx="11.001:15/7/2, 10.001:15/7/1" } 

Since there is no KNX2 binding yet and the new clearer concept of thing configuration would not easily permit such a config, how can I achieve the same result in OpenHAB2 using NTP2 and KNX1 bindings?

So far I tried different rule approaches similar to

rule "Time to KNX"
	Time_Local received update
    logDebug("toby", Time_Local.state as string)
    sendCommand(KNX_Time_Date, Time_Local.state)

with the items

DateTime Time_Local "Date & Time [%1$td.%1$tm.%1$tY %1$tT]" { channel="ntp:ntp:local:dateTime"  }
DateTime KNX_Time_Date { knx="0/4/0" }

but the rule does not even trigger.

Can anyone give me a hint?

Thanks in advance,

Time to KNX
(SiHui) #2


Item Time_Local received update

(Oggerschummer) #3

Try this, no need for a rule:

DateTime ntpDate  "Date  [%1$td.%1$tm.%1$tY %1$tH:%1$tM]" {channel="ntp:ntp:62f71a5f:dateTime",knx="10.001:6/6/6,11.001:7/7/7"}

This puts the time received from NTP onto the date / time knx group adresses. You need to adjust the channel (copy id from paper ui) and group addresses to fit to your needs.

Hope this helps.

(Toby) #4

Well, sometimes you just needs someone looking over your shoulder to spot obvious bugs. Thanks! (This did not fix the actual problem but made the rule run at all)

(Toby) #5

Nice, the Item config provided by @Oggerschummer works.


(Aike Terjung) #6


i am returning to OpenHAB2 after a few month - now with Version 2.2 i cant find the channel-ID in the paper-ui, i am sure it was there the in the past? Where do i find it now?

thanks in advance

(Oggerschummer) #7

Goto “Things”, click on the thing. There you have the channels and their IDs.

(Whopperg) #8

With the new KNX2 Binding, you could just do everything in PaperUI:

Create a KNX Dummy Device, add a channel with your Date and Time GA’s (for example 10.001:1/1/1 for Time,and 11.001:2/2/2 for date) and link it to your NTP DateTime item.

NTP Thing and Channel:



DateTime Date "Datum und Zeit: [%1$tA, %1$td.%1$tm.%1$tY %1$tT]" { channel="ntp:ntp:local:dateTime,knx:device:c52e1fea:knx_date,knx:device:c52e1fea:knx_time" }

thinkerd about this for a long time, but as you see the solution is way to easy :slight_smile:

I just leave this here if someone need this.


(Whopperg) #9

Well, that didnt work… I got too excited and didnt check if it actually working - which it isnt…

I cannot get openhab to send the date and time to the bus… even with a manually (text based) item…

DateTime		Date	"Datum und Zeit: [%1$tA, %1$td.%1$tm.%1$tY %1$tT]"	{ channel="ntp:ntp:local:dateTime", channel="knx:device:c52e1fea:knx_date" }

So any other hints and tipps are welcome :wink:

(Kai Kreuzer) #10

I cannot help you with DateTime on KNX as I am using separate Date and Time GAs on my KNX bus (which are both linked to an DateTime item). For everyone who does that as well, here’s my setup:


    Thing device knx_virtual "KNX-virtual"  {
        Type datetime-control : date [ ga="11.001:0/7/11" ]
        Type datetime-control : time [ ga="10.001:0/7/10" ]


DateTime Date { ntp="Europe/Berlin:de_DE", channel="knx:device:ip:knx_virtual:date,knx:device:ip:knx_virtual:time" }

(Whopperg) #11

Thank you Kai!
I’ll guess you cant have two or more GA’s for one channel then?

Just to document the fix here:

Create to Channels as DateTimeControl, one for each GA (as Kai explained) and link them together in one item:

DateTime Date "Datum und Zeit: [%1$tA, %1$td.%1$tm.%1$tY %1$tT]" { channel="ntp:ntp:local:dateTime,knx:device:c52e1fea:knx_date,knx:device:c52e1fea:knx_time" }

So close :wink:
I also updated my original post with the fix…

Again, thanks Kai!

(Andy) #12


how do you practically link the KNX with the NTP channel in the paper UI?

(Whopperg) #13

See Post above :slight_smile:

(Andy) #14

Okay thanks,
tried to implement.
Do you know how often i.e. in which interval with this approach the time is written on the KNX bus?