Hint for str type instead of explicitly casting to str (#52712)

This commit is contained in:
Andre Lengwenus 2021-07-08 10:42:27 +02:00 committed by GitHub
parent 62c7e5408b
commit abca7deadb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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."""