mirror of
https://github.com/Andre0512/hon.git
synced 2025-05-27 13:14:14 -04:00
Add climate entites for fridge #41
This commit is contained in:
parent
a8762367ed
commit
cb660fa9e0
27 changed files with 706 additions and 38 deletions
|
@ -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)
|
||||
|
||||
|
|
|
@ -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"
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue