From 6e20edc30c96966da49314523fb4b5e36dd222c0 Mon Sep 17 00:00:00 2001 From: Matthias Alphart Date: Wed, 9 Jun 2021 14:08:29 +0200 Subject: [PATCH] Update xknx to version 0.18.5 (#51644) * xknx 0.18.5 * fix integer DPTs trying to cast str state with `int()` * Delint Co-authored-by: Martin Hjelmare --- homeassistant/components/knx/expose.py | 14 +++++++++++--- homeassistant/components/knx/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/knx/expose.py b/homeassistant/components/knx/expose.py index 5c371445cc4..5b57e2b0b4c 100644 --- a/homeassistant/components/knx/expose.py +++ b/homeassistant/components/knx/expose.py @@ -5,6 +5,8 @@ from typing import Callable from xknx import XKNX from xknx.devices import DateTime, ExposeSensor +from xknx.dpt import DPTNumeric +from xknx.remote_value import RemoteValueSensor from homeassistant.const import ( CONF_ENTITY_ID, @@ -122,9 +124,15 @@ class KNXExposeSensor: ) if self.type == "binary": if value in (1, STATE_ON, "True"): - value = True - elif value in (0, STATE_OFF, "False"): - value = False + return True + if value in (0, STATE_OFF, "False"): + return False + if ( + value is not None + and isinstance(self.device.sensor_value, RemoteValueSensor) + and issubclass(self.device.sensor_value.dpt_class, DPTNumeric) + ): + return float(value) return value async def _async_entity_changed(self, event: Event) -> None: diff --git a/homeassistant/components/knx/manifest.json b/homeassistant/components/knx/manifest.json index 6b1d4d328ac..65a74a72518 100644 --- a/homeassistant/components/knx/manifest.json +++ b/homeassistant/components/knx/manifest.json @@ -2,7 +2,7 @@ "domain": "knx", "name": "KNX", "documentation": "https://www.home-assistant.io/integrations/knx", - "requirements": ["xknx==0.18.4"], + "requirements": ["xknx==0.18.5"], "codeowners": ["@Julius2342", "@farmio", "@marvin-w"], "quality_scale": "silver", "iot_class": "local_push" diff --git a/requirements_all.txt b/requirements_all.txt index f7211e3509a..b85c396af79 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -2377,7 +2377,7 @@ xbox-webapi==2.0.11 xboxapi==2.0.1 # homeassistant.components.knx -xknx==0.18.4 +xknx==0.18.5 # homeassistant.components.bluesound # homeassistant.components.rest diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 930965768fe..27e6192a968 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -1286,7 +1286,7 @@ wolf_smartset==0.1.8 xbox-webapi==2.0.11 # homeassistant.components.knx -xknx==0.18.4 +xknx==0.18.5 # homeassistant.components.bluesound # homeassistant.components.rest