KNX expose Time not working

Hello there,

I’m trying to figure out how to expose time or date to knx because my Meteodata Weatherstation has no internal clock and needs this information to determine the elevation and azimut of the sun, so it can calculate the correct position of the covers. It is possible to tell the device to send a bit to a specific adress to get a the current time. Unfortunately the device does not simply ask on the adress of the time object 1/0/10 via GroupValueRead like other KNX devices.

My Hardware configuration is as follows:

  • HA running on a raspberry 4b (Home Assistant Operating System)
  • Home Assistant 2022.4.6
  • supervisor-2022.04.0
  • Elsner KNX PS640-IP
  • Theben Meteodata 140 S 24V
  • Logging for knx is enabled (and working):
logger:
 default: critical
 logs:
   xknx.telegram: debug

This is what i tried before posting my question:
At first, simply following the documentation: https://www.home-assistant.io/integrations/knx/#exposing-entity-states-entity-attributes-or-time-to-knx-bus

My entry in configuration.yaml:

knx:  
  expose: 
    - type: date  #also tried datetime
      address: "1/0/11"
    - type: time
      address: "1/0/10"

This has no effect, neither in the HA serverlogs nor in ETS Groupmonitor there is any entry for date or time. As I read in other threads, there should be one entry on startup and one entry every hour.

Then i tried to set the Date and Time manually in ETS, output in Groupmonitor:


Unfortunately there is no entry in the HA logs after this step.

My next try was to figure out if i could set up an automation to send any time to knx bus. This seems to be impossible as there is no 3byte DPT in HA.
So I went the other way round and set up an automation which requests the time every 5 minutes (for test purposes only) and triggers Homeassistant to answer:

alias: KNX Uhrzeit senden
description: >-
  Schickt an 1/0/10 und 1/0/11 ein Groupvalueread damit Homeassistant mit Zeit
  und Datum antwortet.
trigger:
  - platform: time_pattern
    minutes: '5'
condition: []
action:
  - service: knx.read
    data:
      address: 1/0/10
  - service: knx.read
    data:
      address: 1/0/11
mode: single

The Log entry is as follows:

2022-04-24 12:05:00 DEBUG (MainThread) [xknx.telegram] <Telegram direction="Outgoing" source_address="0.0.0" destination_address="1/0/10" payload="<GroupValueRead />" />

2022-04-24 12:05:00 DEBUG (MainThread) [xknx.telegram] <Telegram direction="Outgoing" source_address="0.0.0" destination_address="1/0/11" payload="<GroupValueRead />" />

2022-04-24 12:05:00 DEBUG (MainThread) [xknx.telegram] <Telegram direction="Outgoing" source_address="1.1.237" destination_address="1/0/10" payload="<GroupValueResponse value="<DPTArray value="[0xec,0x5,0x0]" />" />" />

2022-04-24 12:05:00 DEBUG (MainThread) [xknx.telegram] <Telegram direction="Outgoing" source_address="1.1.237" destination_address="1/0/11" payload="<GroupValueResponse value="<DPTArray value="[0x7a,0x4,0x18,0xec,0x5,0x0,0x21,0x80]" />" />" />

Obviously this is working as excpected, Homeassistant can get triggered by itself…
Needless to say this has no effect in the world of KNX, knx telegram is not showing up in Groupmonitor, the time on the Meteodata remains not defined.

It seems there is no communication between HA and KNX when time or date should be sent.

Now i’m stuck, i have no idea what i could possibly try or what i could have missed out.
All other KNX Devices (about 200 Groupadresses or more, sensors, binary sensors, switches, covers) work properly within Homeassistant (both directions). Before moving to Homeassistant i used FHEM, there was a simple oneliner tor configure sending time every hour.

Does anybody have an idea what to try or where i made a mistake?

Hi :wave:!
It’s a known bug that should be fixed with 2022.4.7
See knx tunneling connection loss - time/date no longer exposed - reconnect should not trigger automation · Issue #69328 · home-assistant/core · GitHub

If there remains to be some bug please open an issue on GitHub :+1:

Hi,

Thank you for your Response, I will post my issues there if there is no change in the behavior of HA after the update.

My Problem is similar to the one on gitub, but the difference is, i get not even one time telegram.

Haha, what a clever idea! It never came to my mind that this would be an option :smiley:
This should however also just work fine. It’s really awkward that it shows in xknx.telegram log but not in ETS Group Monitor. Maybe try and see if it reaches xknx.knx logger too (instead of xknx.telegram - or use both) - this is one level further down the line - right when the socket sends out the Telegram.

Let’s see if the next patch release fixes it… maybe this is something else :thinking:
Are you using Tunneling or Routing?

I had the samet thoughts about logging after reading the issue on Github so i changed the loglevel simply to xknx: debug so there is much more to see

The patch applied just an hour ago, but there is a first small archievement we’ve reached:
On server startup the time is sent to knx. :grinning:
Whats not so good: The Telegram does not show up in Groupmonitor :roll_eyes: and there is an Error message.

2022-04-25 14:52:01 DEBUG (KNX Interface) [xknx.knx] Sending to 192.168.3.197:3671 at 1650891121.784727:
<KNXIPFrame <KNXIPHeader HeaderLength="6" ProtocolVersion="16" KNXIPServiceType="TUNNELLING_REQUEST" Reserve="0" TotalLength="24" />
body="<TunnellingRequest communication_channel_id="97" sequence_counter="1" cemi="<CEMIFrame SourceAddress="IndividualAddress("1.1.236")" DestinationAddress="GroupAddress("1/0/10")" Flags="1011110011100000" code="L_DATA_REQ" payload="<GroupValueWrite value="<DPTArray value="[0x2e,0x33,0x3b]" />" />" />" />" />
2022-04-25 14:52:01 DEBUG (KNX Interface) [xknx.raw_socket] Received from ('192.168.3.197', 3671): 06100421000a04610100
2022-04-25 14:52:01 DEBUG (KNX Interface) [xknx.knx] Received from 192.168.3.197:3671 at 1650891121.7872713:
<KNXIPFrame <KNXIPHeader HeaderLength="6" ProtocolVersion="16" KNXIPServiceType="TUNNELLING_ACK" Reserve="0" TotalLength="10" />
body="<TunnellingAck communication_channel_id="97" sequence_counter="1" status_code="ErrorCode.E_NO_ERROR" />" />

E_NO_ERROR seems very generic.
I looked for more errors and they are there.
After startup there are about 150 messages with status_code="ErrorCode.E_NO_ERROR"
The first one is immediatly before the connection is established:

2022-04-25 14:51:58 DEBUG (KNX Interface) [xknx.knx] Sending to 192.168.3.197:3671 at 1650891118.4211006:
<KNXIPFrame <KNXIPHeader HeaderLength="6" ProtocolVersion="16" KNXIPServiceType="CONNECT_REQUEST" Reserve="0" TotalLength="26" />
body="<ConnectRequest control_endpoint="192.168.3.180:39547/udp" data_endpoint="192.168.3.180:39547/udp" request_type="ConnectRequestType.TUNNEL_CONNECTION" />" />
2022-04-25 14:51:58 DEBUG (KNX Interface) [xknx.raw_socket] Received from ('192.168.3.197', 3671): 06100206001461000801c0a803c50e57040411ec
2022-04-25 14:51:58 DEBUG (KNX Interface) [xknx.knx] Received from 192.168.3.197:3671 at 1650891118.4258618:
<KNXIPFrame <KNXIPHeader HeaderLength="6" ProtocolVersion="16" KNXIPServiceType="CONNECT_RESPONSE" Reserve="0" TotalLength="20" />
body="<ConnectResponse communication_channel="97" status_code="ErrorCode.E_NO_ERROR" data_endpoint="192.168.3.197:3671/udp" request_type="ConnectRequestType.TUNNEL_CONNECTION" identifier="4588" />" />
2022-04-25 14:51:58 DEBUG (KNX Interface) [xknx.log] Tunnel established communication_channel=97, address=1.1.236

This makes me think there is an issue with my connection, too.
On the other Hand: Why are the only visible issues (I would not really care about errors in a logfile if everything works as expected) with the types Date and Time and none of the other.
Connection type is tunneling, this was configured by default, i did not change anything because it worked for all other purposes.

this means literally “no error” - which is a good thing :wink:

The interface ACKed your telegram so it was received - from there on its not HAs / xknx’ thing anymore.

Do you have multiple KNX lines? Which interface do you use to connect ETS Group monitor? Maybe the GA is filtered by a line coupler or a router?

my fault. As it was highlighted from the logviewer in HA, I thought it means something like unknown or there is no number for this error :rofl:

But with this knowing i made futher experiments and i have good news. The date and time is definitively sent to knx and is also recognized. It just does not show up in Groupmonitor. I verified through disconnecting the weatherstation from Bus so it loses the current date/time, then reconnected (verified the sun position ist not correct) and restarted homeassistant. The weatherstation calculates the correct sun position after that, so i assume it got the time.

So i think, the problem was the known bug you described in your first post and is fixed now. Thank you for your help and knowledge.

1 Like

I am having touble to expose the localtime of HA to my KNX Bus.
The Expose-Configuration is pretty simple:

# Current time
- type: time
  address: 8/0/0

The GA looks like this:
Screenshot 2022-07-19 183343

Looking into the logs, everything seems fine to me:

2022-07-19 16:24:16 DEBUG (KNX Interface) [xknx.raw_socket] Received from ('192.168.178.118', 3671): 061004200018046500002e00bcd011de4000040080501810
2022-07-19 16:24:16 DEBUG (KNX Interface) [xknx.knx] Received from 192.168.178.118:3671 at 1658247856.3773232:
 <KNXIPFrame <KNXIPHeader HeaderLength="6" ProtocolVersion="16" KNXIPServiceType="TUNNELLING_REQUEST" Reserve="0" TotalLength="24" />
 body="<TunnellingRequest communication_channel_id="101" sequence_counter="0" cemi="<CEMIFrame code="L_DATA_CON" src_addr="IndividualAddress("1.1.222")" dst_addr="GroupAddress("8/0/0")" flags="1011110011010000" tpci="TDataGroup()" payload="<GroupValueWrite value="<DPTArray value="[0x50,0x18,0x10]" />" />" />" />" />
2022-07-19 16:24:16 DEBUG (KNX Interface) [xknx.knx] Sending to 192.168.178.118:3671 at 1658247856.3774853:
 <KNXIPFrame <KNXIPHeader HeaderLength="6" ProtocolVersion="16" KNXIPServiceType="TUNNELLING_ACK" Reserve="0" TotalLength="10" />
 body="<TunnellingAck communication_channel_id="101" sequence_counter="0" status_code="ErrorCode.E_NO_ERROR" />" />

But the value never really reaches for example my LED Actor and the group monitor show something that is not the time :slight_smile:


Any ideas?

The telegram you showed here is from a different device - it has a different IA than in the HA logs (1.1.222).
Also ETS GroupMonitor is decoding that as DPT 9 - there may be some misconfiguration.

My expose configuration is pretty similar and works fine to set time on my keypads


asking for the value in group monitor also shows me the correct information

Response properties

As far as I understand the documentation HA will not actually broadcast the time but will answer requests for that value.

It does both. Sending every hour and answering requests.

Documentation should be updated to make that clear :grimacing:

1 Like