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

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