Sending NTP time to KNX in OpenHAB3?

openHAB is one Standalone Raspi with ip 192.168.1.34 band i have one Standalone Raspi with linux and knxd as KNX TUNNEL with adr. 0.0.128 and ip 192.168.1.28

Then your openHAB is sending via your knxd-raspi the updates.
either via some rules - or as @Oggerschummer said, you have set your NTP to 1sec, then of course it will update the KNX every second.

ok there is refreshinterval 60s

`Thing ntp:ntp:germany  
       [ hostname="ntp1.fau.de", 
       refreshInterval=60, 
       refreshNtp=30, 
       timeZone="Europe/Berlin", 
       locale="de_DE" ]`

So after some Testing of Settings and Devices, i updated my old raspi with eibd to knxd!
Here i found the problem i solved later:

EIBD_OPTIONS="-d -D -T -R -S -i -u --eibaddr=0.0.128 tpuarts:/dev/ttyAMA0"

the knxd options are different:

--eibaddr=0.0.128 --client-addrs=0.0.129:8 -D -T -R -S -i --listen- local = /tmp/knx -t 1023 -b tpuart: /dev/ttyAMA0

Here we have clientadress

and in the knx.things i have to change to adress 0.0.136 (128+8 adress for clients)

and now it works like charme!!

Hello,
I have recently “reactivated” OH and moved to OH3 …

I’m struggling to get the NTP time to the bus following exactly the steps described here.
I have created the two things (ntp and knx).
I have then created the item and linked it to the ntp time channel.

However, I cannot add the additional ‘follow’ channel link … as a matter of fact no selectable channel appears in the “Link Channel To Item” screen

did you follow the guide here:

works perfecxtly with me. If there’s still problems, please post your config and some log-entries for this

Thomas,
as described, I tried to do exactly that:



I get stuck at the last step of adding the ‘follow’ channel link to the item, as I cannot select any ‘channels’ for the time Thing.

Really sorry to come up with such a basic problem.

1 Like

I think the new UI does not allow that, you must come from the other direction - start from the Thing, link to your existing Item, add the profile to the link.

click here on the channel NTP local Time and chose following in the Profile section

I still have the same problem … doing it the ‘other way’.

I deleted the Item I had previously created and created a new item linked to the NTP DateTime channel (not the string one).

When I then try to link that Item, starting from the time channel of the KNX DateTimeWrapper Thing …

The same problem occurs … No Existing Item can be linked …

It can be done - see here

but what the secret is I could not say.

What happens if you paste in the Item name (not label)? NTPLocalTime_DateHeure

The fact that you are running into difficulty both when you try this from the item page and from the thing page leads me to suspect that the UI is somehow choking on some aspect of your configuration.

Are there any errors in browser console when you try to bring up Existing Items dialog?

OK, I’ worked this out from scratch again, so here is the guide for setting it up in MainUI for OH3:

First create the virtual KNX thing, here is the YAML:

UID: knx:device:MDTSecureGateway:VirtualDateTimeWrapper
label: KNX Virtual DateTime Wrapper
thingTypeUID: knx:device
configuration:
  pingInterval: 600
  readInterval: 0
  fetch: false
bridgeUID: knx:ip:MDTSecureGateway
location: UV
channels:
  - id: knxDate
    channelTypeUID: knx:datetime-control
    label: knxDate
    description: null
    configuration:
      ga: 11.001:6/0/4
  - id: knxTime
    channelTypeUID: knx:datetime-control
    label: knxTime
    description: null
    configuration:
      ga: 10.001:6/0/1
  - id: knxDateTime
    channelTypeUID: knx:datetime-control
    label: knxDateAndTime
    description: null
    configuration:
      ga: 19.001:6/0/3
  - id: knxNight
    channelTypeUID: knx:switch-control
    label: Night Switch
    description: null
    configuration:
      ga: 6/0/2

Remember to set your correct bridge ID and to adjust the knx group addresses (6/0/x) to something you are using in ETS!

After this create an item for e.g. channel knxDateTime like this:

Do not forget to set the Type to DateTime.

Create the NTP Thing, code as follows, with refresh interval of 10 seconds (whatever pleases you, but e.g. 600 should be enough):

UID: ntp:ntp:local
label: Lokale Zeit
thingTypeUID: ntp:ntp
configuration:
  timeZone: Europe/Berlin
  hostname: time.windows.com
  serverPort: 123
  refreshInterval: 10
  refreshNtp: 30

Link the dateTime Channel to the item you just created:

No need for the “follow” profile.

Now the DateTime data appears on the knx bus every 10 seconds, check with the group address monitor:

Hope this clarifies things.

Enjoy :slight_smile:

5 Likes

Comment - that’s the magic part that replaces the follow profile, by reversing the flow of the usual channel-to-Item commands/update interaction.

Exactly. If you have a control-channel and add it with a follow profile, you reverse the flow twice and nothing happens.

Thomas,
thanks it does work with the approach in post 36!

There is a different ntp host then before. Just out of curiosity, why is that?

channelTypeUID: knx:datetime-control

It seems to me that this was already part of the original code, maybe that’s why it didn’t work together with the “follow” profile.

Anyway thanks a lot!

I just grabbed the ntp host that came to my mind first, thats all.
Glad it did work out for you.
Have a nice evening.

Works great. With this approach it seems that the time/date is sent to KNX every minute. Is there an easy way to limit it, eg. to every 5 minutes?

Checkout the NTP Thing YAML - the refresh intervall is set to 60 seconds, you may vary this to e.g. 300 seconds.

1 Like

Why is time and datetime working - but date is not working as expected?

The DPT of date is always 10.001 - even if configured to 11.001:

image