Address late review on readability sensor code (#87111)

* Improve readability _numeric_state_expected

* Update homeassistant/components/sensor/__init__.py
This commit is contained in:
Jan Bouwhuis 2023-02-02 20:22:33 +01:00 committed by GitHub
parent 5df16d761c
commit d8bba6747e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -259,7 +259,7 @@ class SensorEntity(Entity):
return True
# Sensors with custom device classes are not considered numeric
device_class = try_parse_enum(SensorDeviceClass, self.device_class)
return not (device_class is None or device_class in NON_NUMERIC_DEVICE_CLASSES)
return device_class not in {None, *NON_NUMERIC_DEVICE_CLASSES}
@property
def options(self) -> list[str] | None: