Add climate entites for fridge #41

This commit is contained in:
Andre Basche 2023-05-28 07:50:59 +02:00
parent a8762367ed
commit cb660fa9e0
27 changed files with 706 additions and 38 deletions

View File

@ -84,6 +84,7 @@ Support has been confirmed for these models, but many more will work. Please add
- Hoover HFB 6B2S3FX
- Hoover HLE C10DCE-80
- Hoover HSOT3161WG
- Hoover HW 68AMC/1-80
- Hoover HWPD 69AMBC/1-S
- Hoover HWPS4954DAMR-11
- Hoover NDE H10A2TCE-80
@ -155,18 +156,18 @@ For every device exists a hidden button which can be used to log all infos of yo
#### Controls
| Name | Icon | Entity | Key |
| --- | --- | --- | --- |
| 10° Heating | `heat-wave` | `switch` | `settings.10degreeHeatingStatus` |
| 10° Heating | `heat-wave` | `switch` | `10degreeHeatingStatus` |
| Air Conditioner | `air-conditioner` | `climate` | `settings` |
| Echo | `account-voice` | `switch` | `settings.echoStatus` |
| Eco Mode | | `switch` | `settings.ecoMode` |
| Echo | `account-voice` | `switch` | `echoStatus` |
| Eco Mode | | `switch` | `ecoMode` |
| Eco Pilot | `run` | `select` | `settings.humanSensingStatus` |
| Health Mode | `medication-outline` | `switch` | `settings.healthMode` |
| Mute | `volume-off` | `switch` | `settings.muteStatus` |
| Rapid Mode | `run-fast` | `switch` | `settings.rapidMode` |
| Screen Display | `monitor-small` | `switch` | `settings.screenDisplayStatus` |
| Self Cleaning | `air-filter` | `switch` | `settings.selfCleaningStatus` |
| Self Cleaning 56 | `air-filter` | `switch` | `settings.selfCleaning56Status` |
| Silent Sleep | `bed` | `switch` | `settings.silentSleepStatus` |
| Health Mode | `medication-outline` | `switch` | `healthMode` |
| Mute | `volume-off` | `switch` | `muteStatus` |
| Rapid Mode | `run-fast` | `switch` | `rapidMode` |
| Screen Display | `monitor-small` | `switch` | `screenDisplayStatus` |
| Self Cleaning | `air-filter` | `switch` | `selfCleaningStatus` |
| Self Cleaning 56 | `air-filter` | `switch` | `selfCleaning56Status` |
| Silent Sleep | `bed` | `switch` | `silentSleepStatus` |
| Target Temperature | `thermometer` | `number` | `settings.tempSel` |
#### Sensors
| Name | Icon | Entity | Key |
@ -187,7 +188,7 @@ For every device exists a hidden button which can be used to log all infos of yo
#### Controls
| Name | Icon | Entity | Key |
| --- | --- | --- | --- |
| Buzzer Disabled | `volume-off` | `switch` | `settings.buzzerDisabled` |
| Buzzer Disabled | `volume-off` | `switch` | `buzzerDisabled` |
| Dish Washer | `dishwasher` | `switch` | `startProgram` / `stopProgram` |
#### Configs
| Name | Icon | Entity | Key |
@ -272,14 +273,16 @@ For every device exists a hidden button which can be used to log all infos of yo
#### Controls
| Name | Icon | Entity | Key |
| --- | --- | --- | --- |
| Auto-Set Mode | `thermometer-auto` | `switch` | `settings.intelligenceMode` |
| Auto-Set Mode | `thermometer-auto` | `switch` | `intelligenceMode` |
| Freezer | `snowflake-thermometer` | `climate` | `settings.tempSelZ2` |
| Freezer Temperature | `thermometer` | `number` | `settings.tempSelZ2` |
| Fridge | `thermometer` | `climate` | `settings.tempSelZ1` |
| Fridge Temperature | `thermometer` | `number` | `settings.tempSelZ1` |
| Holiday Mode | `palm-tree` | `switch` | `settings.holidayMode` |
| Holiday Mode | `palm-tree` | `switch` | `holidayMode` |
| Program Start | `play` | `button` | `startProgram` |
| Program Stop | `stop` | `button` | `stopProgram` |
| Super Cool | `snowflake` | `switch` | `settings.quickModeZ2` |
| Super Freeze | `snowflake-variant` | `switch` | `settings.quickModeZ1` |
| Super Cool | `snowflake` | `switch` | `quickModeZ2` |
| Super Freeze | `snowflake-variant` | `switch` | `quickModeZ1` |
#### Configs
| Name | Icon | Entity | Key |
| --- | --- | --- | --- |

View File

@ -1,4 +1,5 @@
import logging
from dataclasses import dataclass
from homeassistant.components.climate import (
ClimateEntity,
@ -20,6 +21,7 @@ from homeassistant.const import (
TEMP_CELSIUS,
)
from homeassistant.core import callback
from pyhon import helper
from pyhon.appliance import HonAppliance
from .const import HON_HVAC_MODE, HON_FAN, HON_HVAC_PROGRAM, DOMAIN
@ -27,15 +29,40 @@ from .hon import HonEntity
_LOGGER = logging.getLogger(__name__)
@dataclass
class HonACClimateEntityDescription(ClimateEntityDescription):
pass
@dataclass
class HonREFClimateEntityDescription(ClimateEntityDescription):
pass
CLIMATES = {
"AC": (
ClimateEntityDescription(
HonACClimateEntityDescription(
key="settings",
name="Air Conditioner",
icon="mdi:air-conditioner",
translation_key="air_conditioner",
),
),
"REF": (
HonREFClimateEntityDescription(
key="settings.tempSelZ1",
name="Fridge",
icon="mdi:thermometer",
translation_key="fridge",
),
HonREFClimateEntityDescription(
key="settings.tempSelZ2",
name="Freezer",
icon="mdi:snowflake-thermometer",
translation_key="freezer",
),
),
}
@ -43,15 +70,22 @@ async def async_setup_entry(hass, entry: ConfigEntry, async_add_entities) -> Non
entities = []
for device in hass.data[DOMAIN][entry.unique_id].appliances:
for description in CLIMATES.get(device.appliance_type, []):
if isinstance(description, HonACClimateEntityDescription):
if description.key not in list(device.commands):
continue
entity = HonClimateEntity(hass, entry, device, description)
entity = HonACClimateEntity(hass, entry, device, description)
elif isinstance(description, HonREFClimateEntityDescription):
if description.key not in device.available_settings:
continue
entity = HonREFClimateEntity(hass, entry, device, description)
else:
continue
await entity.coordinator.async_config_entry_first_refresh()
entities.append(entity)
async_add_entities(entities)
class HonClimateEntity(HonEntity, ClimateEntity):
class HonACClimateEntity(HonEntity, ClimateEntity):
def __init__(self, hass, entry, device: HonAppliance, description) -> None:
super().__init__(hass, entry, device, description)
@ -81,6 +115,10 @@ class HonClimateEntity(HonEntity, ClimateEntity):
self._handle_coordinator_update(update=False)
async def async_set_hvac_mode(self, hvac_mode):
if self._device.get("onOffStatus") == "0":
self._attr_hvac_mode = HVACMode.OFF
else:
self._attr_hvac_mode = HON_HVAC_MODE[self._device.get("machMode")]
if hvac_mode == HVACMode.OFF:
await self._device.commands["stopProgram"].send()
else:
@ -129,7 +167,7 @@ class HonClimateEntity(HonEntity, ClimateEntity):
if self._device.get("onOffStatus") == "0":
self._attr_hvac_mode = HVACMode.OFF
else:
self._attr_hvac_mode = HON_HVAC_MODE[self._device.get("machMode") or "0"]
self._attr_hvac_mode = HON_HVAC_MODE[self._device.get("machMode")]
self._attr_fan_mode = HON_FAN[self._device.get("windSpeed")]
@ -145,3 +183,78 @@ class HonClimateEntity(HonEntity, ClimateEntity):
self._attr_swing_mode = SWING_OFF
if update:
self.async_write_ha_state()
class HonREFClimateEntity(HonEntity, ClimateEntity):
def __init__(self, hass, entry, device: HonAppliance, description) -> None:
super().__init__(hass, entry, device, description)
self._attr_temperature_unit = TEMP_CELSIUS
self._attr_target_temperature_step = PRECISION_WHOLE
self._attr_max_temp = device.settings[description.key].max
self._attr_min_temp = device.settings[description.key].min
self._attr_hvac_modes = [HVACMode.COOL]
self._attr_supported_features = (
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE
)
self._handle_coordinator_update(update=False)
modes = ["no_mode"]
for mode, data in device.commands["startProgram"].categories.items():
if zone := data.parameters.get("zone"):
if self.entity_description.name.lower() in zone.values:
modes.append(mode)
self._attr_preset_modes = modes
@property
def target_temperature(self) -> int | None:
"""Return the temperature we try to reach."""
return int(self._device.get(self.entity_description.key))
@property
def current_temperature(self) -> int | None:
"""Return the current temperature."""
temp_key = self.entity_description.key.split(".")[-1].replace("Sel", "")
return int(self._device.get(temp_key))
async def async_set_temperature(self, **kwargs):
if (temperature := kwargs.get(ATTR_TEMPERATURE)) is None:
return False
self._device.settings[self.entity_description.key].value = str(int(temperature))
await self._device.commands["settings"].send()
self.async_write_ha_state()
@property
def preset_mode(self) -> str | None:
"""Return the current Preset for this channel."""
return self._device.get(f"mode{self.entity_description.key[-2:]}", "no_mode")
async def async_set_preset_mode(self, preset_mode: str) -> None:
"""Set the new preset mode."""
if preset_mode == "no_mode":
self._device.sync_command("stopProgram", "settings")
await self.coordinator.async_refresh()
await self._device.commands["stopProgram"].send()
else:
self._device.settings["startProgram.program"].value = preset_mode
self._device.settings[
"startProgram.zone"
].value = self.entity_description.name.lower()
self._device.sync_command("startProgram", "settings")
await self.coordinator.async_refresh()
await self._device.commands["startProgram"].send()
self.async_write_ha_state()
@callback
def _handle_coordinator_update(self, update=True) -> None:
self._attr_target_temperature = int(
float(self._device.get(self.entity_description.key))
)
temp_key = self.entity_description.key.split(".")[-1].replace("Sel", "")
self._attr_current_temperature = int(self._device.get(temp_key))
self._attr_hvac_mode = HVACMode.COOL
if update:
self.async_write_ha_state()

View File

@ -9,7 +9,7 @@
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/Andre0512/hon/issues",
"requirements": [
"pyhOn==0.11.1"
"pyhOn==0.11.2"
],
"version": "0.8.0-beta.5"
"version": "0.8.0-beta.6"
}

View File

@ -543,7 +543,6 @@ class HonConfigSensorEntity(HonEntity, SensorEntity):
value = self._device.settings.get(self.entity_description.key, None)
if self.entity_description.state_class is not None:
if value and value.value:
print(value.value, type(value.value))
self._attr_native_value = (
float(value.value) if "." in str(value.value) else int(value.value)
)

View File

@ -344,8 +344,9 @@ async def async_setup_entry(hass, entry: ConfigEntry, async_add_entities) -> Non
continue
entity = HonControlSwitchEntity(hass, entry, device, description)
elif isinstance(description, HonSwitchEntityDescription):
if description.key not in device.available_settings or not device.get(
description.key
if (
f"settings.{description.key}" not in device.available_settings
or not device.get(description.key)
):
continue
entity = HonSwitchEntity(hass, entry, device, description)
@ -366,7 +367,7 @@ class HonSwitchEntity(HonEntity, SwitchEntity):
return self._device.get(self.entity_description.key, "0") == "1"
async def async_turn_on(self, **kwargs: Any) -> None:
setting = self._device.settings[self.entity_description.key]
setting = self._device.settings[f"settings.{self.entity_description.key}"]
if type(setting) == HonParameter:
return
setting.value = setting.max if isinstance(setting, HonParameterRange) else "1"
@ -375,7 +376,7 @@ class HonSwitchEntity(HonEntity, SwitchEntity):
await self.coordinator.async_refresh()
async def async_turn_off(self, **kwargs: Any) -> None:
setting = self._device.settings[self.entity_description.key]
setting = self._device.settings[f"settings.{self.entity_description.key}"]
if type(setting) == HonParameter:
return
setting.value = setting.min if isinstance(setting, HonParameterRange) else "0"
@ -431,9 +432,9 @@ class HonConfigSwitchEntity(HonEntity, SwitchEntity):
"""Return True if entity is on."""
setting = self._device.settings[self.entity_description.key]
return (
setting.value == "1"
or hasattr(setting, "min")
and setting.value != setting.min
setting.value != setting.min
if hasattr(setting, "min")
else setting.value == "1"
)
async def async_turn_on(self, **kwargs: Any) -> None:

View File

@ -1330,6 +1330,33 @@
"climate": {
"air_conditioner": {
"name": "Klimatizační jednotka"
},
"fridge": {
"name": "Chladnička",
"state_attributes": {
"preset_mode": {
"name": "Režimy chladničky",
"state": {
"auto_set": "Automatické nastavení",
"super_cool": "Super Cool",
"holiday": "Holiday",
"no_mode": "Není vybrán žádný režim"
}
}
}
},
"freezer": {
"name": "Mraznička",
"state_attributes": {
"preset_mode": {
"name": "Režimy mrazničky",
"state": {
"auto_set": "Automatické nastavení",
"super_freeze": "Super Freeze",
"no_mode": "Není vybrán žádný režim"
}
}
}
}
}
},

View File

@ -1330,6 +1330,33 @@
"climate": {
"air_conditioner": {
"name": "Klimaanlage"
},
"fridge": {
"name": "Kühlschrank",
"state_attributes": {
"preset_mode": {
"name": "Kühlschrank-Modi",
"state": {
"auto_set": "Auto-Set",
"super_cool": "Super Cool",
"holiday": "Holiday",
"no_mode": "Kein Modus ausgewählt"
}
}
}
},
"freezer": {
"name": "Gefrierschrank",
"state_attributes": {
"preset_mode": {
"name": "Gefrierschrank-Modi",
"state": {
"auto_set": "Auto-Set",
"super_freeze": "Super Freeze",
"no_mode": "Kein Modus ausgewählt"
}
}
}
}
}
},

View File

@ -1330,6 +1330,33 @@
"climate": {
"air_conditioner": {
"name": "Κλιματιστικό"
},
"fridge": {
"name": "Ψυγείο",
"state_attributes": {
"preset_mode": {
"name": "Λειτουργίες ψυγείου",
"state": {
"auto_set": "Αυτόματη ρύθμιση",
"super_cool": "Super Cool",
"holiday": "Holiday",
"no_mode": "Δεν επιλέχθηκε λειτουργία"
}
}
}
},
"freezer": {
"name": "Καταψύκτης",
"state_attributes": {
"preset_mode": {
"name": "Λειτουργίες κατάψυξης",
"state": {
"auto_set": "Αυτόματη ρύθμιση",
"super_freeze": "Super Freeze",
"no_mode": "Δεν επιλέχθηκε λειτουργία"
}
}
}
}
}
},

View File

@ -1394,6 +1394,33 @@
"climate": {
"air_conditioner": {
"name": "Air conditioner"
},
"fridge": {
"name": "Fridge",
"state_attributes": {
"preset_mode": {
"name": "Fridge modes",
"state": {
"auto_set": "Auto-Set",
"super_cool": "Super Cool",
"holiday": "Holiday",
"no_mode": "No mode selected"
}
}
}
},
"freezer": {
"name": "Freezer",
"state_attributes": {
"preset_mode": {
"name": "Freezer modes",
"state": {
"auto_set": "Auto-Set",
"super_freeze": "Super Freeze",
"no_mode": "No mode selected"
}
}
}
}
}
}

View File

@ -1330,6 +1330,33 @@
"climate": {
"air_conditioner": {
"name": "Aire acondicionado"
},
"fridge": {
"name": "Frigorífico",
"state_attributes": {
"preset_mode": {
"name": "Modos de frigorífico",
"state": {
"auto_set": "Auto-Set",
"super_cool": "Super Cool",
"holiday": "Holiday",
"no_mode": "No se ha seleccionado ningún modo"
}
}
}
},
"freezer": {
"name": "Congelador",
"state_attributes": {
"preset_mode": {
"name": "Modos congelador",
"state": {
"auto_set": "Auto-Set",
"super_freeze": "Super Freeze",
"no_mode": "No se ha seleccionado ningún modo"
}
}
}
}
}
},

View File

@ -1330,6 +1330,33 @@
"climate": {
"air_conditioner": {
"name": "Climatiseur"
},
"fridge": {
"name": "Réfrigérateur",
"state_attributes": {
"preset_mode": {
"name": "Modes réfrigérateur",
"state": {
"auto_set": "Réglage automatique",
"super_cool": "Super Cool",
"holiday": "Holiday",
"no_mode": "Aucun mode sélectionné"
}
}
}
},
"freezer": {
"name": "Congélateur",
"state_attributes": {
"preset_mode": {
"name": "Modes congélateur",
"state": {
"auto_set": "Réglage automatique",
"super_freeze": "Super Freeze",
"no_mode": "Aucun mode sélectionné"
}
}
}
}
}
},

View File

@ -778,6 +778,33 @@
"climate": {
"air_conditioner": {
"name": "Air conditioner"
},
"fridge": {
"name": "Fridge",
"state_attributes": {
"preset_mode": {
"name": "Fridge modes",
"state": {
"auto_set": "Auto-Set",
"super_cool": "Super Cool",
"holiday": "Holiday",
"no_mode": "No mode selected"
}
}
}
},
"freezer": {
"name": "Freezer",
"state_attributes": {
"preset_mode": {
"name": "Freezer modes",
"state": {
"auto_set": "Auto-Set",
"super_freeze": "Super Freeze",
"no_mode": "No mode selected"
}
}
}
}
}
},

View File

@ -1330,6 +1330,33 @@
"climate": {
"air_conditioner": {
"name": "Klimatizacijski uređaj"
},
"fridge": {
"name": "Hladnjak",
"state_attributes": {
"preset_mode": {
"name": "Načini rada za hladnjak",
"state": {
"auto_set": "Automatsko postavljanje",
"super_cool": "Super Cool",
"holiday": "Holiday",
"no_mode": "Nije odabran način rada"
}
}
}
},
"freezer": {
"name": "Zamrzivač",
"state_attributes": {
"preset_mode": {
"name": "Načini rada za zamrzavanje",
"state": {
"auto_set": "Automatsko postavljanje",
"super_freeze": "Super Freeze",
"no_mode": "Nije odabran način rada"
}
}
}
}
}
},

View File

@ -1382,6 +1382,33 @@
"climate": {
"air_conditioner": {
"name": "Condizionatore"
},
"fridge": {
"name": "Frigorifero",
"state_attributes": {
"preset_mode": {
"name": "Modalità del frigorifero",
"state": {
"auto_set": "Impostazione automatica",
"super_cool": "Super Cool",
"holiday": "Holiday",
"no_mode": "Nessuna modalità selezionata"
}
}
}
},
"freezer": {
"name": "Congelatore",
"state_attributes": {
"preset_mode": {
"name": "Modalità del congelatore",
"state": {
"auto_set": "Impostazione automatica",
"super_freeze": "Super Freeze",
"no_mode": "Nessuna modalità selezionata"
}
}
}
}
}
}

View File

@ -1330,6 +1330,33 @@
"climate": {
"air_conditioner": {
"name": "Airconditioner"
},
"fridge": {
"name": "Koelkast",
"state_attributes": {
"preset_mode": {
"name": "Koelkastmodi",
"state": {
"auto_set": "Automatisch instellen",
"super_cool": "Super Cool",
"holiday": "Holiday",
"no_mode": "Geen modus geselecteerd"
}
}
}
},
"freezer": {
"name": "Vriezer",
"state_attributes": {
"preset_mode": {
"name": "Vriezermodi",
"state": {
"auto_set": "Automatisch instellen",
"super_freeze": "Super Freeze",
"no_mode": "Geen modus geselecteerd"
}
}
}
}
}
},

View File

@ -1330,6 +1330,33 @@
"climate": {
"air_conditioner": {
"name": "Klimatyzator"
},
"fridge": {
"name": "Lodówka",
"state_attributes": {
"preset_mode": {
"name": "Tryby pracy lodówki",
"state": {
"auto_set": "Ustawianie automatyczne",
"super_cool": "Super Cool",
"holiday": "Holiday",
"no_mode": "Nie wybrano żadnego trybu"
}
}
}
},
"freezer": {
"name": "Zamrażarka",
"state_attributes": {
"preset_mode": {
"name": "Tryby pracy zamrażarki",
"state": {
"auto_set": "Ustawianie automatyczne",
"super_freeze": "Super Freeze",
"no_mode": "Nie wybrano żadnego trybu"
}
}
}
}
}
},

View File

@ -1330,6 +1330,33 @@
"climate": {
"air_conditioner": {
"name": "Ar Condicionado"
},
"fridge": {
"name": "Frigorífico",
"state_attributes": {
"preset_mode": {
"name": "Modos do frigorífico",
"state": {
"auto_set": "Ajuste automático",
"super_cool": "Super Cool",
"holiday": "Holiday",
"no_mode": "Nenhum modo selecionado"
}
}
}
},
"freezer": {
"name": "Congelador",
"state_attributes": {
"preset_mode": {
"name": "Modos do congelador",
"state": {
"auto_set": "Ajuste automático",
"super_freeze": "Super Freeze",
"no_mode": "Nenhum modo selecionado"
}
}
}
}
}
},

View File

@ -1330,6 +1330,33 @@
"climate": {
"air_conditioner": {
"name": "Aer condiționat"
},
"fridge": {
"name": "Frigider",
"state_attributes": {
"preset_mode": {
"name": "Moduri frigider",
"state": {
"auto_set": "Setare automată",
"super_cool": "Super Cool",
"holiday": "Holiday",
"no_mode": "Niciun mod selectat"
}
}
}
},
"freezer": {
"name": "Congelator",
"state_attributes": {
"preset_mode": {
"name": "Moduri de congelare",
"state": {
"auto_set": "Setare automată",
"super_freeze": "Super Freeze",
"no_mode": "Niciun mod selectat"
}
}
}
}
}
},

View File

@ -1330,6 +1330,33 @@
"climate": {
"air_conditioner": {
"name": "Кондиционер воздуха"
},
"fridge": {
"name": "Холодильник",
"state_attributes": {
"preset_mode": {
"name": "Режимы холодильника",
"state": {
"auto_set": "Автоматическая установка",
"super_cool": "Super Cool",
"holiday": "Holiday",
"no_mode": "Режим не выбран"
}
}
}
},
"freezer": {
"name": "Морозильник",
"state_attributes": {
"preset_mode": {
"name": "Режимы морозильного отделения",
"state": {
"auto_set": "Автоматическая установка",
"super_freeze": "Super Freeze",
"no_mode": "Режим не выбран"
}
}
}
}
}
},

View File

@ -1330,6 +1330,33 @@
"climate": {
"air_conditioner": {
"name": "Klimatizácia"
},
"fridge": {
"name": "Chladnička",
"state_attributes": {
"preset_mode": {
"name": "Režimy chladničky",
"state": {
"auto_set": "Automatické nastavenie",
"super_cool": "Super Cool",
"holiday": "Holiday",
"no_mode": "Nie je vybraný žiadny režim"
}
}
}
},
"freezer": {
"name": "Mraznička",
"state_attributes": {
"preset_mode": {
"name": "Režimy mrazničky",
"state": {
"auto_set": "Automatické nastavenie",
"super_freeze": "Super Freeze",
"no_mode": "Nie je vybraný žiadny režim"
}
}
}
}
}
},

View File

@ -1330,6 +1330,33 @@
"climate": {
"air_conditioner": {
"name": "Klimatska naprava"
},
"fridge": {
"name": "Hladilnik",
"state_attributes": {
"preset_mode": {
"name": "Načini hladilnika",
"state": {
"auto_set": "Samodejna nastavitev",
"super_cool": "Super Cool",
"holiday": "Holiday",
"no_mode": "Izbran ni noben način"
}
}
}
},
"freezer": {
"name": "Zamrzovalnik",
"state_attributes": {
"preset_mode": {
"name": "Načini zamrzovalnika",
"state": {
"auto_set": "Samodejna nastavitev",
"super_freeze": "Super Freeze",
"no_mode": "Izbran ni noben način"
}
}
}
}
}
},

View File

@ -1330,6 +1330,33 @@
"climate": {
"air_conditioner": {
"name": "Klima uređaj"
},
"fridge": {
"name": "Frižider",
"state_attributes": {
"preset_mode": {
"name": "Režimi frižidera",
"state": {
"auto_set": "Automatsko podešavanje",
"super_cool": "Super Cool",
"holiday": "Holiday",
"no_mode": "Nije izabran nijedan režim"
}
}
}
},
"freezer": {
"name": "Zamrzivač",
"state_attributes": {
"preset_mode": {
"name": "Režimi zamrzivača",
"state": {
"auto_set": "Automatsko podešavanje",
"super_freeze": "Super Freeze",
"no_mode": "Nije izabran nijedan režim"
}
}
}
}
}
},

View File

@ -1330,6 +1330,33 @@
"climate": {
"air_conditioner": {
"name": "Klima"
},
"fridge": {
"name": "Buzdolabı",
"state_attributes": {
"preset_mode": {
"name": "Buzdolabı modları",
"state": {
"auto_set": "Otomatik Ayarla",
"super_cool": "Super Cool",
"holiday": "Holiday",
"no_mode": "Hiç mod seçilmedi"
}
}
}
},
"freezer": {
"name": "Dondurucu",
"state_attributes": {
"preset_mode": {
"name": "Dondurucu modları",
"state": {
"auto_set": "Otomatik Ayarla",
"super_freeze": "Super Freeze",
"no_mode": "Hiç mod seçilmedi"
}
}
}
}
}
},

View File

@ -1330,6 +1330,33 @@
"climate": {
"air_conditioner": {
"name": "空调"
},
"fridge": {
"name": "冰箱",
"state_attributes": {
"preset_mode": {
"name": "冰箱模式",
"state": {
"auto_set": "自动设置",
"super_cool": "Super Cool",
"holiday": "Holiday",
"no_mode": "未选择模式"
}
}
}
},
"freezer": {
"name": "冷藏箱",
"state_attributes": {
"preset_mode": {
"name": "冷藏室模式",
"state": {
"auto_set": "自动设置",
"super_freeze": "Super Freeze",
"no_mode": "未选择模式"
}
}
}
}
}
},

View File

@ -73,6 +73,7 @@ Support has been confirmed for these models, but many more will work. Please add
- Hoover HFB 6B2S3FX
- Hoover HLE C10DCE-80
- Hoover HSOT3161WG
- Hoover HW 68AMC/1-80
- Hoover HWPD 69AMBC/1-S
- Hoover HWPS4954DAMR-11
- Hoover NDE H10A2TCE-80

View File

@ -44,6 +44,30 @@ PROGRAMS = {
},
}
CLIMATE = {
"fridge": {
"preset_mode": {
"name": "REF_CMD&CTRL.MODE_SELECTION_DRAWER_FRIDGE.FRIDGE_MODE_TITLE",
"state": {
"auto_set": "REF_CMD&CTRL.MODALITIES.ECO",
"super_cool": "REF_CMD&CTRL.MODALITIES.SUPER_COOL",
"holiday": "REF_CMD&CTRL.MODALITIES.BACK_FROM_HOLIDAY",
"no_mode": "REF_CMD&CTRL.MODALITIES.NO_MODE_SELECTED",
},
}
},
"freezer": {
"preset_mode": {
"name": "REF_CMD&CTRL.MODE_SELECTION_DRAWER_FREEZER.FREEZER_MODE_TITLE",
"state": {
"auto_set": "REF_CMD&CTRL.MODALITIES.ECO",
"super_freeze": "REF_CMD&CTRL.MODALITIES.SHOCK_FREEZE",
"no_mode": "REF_CMD&CTRL.MODALITIES.NO_MODE_SELECTED",
},
}
},
}
NAMES = {
"switch": {
"anti_crease": "HDRY_CMD&CTRL.PROGRAM_CYCLE_DETAIL.ANTICREASE_TITLE",
@ -197,7 +221,11 @@ NAMES = {
"freezer_temp_sel": ["OV.COMMON.GOAL_TEMPERATURE", "REF.ZONES.FREEZER"],
"fridge_temp_sel": ["OV.COMMON.GOAL_TEMPERATURE", "REF.ZONES.FRIDGE"],
},
"climate": {"air_conditioner": "GLOBALS.APPLIANCES_NAME.AC"},
"climate": {
"air_conditioner": "GLOBALS.APPLIANCES_NAME.AC",
"fridge": "REF.ZONES.FRIDGE",
"freezer": "REF.ZONES.FREEZER",
},
}
@ -298,6 +326,15 @@ def main():
for name, key in data.items():
select = old.setdefault("entity", {}).setdefault(entity, {})
select.setdefault(name, {})["name"] = load_key(key, original, fallback)
for name, modes in CLIMATE.items():
climate = old.setdefault("entity", {}).setdefault("climate", {})
attr = climate.setdefault(name, {}).setdefault("state_attributes", {})
for mode, data in modes.items():
mode_name = load_key(data["name"], original, fallback)
attr.setdefault(mode, {})["name"] = mode_name
for state, key in data["state"].items():
mode_state = load_key(key, original, fallback)
attr[mode].setdefault("state", {})[state] = mode_state
translate_login(old, original, fallback)
save_json(base_path / f"{language}.json", old)

View File

@ -14,7 +14,11 @@ from custom_components.hon.climate import CLIMATES
from custom_components.hon.number import NUMBERS
from custom_components.hon.select import SELECTS
from custom_components.hon.sensor import SENSORS
from custom_components.hon.switch import SWITCHES, HonSwitchEntityDescription
from custom_components.hon.switch import (
SWITCHES,
HonControlSwitchEntityDescription,
HonSwitchEntityDescription,
)
APPLIANCES = {
"AC": "Air conditioner",
@ -50,11 +54,7 @@ result = {}
for entity_type, appliances in entities.items():
for appliance, data in appliances.items():
for entity in data:
if (
isinstance(entity, HonSwitchEntityDescription)
and entity.entity_category != "config"
and "settings." not in entity.key
):
if isinstance(entity, HonControlSwitchEntityDescription):
key = f"{entity.turn_on_key}` / `{entity.turn_off_key}"
else:
key = entity.key
@ -62,7 +62,8 @@ for entity_type, appliances in entities.items():
category = (
"control"
if entity.key.startswith("settings")
or hasattr(entity, "turn_on_key")
or isinstance(entity, HonSwitchEntityDescription)
or isinstance(entity, HonControlSwitchEntityDescription)
or entity_type in ["button", "climate"]
else "sensor"
)