KNX migration to HA Version 2021.12 or later

With the release notes from 2021.12 I am not sure if I get it right…
“Enable newly added entities.” → Does it mean that all groupaddresses configured with ETS are automatically available in home assistant?

This feature would fascinate and scare me at the same time, I have over 90 “knx entities” configured in configuration.yaml… how does the migration process look like?

To test this feature I set up an installation on a Pi. Unfortunately I was not able to establish a connection. image

The logs content:
'Logger: aiohttp.server
Source: /usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py:405
First occurred: 7:24:04 PM (8 occurrences)
Last logged: 7:24:17 PM

Error handling request
Traceback (most recent call last):
File “/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py”, line 334, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File “aiohttp/_http_parser.pyx”, line 551, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message=“Bad status line ‘Invalid method encountered’”

Nothing is imported from ETS. This is just not possible.

There is none. Entities are still configured in configuration.yaml. Only the connection part is configured via UI.

Unfortunately this error occurs if you don’t have any entities configured in your configuration.yaml.

The posted log output has nothing to do with the knx integration - it does not use aiohttp.

Thanks for the response.
→ only connection via UI got it
→ it worked on the Pi after I created some entities
→ it worked on the Home Assistant OS
So this question is done :slight_smile:
By the way, I used the blueprint knx-relative-dimming-for-lights.yaml
It worked on 2021.11, but the reload of the KNX integration killed the blueprint, a restart of home assistant was necessary. With the update to 2021.12 the blueprint didn’t work, so I got back to the default automation… any idea where to improve the blueprint to make it stable? I liked the idea and it was very easy to configure.

Well, it still can’t survive any knx Integration reloads. One is triggered when you finish an option_flow (integration configure button).
But tbh I did not ever use it myself and didn’t test it with 2021.12

What do you mean by “default automation”?
The parts that break are the register_exposure and register_event services. When these are configured in yaml (expose and event key) a blueprint would be possible again - but then the blueprint would have prerequisites which to avoid was the whole point.

“default automation” means i use an automation, trigger the state change of the knx entity, the action is a light.turn_on / light.turn_off on the hue entity…

alias: Auto Licht OG Zimmer Nord AUS
description: KNX Status AUS zu Hue Leuchten
trigger:
  - platform: state
    entity_id: light.og_zimmer_nord_decke
    from: 'on'
    to: 'off'
condition: []
action:
  - service: light.turn_off
    target:
      entity_id: light.og_zimmer_nord_decke_lichtgruppe
    data: {}
mode: single

not the smartest way because it needs 3 automations:
the left knx button for ON/OFF:

  • turn on light 100%
  • turn off light 0%

the right knx button for DIM (fix value):

  • turn on light 50%

I understand the idea of having no prerequisites for a blueprint. I personally prefer a stable reload, I will try to create a solution on the weekend.

Cool! If you need any help or information join us at xknx Discord

You can always combine them by using trigger ids or using choose like in my blueprint. But it won’t change anything regarding the logic.
Are you using a “bogus” light entity for this or is this a mixed knx/hue installation in that room?

we can leverage

platform: event
event_type: service_registered
event_data:
  service: event_register

additionally to

  - platform: homeassistant
    event: start

to register again after a reload. I’ll look into updating the blueprint for that.

I am using knx wall switches in every room. Some rooms have dali downlights other have hue lights. The knx wall switch indicates the status on the integrated led and has to switch sometimes several hue lights. To ensure that any trigger source (knx switch, hue app, home assistant dashboard) is handled correctly i use knx entities that switch a light group that contains the hue entities. For the feedback if the trigger comes from the hue app I expose the light group status to the knx entity. I am preparing a documentation of this solution and will publish it.

this solution takes a bit time for the commissioning, but it is easy to understand and works with standard home assistant components.

Ok, thank you for the hints.

At the start of home assistant (platform: homeassistant; event: start)
if a new service is registered (event_type: service_registered)
call service event_register (service: event_register)???

Can you elaborate the idea a bit?

see the updated version of the Blueprint KNX - relative dimming for lights blueprint · GitHub
the service_registered event is not called on HA startup for whatever reason, but on each KNX integration reload. Both trigger the same trigger_id which (“initialize” step) which sets up the knx integration to listen for events on the configured GAs.

Thats great :+1:

In the past, i have added all the knx devices in the configuration.yaml file. And this worked fine.

It seems that changing something in the configuration.yaml. file (like the name of a knx device) is not read/changed anymore. Even not after a reboot of the host. But it seems OK when you change the name in the GUI of the knx integration.

My problem: I have added a new knx device in the configuration.yaml file (+ reload integration + reboot host) It seems that this new device (in the switch domain) is not added or available. The new device does not show up in the developers tools - service. Nor in the nodered devices.

What should i do to add a new knx device?
Ps: “enable newly added devices” is turned on.

Yes this is the case since 2021.4 - the name key is just used for initial creation, then the HAs EntityRegistry takes over - so you can change the friendly_name and entity_id (only) from UI.

I guess you mean “states”, not “service”. Check your logs - most probably there is some syntax error in the configuration.yaml that prevents it from loading. Open your Home Assistant instance and show your Home Assistant logs. If there is nothing noticeable please share your yaml here (don’t forget code tags ```).

Thank you for your fast answer.

I had a conflict in the configuration file, using twice the same address.
The log file tells me that KNX is ignoring one device because he could not create a unique id.

The configuration file has been corrected. By changing an adress and by adding a new device.

But In the GUI I don’t see the possibility to change a group adress, only names are appearing
And in the GUI, I don’t see a button “add new device”.
In the GIU I cannot delete conflicting devices. I get a message “0 can be deleted …”

So how can I solve my problem? Changing an existing adress from 3/1/7 to 3/1/17 and adding a new device with the adress 3/1/7?

Is it a good idea (no risk) to delete the complete knx integration from “configuration - integrations”? After a reboot, will HA again populate his regsitry with all the devices that are available in the configuration file?

Right, none of this is possible. GAs are solely configured in yaml.
HA devices are not supported by the KNX integration, only entities are.

I fail to understand What exactly your problem is.

That’s a safe operation, but it won’t clear the entity registry.

Maybe have a look at KNX - Home Assistant

Thank you

My problem is solved.
I deleted the “knx integration” + reboot host
The knx integration appeared again and all the devices were present. Also the device for which I previously had a conflict.

PS: I lost the indication of the area of each knx device, but this is only a detail.

I love home assistant!
And I love all these great contributors :grinning:

1 Like