diff options
Diffstat (limited to 'custom_components/hon')
-rw-r--r-- | custom_components/hon/binary_sensor.py | 28 | ||||
-rw-r--r-- | custom_components/hon/manifest.json | 2 | ||||
-rw-r--r-- | custom_components/hon/number.py | 15 | ||||
-rw-r--r-- | custom_components/hon/select.py | 8 | ||||
-rw-r--r-- | custom_components/hon/sensor.py | 64 | ||||
-rw-r--r-- | custom_components/hon/switch.py | 61 | ||||
-rw-r--r-- | custom_components/hon/translations/en.json | 116 |
7 files changed, 283 insertions, 11 deletions
diff --git a/custom_components/hon/binary_sensor.py b/custom_components/hon/binary_sensor.py index b119722..9b3202c 100644 --- a/custom_components/hon/binary_sensor.py +++ b/custom_components/hon/binary_sensor.py | |||
@@ -159,6 +159,34 @@ BINARY_SENSORS: dict[str, tuple[HonBinarySensorEntityDescription, ...]] = { | |||
159 | on_value="0", | 159 | on_value="0", |
160 | ), | 160 | ), |
161 | ), | 161 | ), |
162 | "DW": ( | ||
163 | HonBinarySensorEntityDescription( | ||
164 | key="saltStatus", | ||
165 | name="Salt", | ||
166 | device_class=BinarySensorDeviceClass.PROBLEM, | ||
167 | on_value="1", | ||
168 | icon="mdi:shaker-outline", | ||
169 | ), | ||
170 | HonBinarySensorEntityDescription( | ||
171 | key="rinseAidStatus", | ||
172 | name="Rinse Aid", | ||
173 | device_class=BinarySensorDeviceClass.PROBLEM, | ||
174 | on_value="1", | ||
175 | icon="mdi:spray-bottle", | ||
176 | ), | ||
177 | HonBinarySensorEntityDescription( | ||
178 | key="attributes.lastConnEvent.category", | ||
179 | name="Connection", | ||
180 | device_class=BinarySensorDeviceClass.CONNECTIVITY, | ||
181 | on_value="CONNECTED", | ||
182 | ), | ||
183 | HonBinarySensorEntityDescription( | ||
184 | key="doorStatus", | ||
185 | name="Door", | ||
186 | device_class=BinarySensorDeviceClass.DOOR, | ||
187 | on_value="1", | ||
188 | ), | ||
189 | ), | ||
162 | } | 190 | } |
163 | 191 | ||
164 | 192 | ||
diff --git a/custom_components/hon/manifest.json b/custom_components/hon/manifest.json index 1d1aba5..8ad79ae 100644 --- a/custom_components/hon/manifest.json +++ b/custom_components/hon/manifest.json | |||
@@ -7,5 +7,5 @@ | |||
7 | "iot_class": "cloud_polling", | 7 | "iot_class": "cloud_polling", |
8 | "issue_tracker": "https://github.com/Andre0512/hon/issues", | 8 | "issue_tracker": "https://github.com/Andre0512/hon/issues", |
9 | "requirements": ["pyhOn==0.8.0b5"], | 9 | "requirements": ["pyhOn==0.8.0b5"], |
10 | "version": "0.6.0-beta.4" | 10 | "version": "0.6.0-beta.5" |
11 | } | 11 | } |
diff --git a/custom_components/hon/number.py b/custom_components/hon/number.py index 67f8045..1e5e4fc 100644 --- a/custom_components/hon/number.py +++ b/custom_components/hon/number.py | |||
@@ -120,6 +120,21 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = { | |||
120 | icon="mdi:timelapse", | 120 | icon="mdi:timelapse", |
121 | ), | 121 | ), |
122 | ), | 122 | ), |
123 | "DW": ( | ||
124 | NumberEntityDescription( | ||
125 | key="startProgram.delayTime", | ||
126 | name="Delay time", | ||
127 | icon="mdi:timer-plus", | ||
128 | entity_category=EntityCategory.CONFIG, | ||
129 | native_unit_of_measurement=UnitOfTime.MINUTES, | ||
130 | ), | ||
131 | NumberEntityDescription( | ||
132 | key="startProgram.waterHard", | ||
133 | name="Water hard", | ||
134 | icon="mdi:water", | ||
135 | entity_category=EntityCategory.CONFIG, | ||
136 | ), | ||
137 | ), | ||
123 | } | 138 | } |
124 | 139 | ||
125 | 140 | ||
diff --git a/custom_components/hon/select.py b/custom_components/hon/select.py index cb3e640..cd9849d 100644 --- a/custom_components/hon/select.py +++ b/custom_components/hon/select.py | |||
@@ -84,6 +84,14 @@ SELECTS = { | |||
84 | translation_key="programs", | 84 | translation_key="programs", |
85 | ), | 85 | ), |
86 | ), | 86 | ), |
87 | "DW": ( | ||
88 | SelectEntityDescription( | ||
89 | key="startProgram.program", | ||
90 | name="Program", | ||
91 | entity_category=EntityCategory.CONFIG, | ||
92 | translation_key="programs_dw", | ||
93 | ), | ||
94 | ), | ||
87 | } | 95 | } |
88 | 96 | ||
89 | 97 | ||
diff --git a/custom_components/hon/sensor.py b/custom_components/hon/sensor.py index 729ba93..d90b24d 100644 --- a/custom_components/hon/sensor.py +++ b/custom_components/hon/sensor.py | |||
@@ -21,6 +21,7 @@ from homeassistant.const import ( | |||
21 | from homeassistant.core import callback | 21 | from homeassistant.core import callback |
22 | from homeassistant.helpers.entity import EntityCategory | 22 | from homeassistant.helpers.entity import EntityCategory |
23 | from homeassistant.helpers.typing import StateType | 23 | from homeassistant.helpers.typing import StateType |
24 | from homeassistant.const import PERCENTAGE | ||
24 | 25 | ||
25 | from .const import DOMAIN | 26 | from .const import DOMAIN |
26 | from .hon import HonCoordinator, HonEntity | 27 | from .hon import HonCoordinator, HonEntity |
@@ -237,6 +238,69 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = { | |||
237 | ), | 238 | ), |
238 | SensorEntityDescription(key="errors", name="Error", icon="mdi:math-log"), | 239 | SensorEntityDescription(key="errors", name="Error", icon="mdi:math-log"), |
239 | ), | 240 | ), |
241 | "DW": ( | ||
242 | SensorEntityDescription( | ||
243 | key="startProgram.ecoIndex", | ||
244 | name="Eco Index", | ||
245 | icon="mdi:sprout", | ||
246 | state_class=SensorStateClass.MEASUREMENT, | ||
247 | entity_category=EntityCategory.CONFIG, | ||
248 | ), | ||
249 | SensorEntityDescription( | ||
250 | key="startProgram.waterEfficiency", | ||
251 | name="Water Efficiency", | ||
252 | icon="mdi:water", | ||
253 | state_class=SensorStateClass.MEASUREMENT, | ||
254 | entity_category=EntityCategory.CONFIG, | ||
255 | ), | ||
256 | SensorEntityDescription( | ||
257 | key="startProgram.waterSaving", | ||
258 | name="Water Saving", | ||
259 | icon="mdi:water-percent", | ||
260 | state_class=SensorStateClass.MEASUREMENT, | ||
261 | native_unit_of_measurement=PERCENTAGE, | ||
262 | entity_category=EntityCategory.CONFIG, | ||
263 | ), | ||
264 | SensorEntityDescription( | ||
265 | key="startProgram.temp", | ||
266 | name="Temperature", | ||
267 | icon="mdi:thermometer", | ||
268 | state_class=SensorStateClass.MEASUREMENT, | ||
269 | native_unit_of_measurement=UnitOfTemperature.CELSIUS, | ||
270 | entity_category=EntityCategory.CONFIG, | ||
271 | ), | ||
272 | SensorEntityDescription( | ||
273 | key="startProgram.energyLabel", | ||
274 | name="Energy Label", | ||
275 | icon="mdi:lightning-bolt-circle", | ||
276 | state_class=SensorStateClass.MEASUREMENT, | ||
277 | entity_category=EntityCategory.CONFIG, | ||
278 | ), | ||
279 | SensorEntityDescription( | ||
280 | key="startProgram.remainingTime", | ||
281 | name="Time", | ||
282 | icon="mdi:timer", | ||
283 | state_class=SensorStateClass.MEASUREMENT, | ||
284 | native_unit_of_measurement=UnitOfTime.MINUTES, | ||
285 | entity_category=EntityCategory.CONFIG, | ||
286 | ), | ||
287 | SensorEntityDescription( | ||
288 | key="machMode", | ||
289 | name="Machine Status", | ||
290 | icon="mdi:information", | ||
291 | translation_key="mode_dw", | ||
292 | ), | ||
293 | SensorEntityDescription( | ||
294 | key="errors", name="Error", icon="mdi:math-log", translation_key="errors" | ||
295 | ), | ||
296 | SensorEntityDescription( | ||
297 | key="remainingTimeMM", | ||
298 | name="Remaining Time", | ||
299 | icon="mdi:timer", | ||
300 | state_class=SensorStateClass.MEASUREMENT, | ||
301 | native_unit_of_measurement=UnitOfTime.MINUTES, | ||
302 | ), | ||
303 | ), | ||
240 | } | 304 | } |
241 | 305 | ||
242 | 306 | ||
diff --git a/custom_components/hon/switch.py b/custom_components/hon/switch.py index b2dcc0b..08ab8ea 100644 --- a/custom_components/hon/switch.py +++ b/custom_components/hon/switch.py | |||
@@ -1,5 +1,4 @@ | |||
1 | import logging | 1 | import logging |
2 | |||
3 | from dataclasses import dataclass | 2 | from dataclasses import dataclass |
4 | from typing import Any | 3 | from typing import Any |
5 | 4 | ||
@@ -90,6 +89,51 @@ SWITCHES: dict[str, tuple[HonSwitchEntityDescription, ...]] = { | |||
90 | turn_off_key="resumeProgram", | 89 | turn_off_key="resumeProgram", |
91 | ), | 90 | ), |
92 | ), | 91 | ), |
92 | "DW": ( | ||
93 | HonSwitchEntityDescription( | ||
94 | key="active", | ||
95 | name="Dish Washer", | ||
96 | icon="mdi:dishwasher", | ||
97 | turn_on_key="startProgram", | ||
98 | turn_off_key="stopProgram", | ||
99 | ), | ||
100 | HonSwitchEntityDescription( | ||
101 | key="startProgram.extraDry", | ||
102 | name="Extra Dry", | ||
103 | icon="mdi:hair-dryer", | ||
104 | entity_category=EntityCategory.CONFIG, | ||
105 | ), | ||
106 | HonSwitchEntityDescription( | ||
107 | key="startProgram.halfLoad", | ||
108 | name="Half Load", | ||
109 | icon="mdi:fraction-one-half", | ||
110 | entity_category=EntityCategory.CONFIG, | ||
111 | ), | ||
112 | HonSwitchEntityDescription( | ||
113 | key="startProgram.openDoor", | ||
114 | name="Open Door", | ||
115 | icon="mdi:door-open", | ||
116 | entity_category=EntityCategory.CONFIG, | ||
117 | ), | ||
118 | HonSwitchEntityDescription( | ||
119 | key="startProgram.threeInOne", | ||
120 | name="Three in One", | ||
121 | icon="mdi:numeric-3-box-outline", | ||
122 | entity_category=EntityCategory.CONFIG, | ||
123 | ), | ||
124 | HonSwitchEntityDescription( | ||
125 | key="startProgram.ecoExpress", | ||
126 | name="Eco Express", | ||
127 | icon="mdi:sprout", | ||
128 | entity_category=EntityCategory.CONFIG, | ||
129 | ), | ||
130 | HonSwitchEntityDescription( | ||
131 | key="startProgram.addDish", | ||
132 | name="Add Dish", | ||
133 | icon="mdi:silverware-fork-knife", | ||
134 | entity_category=EntityCategory.CONFIG, | ||
135 | ), | ||
136 | ), | ||
93 | } | 137 | } |
94 | 138 | ||
95 | 139 | ||
@@ -139,13 +183,6 @@ class HonSwitchEntity(HonEntity, SwitchEntity): | |||
139 | self.entity_description = description | 183 | self.entity_description = description |
140 | self._attr_unique_id = f"{super().unique_id}{description.key}" | 184 | self._attr_unique_id = f"{super().unique_id}{description.key}" |
141 | 185 | ||
142 | def available(self) -> bool: | ||
143 | if self.entity_category == EntityCategory.CONFIG: | ||
144 | return ( | ||
145 | self._device.settings[self.entity_description.key].typology != "fixed" | ||
146 | ) | ||
147 | return True | ||
148 | |||
149 | @property | 186 | @property |
150 | def is_on(self) -> bool | None: | 187 | def is_on(self) -> bool | None: |
151 | """Return True if entity is on.""" | 188 | """Return True if entity is on.""" |
@@ -161,7 +198,9 @@ class HonSwitchEntity(HonEntity, SwitchEntity): | |||
161 | async def async_turn_on(self, **kwargs: Any) -> None: | 198 | async def async_turn_on(self, **kwargs: Any) -> None: |
162 | if self.entity_category == EntityCategory.CONFIG: | 199 | if self.entity_category == EntityCategory.CONFIG: |
163 | setting = self._device.settings[self.entity_description.key] | 200 | setting = self._device.settings[self.entity_description.key] |
164 | setting.value = setting.max | 201 | setting.value = ( |
202 | setting.max if isinstance(setting, HonParameterRange) else "1" | ||
203 | ) | ||
165 | self.async_write_ha_state() | 204 | self.async_write_ha_state() |
166 | else: | 205 | else: |
167 | await self._device.commands[self.entity_description.turn_on_key].send() | 206 | await self._device.commands[self.entity_description.turn_on_key].send() |
@@ -169,7 +208,9 @@ class HonSwitchEntity(HonEntity, SwitchEntity): | |||
169 | async def async_turn_off(self, **kwargs: Any) -> None: | 208 | async def async_turn_off(self, **kwargs: Any) -> None: |
170 | if self.entity_category == EntityCategory.CONFIG: | 209 | if self.entity_category == EntityCategory.CONFIG: |
171 | setting = self._device.settings[self.entity_description.key] | 210 | setting = self._device.settings[self.entity_description.key] |
172 | setting.value = setting.min | 211 | setting.value = ( |
212 | setting.min if isinstance(setting, HonParameterRange) else "0" | ||
213 | ) | ||
173 | self.async_write_ha_state() | 214 | self.async_write_ha_state() |
174 | else: | 215 | else: |
175 | await self._device.commands[self.entity_description.turn_off_key].send() | 216 | await self._device.commands[self.entity_description.turn_off_key].send() |
diff --git a/custom_components/hon/translations/en.json b/custom_components/hon/translations/en.json index cafd100..6225013 100644 --- a/custom_components/hon/translations/en.json +++ b/custom_components/hon/translations/en.json | |||
@@ -72,6 +72,16 @@ | |||
72 | "13": "Ready to Store H-2", | 72 | "13": "Ready to Store H-2", |
73 | "14": "Extra Dry H-3" | 73 | "14": "Extra Dry H-3" |
74 | } | 74 | } |
75 | }, | ||
76 | "mode_dw": { | ||
77 | "state": { | ||
78 | "0": "Disconnected", | ||
79 | "1": "Ready", | ||
80 | "2": "Running", | ||
81 | "3": "Delayed start", | ||
82 | "5": "Delayed start cancelled", | ||
83 | "7": "Finished" | ||
84 | } | ||
75 | } | 85 | } |
76 | }, | 86 | }, |
77 | "select": { | 87 | "select": { |
@@ -461,6 +471,112 @@ | |||
461 | "iot_standard_melting": "Melting", | 471 | "iot_standard_melting": "Melting", |
462 | "iot_standard_simmering": "Simmering" | 472 | "iot_standard_simmering": "Simmering" |
463 | } | 473 | } |
474 | }, | ||
475 | "programs_dw": { | ||
476 | "state": { | ||
477 | "59_min": "Rapid 59'", | ||
478 | "auto_care": "Auto Care", | ||
479 | "auto_care_soil": "Auto Care", | ||
480 | "auto_hygiene": "Auto Hygiene", | ||
481 | "auto_plus": "AutoPlus", | ||
482 | "auto_rapid": "Auto Rapid", | ||
483 | "auto_sensor": "Auto Sensor", | ||
484 | "auto_sensor_soil": "Auto Sensor", | ||
485 | "auto_universal": "Auto Universal 50 - 60°C", | ||
486 | "auto_universal_plus": "Auto Universal+ 65 - 75°C", | ||
487 | "auto_universal_plus_soil": "Auto Universal+ 65 - 75°C", | ||
488 | "auto_universal_soil": "Auto Universal 50 - 60°C", | ||
489 | "auto_wash": "Auto Wash", | ||
490 | "auto_wash_soil": "Auto Wash", | ||
491 | "classe_a_59": "A Wash 59' 65°C", | ||
492 | "delicate": "Delicate 45°C", | ||
493 | "dishwasher_care": "Limescale cleaning", | ||
494 | "eco": "Eco", | ||
495 | "eco_asynch": "Eco 45°C", | ||
496 | "eco_bldc": "Eco 45°C", | ||
497 | "eco_synch": "Eco 45°C", | ||
498 | "gentle_wash": "Gentle wash", | ||
499 | "glass": "Glass", | ||
500 | "glassware": "Glassware 45°C", | ||
501 | "glass_care": "Glass Care", | ||
502 | "hygiene": "Hygiene", | ||
503 | "hygiene_plus": "Hygiene+ 75°C", | ||
504 | "intensive": "Intensive", | ||
505 | "intensive_rapid": "Intensive Rapid", | ||
506 | "iot_auto_sensor": "Auto Sensor", | ||
507 | "iot_auto_universal_soil": "Auto Universal 50 - 60°C", | ||
508 | "iot_auto_wash_soil": "Auto Wash", | ||
509 | "iot_baby_care": "Baby Care", | ||
510 | "iot_breakfast": "Breakfast", | ||
511 | "iot_checkup": "Check-Up", | ||
512 | "iot_china_crystals": "China Crystals", | ||
513 | "iot_classe_a_59": "Rapid 59'", | ||
514 | "iot_cocktail_glasses": "Coktail Glasses", | ||
515 | "iot_cocktail_glasses_soil": "Coktail Glasses", | ||
516 | "iot_daily_care": "Daily Care", | ||
517 | "iot_daily_care_soil": "Daily Care", | ||
518 | "iot_delicate": "Delicate 45°C", | ||
519 | "iot_dinner_for_two": "Dinner for 2", | ||
520 | "iot_dinner_for_two_soil": "Dinner for 2", | ||
521 | "iot_dreft_quick_cycle": "Dreft Quick", | ||
522 | "iot_eco_asynch": "Eco 45°C", | ||
523 | "iot_eco_bldc": "Eco 45°C", | ||
524 | "iot_eco_synch": "Eco 45°C", | ||
525 | "iot_extra_hygiene": "Extra Hygiene", | ||
526 | "iot_fairy_quick_cycle": "Fairy Short", | ||
527 | "iot_happy_hour": "Happy Hour", | ||
528 | "iot_jar_quick_cycle": "Jar Quick", | ||
529 | "iot_party": "Party", | ||
530 | "iot_party_soil": "Party", | ||
531 | "iot_pizza_menu": "Pizza Menu", | ||
532 | "iot_pizza_menu_soil": "Pizza Menu", | ||
533 | "iot_plastic_tupperware": "Plastic & Tupperware", | ||
534 | "iot_porcelain": "Porcelain", | ||
535 | "iot_pot_and_pans": "Pot & Pans", | ||
536 | "iot_pot_and_pans_soil": "Pot & Pans", | ||
537 | "iot_power_mix_wash": "Power Mix Wash", | ||
538 | "iot_power_mix_wash_soil": "Power Mix Wash", | ||
539 | "iot_prewash": "Pre-wash", | ||
540 | "iot_pyrex_and_glassware": "Pyrex & Glassware", | ||
541 | "iot_rapid_29": "Rapid 29'", | ||
542 | "iot_rapid_39": "Rapid 39' 60°C", | ||
543 | "iot_single": "Single", | ||
544 | "iot_steam": "Steam 75°C", | ||
545 | "iot_super_flash": "Super Flash", | ||
546 | "iot_super_wash": "Super Wash", | ||
547 | "iot_turbopower": "TurboPower", | ||
548 | "iot_universal": "Universal 60°C", | ||
549 | "iot_wok_grids_maxi_pans": "Special Pans (Wok, Grids & Maxi Pans)", | ||
550 | "iot_wok_grids_maxi_pans_soil": "Special Pans (Wok, Grids & Maxi Pans)", | ||
551 | "iot_yes_quick_cycle": "Yes Quick", | ||
552 | "night": "Night 55°C", | ||
553 | "prewash": "Pre-wash", | ||
554 | "rapid_20": "Rapid 20'", | ||
555 | "rapid_24": "Rapid 24'", | ||
556 | "rapid_29": "Rapid 29' 50°C", | ||
557 | "rapid_35": "Wash&Dry 35'", | ||
558 | "rapid_39": "Rapid 39' 60°C", | ||
559 | "rapid_49": "Rapid 49'", | ||
560 | "rapid_59": "Rapid 59'", | ||
561 | "sanitising": "Sanitising", | ||
562 | "silence": "Silence", | ||
563 | "silent": "Silent", | ||
564 | "silent_care": "Silent Care", | ||
565 | "smart_ai": "Smart AI", | ||
566 | "smart_ai_pro": "Smart AI Pro", | ||
567 | "smart_ai_rapid": "Smart AI Rapid", | ||
568 | "special": "Special", | ||
569 | "special_pw_prz": "Special", | ||
570 | "steam": "Steam 75°C", | ||
571 | "steam_plus": "Steam Plus 75°C", | ||
572 | "total_care": "Total Care 50°C", | ||
573 | "ultra_silence": "Ultra Silence 55°C", | ||
574 | "ultra_silent": "Ultra Silent 55°C", | ||
575 | "universal": "Universal 60°C", | ||
576 | "universal_plus": "Universal Plus 70°C", | ||
577 | "zone_wash": "Flex Zone Wash", | ||
578 | "zoom_39": "Zoom 39 min" | ||
579 | } | ||
464 | } | 580 | } |
465 | } | 581 | } |
466 | } | 582 | } |