Table of Contents
- Lights and switches without a feedback object
- Listening on addresses Home Assistant does not send to
- The ETS export as a data source
- Excluding shutters from a central command
- Room controllers: what Home Assistant writes and what they report
- A gateway that answers from its own cache
- Frequently asked questions
The house runs on KNX with Home Assistant on top: 11 JUNG room controllers, 43 shutters, about 80 lights and switches, window contacts and the motion sensors behind my motion sensor automations. Since September a second instance on a Hetzner VM has been connected to the same bus next to the old one, as described in running old and new in parallel, and comparing the two entity by entity showed how much of what Home Assistant displays about KNX devices it has no way of knowing. The numbers below come from my migration journal, and where I have written a longer post on a problem, the section links it.
Lights and switches without a feedback object
The first comparison matched 51 of 51 lights and only 16 of 29 switches. 25 switches had no status object, most of them older ones created in the UI, which I later moved into YAML as described in KNX switches from the UI to knx.yaml. Home Assistant knew their state only when it saw a switching command. Guessing their status addresses from the lights' naming pattern would have been wrong, because the pattern breaks for exactly these switches, and a guessed address eventually shows a wrong state.
The switch actuators behind 52 lights and switches have no feedback object in their application program, but the switching object itself can be made readable. I set the read flag on each object Output n, Switching in ETS and partially programmed the actuators, and each entity in Home Assistant got that switching address as its state address. 52 of 52 answered the read test. The bulk change had also flagged nine objects that should not answer, central functions among them, and only one object per group address should answer. I cleared the read flag on those nine objects again, and a script compared the new export with the old one: 9 flags changed, no link and no device changed.
Listening on addresses Home Assistant does not send to
33 of 43 shutters showed unknown on both instances. The actuators' application programs explain why: 39 shutters hang on actuators whose application programs have no status or position object at all, every relevant object only has the flags C and W, so position feedback for them would need different hardware. Four motors on actuators from a second manufacturer have a position status object that is not linked yet.
Without feedback Home Assistant estimates the position from command and travel time, and it only saw each shutter's own address, while most movements in the house come from central commands per floor or for the whole house. The KNX integration takes a list for the two command fields below: Home Assistant sends to the first address and listens to the others.
# knx.yaml (all group addresses are placeholders)
cover:
- name: "Shutter one"
# the first address is sent, every further address is only listened to
move_long_address: ["9/0/1", "9/0/90", "9/0/91"]
move_short_address: ["9/1/1", "9/1/90", "9/1/91"]
travelling_time_down: 45
travelling_time_up: 45The script updated 41 of the 43 shutters, adding one to five addresses to each movement-command field, 82 fields in total; it changed only the Home Assistant configuration, nothing on the bus. When someone pressed the ground floor button the next morning, the 19 ground floor shutters that had been unknown showed open within two minutes, and the shutters upstairs stayed as they were. The details are in KNX covers without position feedback.
The ETS export as a data source
Both scripts read the ETS export. A .knxproj file is a ZIP, and besides group addresses and links it contains the manufacturer's complete application program as XML for every device in use, with every communication object and its flags, used in the project or not. Hardware.xml maps each device to its program, and no manufacturer plugin is needed. An object with only C and W receives, and feedback needs T for transmit or R for read.
My first parser had two bugs. Object ids are only unique within one program, so the lookup has to go through each device's own program. Wall buttons also have objects for a long press, and while the parser included them it found no shared movement addresses, I restricted the search to actuators by their product names. The export used to exist on one computer only; the deploy script now copies it to the instance and with that into the nightly encrypted backup.
Excluding shutters from a central command
The evening time control closes all shutters of one floor with one central command, and I wanted five of them to stay open. Which motors follow a central address is set in the actuators, so Home Assistant cannot exclude one. The export showed 19 channels on that address, each with an individual address of its own. The automation now sends to 14 individual addresses, using a list in the KNX send action. The test closed 14 and left 5 open, which I checked by looking out of the window, since the closed state in Home Assistant is an estimate.
For lights, the central all off goes to its own address, and which outputs follow it is stored only in the actuator parameters. A telegram on one of the seven central light groups raises an event, and an automation reads all lights again; since November it also runs after a new KNX connection, a KNX reload and a Home Assistant start. This is the current version, with the group addresses replaced by placeholders and the list of 80 read addresses shortened. The two sensor entity ids are those of my KNX interface; if the sensor for the physical address has no value, the automation stops before reading:
# packages/knx.yaml (excerpt): group addresses replaced by placeholders,
# the list of read addresses shortened
knx:
event:
- address: ["9/2/1", "9/2/2", "9/2/3", "9/2/4", "9/2/5", "9/2/6", "9/2/7"] # Nur Licht-Zentralgruppen, keine Sperrfunktion 9/2/8
automation:
- id: knx_zentral_nachlesen
alias: "KNX: Lichtzustände nach Zentralbefehl nachlesen"
description: "Liest Lichtzustaende nach Zentralbefehlen, KNX-Wiederverbindung und HA-Start vom Aktor."
initial_state: true
mode: restart
variables:
licht_zentraladressen: ["9/2/1", "9/2/2", "9/2/3", "9/2/4", "9/2/5", "9/2/6", "9/2/7"]
licht_leseadressen:
- "9/1/1"
- "9/1/2"
- "9/1/3"
# ... 77 more addresses, 80 in total
triggers:
- trigger: event
event_type: knx_event
event_data:
telegramtype: GroupValueWrite
id: zentral
- trigger: state
entity_id: sensor.knx_interface_verbindung_hergestellt
id: verbindung
- trigger: event
event_type: event_knx_reloaded
id: reload
- trigger: homeassistant
event: start
id: start
conditions:
- condition: template
value_template: >-
{{ trigger.id != 'zentral' or
trigger.event.data.destination in licht_zentraladressen }}
actions:
- delay:
seconds: 35
- condition: template
value_template: "{{ has_value('sensor.knx_interface_physikalische_adresse') }}"
# 300 ms Abstand: Sammelabfragen lieferten im Bustest nur 39/80 Antworten.
- repeat:
for_each: "{{ licht_leseadressen }}"
sequence:
- action: knx.read
data:
address: "{{ repeat.item }}"
- delay:
milliseconds: 300In my acceptance test in October one of three lights still showed on after 6 seconds and showed the correct state, off, after about 9 seconds; the automation then requested updates for roughly 80 lights and switches at once. A test in November showed that this was more than timing: with 80 read requests sent back to back, only 39 of the 80 addresses got an answer on both instances, and with 300 ms between the requests all 80 answered. The automation now waits 35 seconds and then reads the 80 addresses one by one with 300 ms in between, about a minute in total. A test like this has to wait until the last entity has updated.
Room controllers: what Home Assistant writes and what they report
My 11 room controllers have no readable feedback of the active operating mode in the ETS project, so after a restart Home Assistant reads an object that does not report it. On the first comparison morning, after a restart, the new instance showed Standby on every thermostat, and the old one showed the Comfort it had written itself before. I could read back a setpoint of 20.0 °C, but that alone did not confirm the operating mode. A second mode object per controller, whose abbreviation I first read as state, turned out to mean forced operation and is not readable. An earlier cleanup documented in my repository had already removed those addresses once. I now check the read flag before using an object as status, whatever its name says. The modes are covered in KNX thermostat preset modes, the restart problem in the standby after restart fix.
The setpoint is the second problem. Each controller has a writable comfort base temperature and a readable current setpoint. Home Assistant writes the first and displays the second, and the controller adds the operating mode and any local shift on top of the base. On one controller a base of 23 °C gave a reported 21 °C, and 25 °C gave 23 °C. After a local change at the controller the difference was −1 K, and half degrees do not arrive exactly: 23.5 gave 23, 24.5 gave 24. A script now reads the current setpoint, writes the base within 18–25 °C, reads again and corrects, with at most three attempts, and reports success only after two readings match the requested setpoint. Eleven tests run it against a simulated bus. On the new instance I reduced the heating logic around the controllers from 21 automations to 6; they keep a controller in frost protection while its window is open, even when the schedule changes modes, see window open, heating off. The six are still disabled, until I move heating control from the old instance to the new one.
A gateway that answers from its own cache
Even with the read flags in place, some lights showed on after all off. The KNX-IP gateway, an older model with firmware from 2016, has a local group cache to reduce bus load and answered read requests with the last value it had seen, without asking the actuator and without applying the central command to the individual outputs. Two things gave it away: the answers carried the tunnel address of the new instance as sender instead of the actuator's address, and one address answered before its read flag had been set. According to the manual the cache answers low-priority reads, which is the priority Home Assistant uses. I switched the cache off and raised the tunnels from 2 to 4, so that ETS can connect while both instances are running. There is no firmware update for this model. How I checked for it and what I changed on the gateway is in the post on the gateway's group cache.
Frequently asked questions
Which KNX interface does Home Assistant need?
I use a KNX-IP gateway with tunneling, one tunnel per connected client. My two Home Assistant instances and ETS need three at the same time; the gateway now has four enabled.
Does the KNX state show correctly after a Home Assistant restart?
In my setup Home Assistant reads back the state of 52 lights and switches after a restart. Shutters without feedback stay unknown until they move, and the displayed operating mode of the room controllers is unreliable until Home Assistant writes it.
Do I need ETS to use KNX with Home Assistant?
Every fix in this post that changed device behaviour needed ETS: the read flags, removing nine wrong ones, and, still open, linking the position status of the four shutter motors that have one. The export alone, without manufacturer plugins, was enough to check what each actuator can do and to generate the listening addresses.



