From 7e40afae68d8f0218a602904ed24eede8aaf70db Mon Sep 17 00:00:00 2001 From: Andre Basche Date: Sun, 7 May 2023 02:34:41 +0200 Subject: [PATCH] Flag enums as enums with option list #35 --- custom_components/hon/sensor.py | 80 +++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/custom_components/hon/sensor.py b/custom_components/hon/sensor.py index d5f125e..4210c52 100644 --- a/custom_components/hon/sensor.py +++ b/custom_components/hon/sensor.py @@ -34,7 +34,34 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = { key="prPhase", name="Program Phase", icon="mdi:washing-machine", + device_class=SensorDeviceClass.ENUM, translation_key="program_phases_wm", + options=[ + "0", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "9", + "10", + "11", + "12", + "13", + "14", + "15", + "16", + "17", + "18", + "19", + "20", + "24", + "25", + "26", + "27", + ], ), SensorEntityDescription( key="totalElectricityUsed", @@ -88,7 +115,9 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = { key="machMode", name="Machine Status", icon="mdi:information", + device_class=SensorDeviceClass.ENUM, translation_key="washing_modes", + options=["0", "1", "3", "4", "5", "6", "7"], ), SensorEntityDescription( key="errors", name="Error", icon="mdi:math-log", translation_key="errors" @@ -161,7 +190,9 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = { key="machMode", name="Machine Status", icon="mdi:information", + device_class=SensorDeviceClass.ENUM, translation_key="washing_modes", + options=["0", "1", "3", "4", "5", "6", "7"], ), SensorEntityDescription( key="errors", name="Error", icon="mdi:math-log", translation_key="errors" @@ -192,13 +223,29 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = { key="prPhase", name="Program Phase", icon="mdi:washing-machine", + device_class=SensorDeviceClass.ENUM, translation_key="program_phases_td", + options=[ + "0", + "1", + "2", + "3", + "13", + "14", + "15", + "16", + "18", + "19", + "20", + ], ), SensorEntityDescription( key="dryLevel", name="Dry level", icon="mdi:hair-dryer", + device_class=SensorDeviceClass.ENUM, translation_key="dry_levels", + options=["0", "1", "2", "3", "4", "12", "13", "14", "15"], ), SensorEntityDescription( key="tempLevel", @@ -290,7 +337,9 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = { key="machMode", name="Machine Status", icon="mdi:information", + device_class=SensorDeviceClass.ENUM, translation_key="washing_modes", + options=["0", "1", "3", "4", "5", "6", "7"], ), SensorEntityDescription( key="spinSpeed", @@ -318,7 +367,34 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = { key="prPhase", name="Program Phase", icon="mdi:washing-machine", + device_class=SensorDeviceClass.ENUM, translation_key="program_phases_wm", + options=[ + "0", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "9", + "10", + "11", + "12", + "13", + "14", + "15", + "16", + "17", + "18", + "19", + "20", + "24", + "25", + "26", + "27", + ], ), SensorEntityDescription( key="dryLevel", @@ -458,7 +534,9 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = { key="machMode", name="Machine Status", icon="mdi:information", + device_class=SensorDeviceClass.ENUM, translation_key="washing_modes", + options=["0", "1", "3", "4", "5", "6", "7"], ), SensorEntityDescription( key="errors", name="Error", icon="mdi:math-log", translation_key="errors" @@ -475,7 +553,9 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = { key="prPhase", name="Program Phase", icon="mdi:washing-machine", + device_class=SensorDeviceClass.ENUM, translation_key="program_phases_dw", + options=["0", "1", "2", "3", "4", "5", "6"], ), ), }