Make numeric device classes a constant (#127354)

noticed this shows up on the profile every time the UI loads
This commit is contained in:
J. Nick Koston 2024-10-02 15:00:49 -05:00 committed by GitHub
parent ddea61148f
commit ff7bc13058
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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}
)