From ff7bc13058c843717f3dc4de9718257df848d8f1 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 2 Oct 2024 15:00:49 -0500 Subject: [PATCH] Make numeric device classes a constant (#127354) noticed this shows up on the profile every time the UI loads --- homeassistant/components/sensor/websocket_api.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/sensor/websocket_api.py b/homeassistant/components/sensor/websocket_api.py index 2110ccc7253..92df6fa69e9 100644 --- a/homeassistant/components/sensor/websocket_api.py +++ b/homeassistant/components/sensor/websocket_api.py @@ -16,6 +16,8 @@ from .const import ( SensorDeviceClass, ) +_NUMERIC_DEVICE_CLASSES = list(set(SensorDeviceClass) - NON_NUMERIC_DEVICE_CLASSES) + @callback def async_setup(hass: HomeAssistant) -> None: @@ -55,7 +57,6 @@ def ws_numeric_device_classes( hass: HomeAssistant, connection: websocket_api.ActiveConnection, msg: dict[str, Any] ) -> None: """Return numeric sensor device classes.""" - numeric_device_classes = set(SensorDeviceClass) - NON_NUMERIC_DEVICE_CLASSES connection.send_result( - msg["id"], {"numeric_device_classes": list(numeric_device_classes)} + msg["id"], {"numeric_device_classes": _NUMERIC_DEVICE_CLASSES} )