From abca7deadbb04230a383e40cf068a15210a2856d Mon Sep 17 00:00:00 2001 From: Andre Lengwenus Date: Thu, 8 Jul 2021 10:42:27 +0200 Subject: [PATCH] Hint for str type instead of explicitly casting to str (#52712) --- homeassistant/components/lcn/sensor.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/lcn/sensor.py b/homeassistant/components/lcn/sensor.py index 740319417c3..a1451f339f2 100644 --- a/homeassistant/components/lcn/sensor.py +++ b/homeassistant/components/lcn/sensor.py @@ -1,6 +1,8 @@ """Support for LCN sensors.""" from __future__ import annotations +from typing import cast + import pypck from homeassistant.components.sensor import DOMAIN as DOMAIN_SENSOR, SensorEntity @@ -97,7 +99,7 @@ class LcnVariableSensor(LcnEntity, SensorEntity): @property def unit_of_measurement(self) -> str: """Return the unit of measurement of this entity, if any.""" - return str(self.unit.value) + return cast(str, self.unit.value) def input_received(self, input_obj: InputType) -> None: """Set sensor value when LCN input object (command) is received."""