From d8bba6747e1bd82bc8650d025b323584a83a3f7f Mon Sep 17 00:00:00 2001 From: Jan Bouwhuis Date: Thu, 2 Feb 2023 20:22:33 +0100 Subject: [PATCH] Address late review on readability sensor code (#87111) * Improve readability _numeric_state_expected * Update homeassistant/components/sensor/__init__.py --- homeassistant/components/sensor/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/sensor/__init__.py b/homeassistant/components/sensor/__init__.py index f3f415966ce..42d36f59733 100644 --- a/homeassistant/components/sensor/__init__.py +++ b/homeassistant/components/sensor/__init__.py @@ -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: