Improve KNX config validation (#50980)

* remove dict repacking

* check binary_sensor device_class

* check cover device_class

* check sensor_type
This commit is contained in:
Matthias Alphart 2021-05-23 10:42:17 +02:00 committed by GitHub
parent 3141535d69
commit 5ca5b9ac89
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 16 deletions

View file

@ -12,7 +12,6 @@ from homeassistant.components.cover import (
ATTR_POSITION,
ATTR_TILT_POSITION,
DEVICE_CLASS_BLIND,
DEVICE_CLASSES,
SUPPORT_CLOSE,
SUPPORT_CLOSE_TILT,
SUPPORT_OPEN,
@ -127,7 +126,7 @@ class KNXCover(KnxEntity, CoverEntity):
@property
def device_class(self) -> str | None:
"""Return the class of this device, from component DEVICE_CLASSES."""
if self._device_class in DEVICE_CLASSES:
if self._device_class:
return self._device_class
if self._device.supports_angle:
return DEVICE_CLASS_BLIND