KNX integrations not working anymore from 2021.6 upgrade on

Hi everyone,

I’ve been using HA for a while now to visualize my KNX system. Never had any issue until the 2021.6 and 2021.7 upgrades. From the 2021.6 updgrade, KNX integrations is not working anymore. My config was also never changed from when i first set up HA assistant. I just try to frequently update HA to not run behind so much. From the 2021.6.0 an higher i get the following errors:

Logger: homeassistant.setup
Source: setup.py:173
First occurred: 1:19:10 PM (1 occurrences)
Last logged: 1:19:10 PM
Setup failed for knx: Invalid config.
Logger: homeassistant.config
Source: config.py:443
First occurred: 1:19:10 PM (1 occurrences)
Last logged: 1:19:10 PM
Invalid config for [knx]: value must be one of ['battery', 'battery_charging', 'cold', 'connectivity', 'door', 'garage_door', 'gas', 'heat', 'light', 'lock', 'moisture', 'motion', 'moving', 'occupancy', 'opening', 'plug', 'power', 'presence', 'problem', 'safety', 'smoke', 'sound', 'vibration', 'window'] for dictionary value @ data['knx']['binary_sensor'][7]['device_class']. Got 'None'. (See /config/configuration.yaml, line 17). Please check the docs at https://www.home-assistant.io/integrations/knx

I’ve been searching on the net but i couldn’t find the same error message.
I’ve had a look at KNX - Home Assistant, on that page my error looks a bit like the XKNK.YAML confiuration that is depricated. But is far as i can tell i don’t use this.
I’ve had a look at https://community.home-assistant.io/t/knx-cookbook, to verify my config, but this seems ok.

My configuration.yaml file:


# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Text to speech
tts:
  - platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

homeassistant:
  customize: !include customize.yaml

knx: 
  tunneling:
    host: *[ip from my knx]*
    port: 3671
    local_ip: *[ip from HA]*
  binary_sensor: !include knx_binary_sensor.yaml
  sensor: !include knx_sensor.yaml
  switch: !include knx_switch.yaml
  light: !include knx_light.yaml
  cover: !include knx_cover.yaml

sensor:   
  - platform: systemmonitor
    resources:
      - type: processor_use
      - type: disk_use
        arg: /
      - type: memory_use_percent

switch:
  - platform: wake_on_lan
    mac: *:**:**:**:**:*
    name: HTPC

line 17 is the line where knx: is.
Anybody who could help me out of got any idea in what direction i need to look?

You are including 5 more YAML files here. The config error must be within one of these files. Please check them.

To find the culprit yourself you can remove the includes one by one and let HA check the config for errors until they are gone. Than add the faulty include again and start checking that file. Remove entity by entity from it until you find the one that produces the error. If you found it compare it with the error message. I am sure the error will be obvious by then.

Try to read the error message!

`Invalid config for [knx]: 
value must be one of 
['battery', 'battery_charging', 'cold', 'connectivity', 'door', 'garage_door', 'gas', 'heat', 'light', 'lock', 'moisture', 'motion', 'moving', 'occupancy', 'opening', 'plug', 'power', 'presence', 'problem', 'safety', 'smoke', 'sound', 'vibration', 'window'] 
for dictionary value 
@ data['knx']['binary_sensor'][7]['device_class']. Got 'None'.
[/quote]

The error is at

data['knx']['binary_sensor'][7]['device_class']
     |-> so its in `knx` config 
            |-> in a binary_sensor entity
                             |-> the 8th binary_sensor entity to be specific (it's 0-indexed 🤷)
                                |-> at the 'device_class' key

Got 'None'.
|-> it has to be one of the listed (or omitted completely because it's optional).
1 Like

thx @Jpsy and @farmio

I had 3 binary sensor define with the device_class: none, because they did not fit any of the default device classes. This has always worked fine until 2021.6. I remove the device_class for these 3 sensors and everything is working fine now.

KNX config validation was narrowed down in the last releases to better detect config errors.
Previously it was just checked if it was a string. Invalid configs were ignored.