[SOLVED] Sending NTP time to KNX in OpenHAB2?

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.

1 Like

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)

Nice, the Item config provided by @Oggerschummer works.

Thanks!

1 Like

Hi,

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

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

Hi!
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:

2018-03-30%2016_08_05-Paper%20UI

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" }

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.

Cheers,

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:

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:

    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" ]
    }

Item:

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

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!

1 Like

Hi,
@whopperg

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

See Post above :slight_smile:
Greetings

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?

If anyone has still problems with making it work in Openhab 2.3 with NTP 2.3 and KNX 2.3, I have another solution.

I solved it by either set the ntp channel in the items channel definition to the end:

 { channel="knx:device:bridge:NTP:datetime", channel="ntp:ntp:local:dateTime"}

or

 { channel="knx:device:bridge:NTP:datetime, ntp:ntp:local:dateTime"}

or using “follow” profile

{ channel="ntp:ntp:local:dateTime",  channel="knx:device:bridge:NTP:datetime" [profile="follow] }

Hi,
I’m trying to replicate techniques presented here, but I’m missing something.
Here are my settings:

I defined virtual thing (I didn’t use datetime-control):

 Thing device Knx_virtual "KNX-virtual"  {
        Type datetime : date [ ga="11.001:2/1/2" ]
        Type datetime : time [ ga="2/1/1" ]
    }

item (time) definition:

DateTime Date  "Time [%1$tA, %1$td.%1$tm.%1$tY %1$tH:%1$tM]"  { channel="ntp:ntp:local:dateTime,knx:device:bridge:Knx_virtual:time" }

Thing is linked:

NTP service is running:

Time data is received and forwarded to Knx_virtual thing:

ETS device is linked:

I have restarted openhab in hope of that time is pushed to KNX bus when it is received first time- didn’t help.
How often is ntp time pulled from server?
I don’t understand why time is not pushed to KNX bus.
What am I missing?

Swap the ntp and the knx channel in your item definition, knx should be first.
And use the datetime-control. Use DP 10.001 for the time.
This works for me.

You define how often the time is pulled from the server and how often an update is sent within openHAB at the thing definition of the ntp binding.

Thanks- I got it working.
Although I don’t understand why knx order is required here.

Hello,

I Try this, but allways the Date is not written to the bus (BJ PowerNet)
The other part from, 7.15.240 is what the powernet controller sent, if open send it right i can dissable this.

I try with knx first and ntp first in the items, nothing will be send to 0/0/23, or will this happend only on 0:0 clock ?

items

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

things

Bridge knx:ip:bridge [
	type="ROUTER",
	readingPause=50,
	responseTimeout=10,
	readRetriesLimit=3,
	autoReconnectPeriod=1,
	localSourceAddr="1.0.0"
] {
	Thing device generic [
		address="1.2.3",
		fetch=false,
		pingInterval=300,
		readInterval=0
] {
	Type switch	: Licht_EG_Terrasse			"Licht Terrasse"				[ ga="0/0/1" ]
	
	}
	
	Thing device knx_virtual "KNX-virtual"  {
        Type datetime-control : date [ ga="11.001:0/0/23" ]
        Type datetime-control : time [ ga="10.001:0/0/22" ]
    }
}

eibd: vbusmonitor1

LPDU: BC 10 00 00 16 D4 00 80 92 3A 38 81 :L_Data low from 1.0.0 to 0/0/22 hops: 05 T_DATA_XXX_REQ A_GroupValue_Write 92 3A 38
LPDU: BC 7F F0 00 16 E4 00 80 92 05 00 29 :L_Data low from 7.15.240 to 0/0/22 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write 92 05 00
LPDU: BC 10 00 00 16 D4 00 80 92 05 00 86 :L_Data low from 1.0.0 to 0/0/22 hops: 05 T_DATA_XXX_REQ A_GroupValue_Write 92 05 00
LPDU: BC 10 00 00 16 D4 00 80 92 3B 06 BE :L_Data low from 1.0.0 to 0/0/22 hops: 05 T_DATA_XXX_REQ A_GroupValue_Write 92 3B 06
LPDU: BC 7F F0 00 17 E4 00 80 0E 02 13 A0 :L_Data low from 7.15.240 to 0/0/23 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write 0E 02 13
LPDU: BC 10 00 00 16 D4 00 80 92 3B 38 80 :L_Data low from 1.0.0 to 0/0/22 hops: 05 T_DATA_XXX_REQ A_GroupValue_Write 92 3B 38
LPDU: BC 7F F0 00 16 E4 00 80 92 06 00 2A :L_Data low from 7.15.240 to 0/0/22 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write 92 06 00
LPDU: BC 10 00 00 16 D4 00 80 92 06 00 85 :L_Data low from 1.0.0 to 0/0/22 hops: 05 T_DATA_XXX_REQ A_GroupValue_Write 92 06 00
LPDU: BC 10 00 00 16 D4 00 80 93 00 06 84 :L_Data low from 1.0.0 to 0/0/22 hops: 05 T_DATA_XXX_REQ A_GroupValue_Write 93 00 06
LPDU: BC 7F F0 00 17 E4 00 80 0E 02 13 A0 :L_Data low from 7.15.240 to 0/0/23 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write 0E 02 13
LPDU: BC 10 00 00 16 D4 00 80 93 00 38 BA :L_Data low from 1.0.0 to 0/0/22 hops: 05 T_DATA_XXX_REQ A_GroupValue_Write 93 00 38
LPDU: BC 7F F0 00 16 E4 00 80 92 07 00 2B :L_Data low from 7.15.240 to 0/0/22 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write 92 07 00
LPDU: BC 10 00 00 16 D4 00 80 92 07 00 84 :L_Data low from 1.0.0 to 0/0/22 hops: 05 T_DATA_XXX_REQ A_GroupValue_Write 92 07 00
LPDU: BC 10 00 00 16 D4 00 80 93 01 06 85 :L_Data low from 1.0.0 to 0/0/22 hops: 05 T_DATA_XXX_REQ A_GroupValue_Write 93 01 06

openhab log

2019-02-14 18:58:06.633 [vent.ItemStateChangedEvent] - Date changed from 2019-02-14T18:57:56.827+0100 to 1970-01-01T18:04:00.000+0100

2019-02-14 18:58:06.674 [vent.ItemStateChangedEvent] - Date changed from 1970-01-01T18:04:00.000+0100 to 2019-02-14T18:58:06.653+0100

2019-02-14 18:58:56.856 [vent.ItemStateChangedEvent] - Date changed from 2019-02-14T18:58:06.653+0100 to 2019-02-14T18:58:56.831+0100

2019-02-14 18:59:06.409 [ome.event.ItemCommandEvent] - Item 'Date' received command 1970-01-01T18:05:00.000+0100

2019-02-14 18:59:06.423 [nt.ItemStatePredictedEvent] - Date predicted to become 1970-01-01T18:05:00.000+0100

2019-02-14 18:59:06.451 [vent.ItemStateChangedEvent] - Date changed from 2019-02-14T18:58:56.831+0100 to 1970-01-01T18:05:00.000+0100

2019-02-14 18:59:06.483 [vent.ItemStateChangedEvent] - Date changed from 1970-01-01T18:05:00.000+0100 to 2019-02-14T18:59:06.459+0100

2019-02-14 18:59:56.872 [vent.ItemStateChangedEvent] - Date changed from 2019-02-14T18:59:06.459+0100 to 2019-02-14T18:59:56.842+0100

2019-02-14 19:00:06.301 [ome.event.ItemCommandEvent] - Item 'Date' received command 1970-01-01T18:06:00.000+0100

2019-02-14 19:00:06.322 [nt.ItemStatePredictedEvent] - Date predicted to become 1970-01-01T18:06:00.000+0100

2019-02-14 19:00:06.339 [vent.ItemStateChangedEvent] - Date changed from 2019-02-14T18:59:56.842+0100 to 1970-01-01T18:06:00.000+0100

2019-02-14 19:00:06.372 [vent.ItemStateChangedEvent] - Date changed from 1970-01-01T18:06:00.000+0100 to 2019-02-14T19:00:06.351+0100

2019-02-14 19:00:56.875 [vent.ItemStateChangedEvent] - Date changed from 2019-02-14T19:00:06.351+0100 to 2019-02-14T19:00:56.850+0100

2019-02-14 19:01:06.786 [ome.event.ItemCommandEvent] - Item 'Date' received command 1970-01-01T18:07:00.000+0100

2019-02-14 19:01:06.804 [nt.ItemStatePredictedEvent] - Date predicted to become 1970-01-01T18:07:00.000+0100

2019-02-14 19:01:06.829 [vent.ItemStateChangedEvent] - Date changed from 2019-02-14T19:00:56.850+0100 to 1970-01-01T18:07:00.000+0100

2019-02-14 19:01:06.870 [vent.ItemStateChangedEvent] - Date changed from 1970-01-01T18:07:00.000+0100 to 2019-02-14T19:01:06.840+0100

by

Try setting the local source address to 0.0.0, maybe this will help.

Can anyone help me here?