2021-08-08 09:39:32 -06:00
|
|
|
import logging
|
|
|
|
from typing import List
|
|
|
|
|
|
|
|
from homeassistant.helpers.entity import Entity
|
|
|
|
from gehomesdk.erd import ErdCode, ErdApplianceType
|
|
|
|
|
|
|
|
from .base import ApplianceApi
|
2021-12-11 16:42:07 -07:00
|
|
|
from ..entities import GeSacClimate, GeErdSensor, GeErdSwitch, ErdOnOffBoolConverter
|
2021-08-08 09:39:32 -06:00
|
|
|
|
|
|
|
_LOGGER = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
class SacApi(ApplianceApi):
|
|
|
|
"""API class for Split AC objects"""
|
|
|
|
APPLIANCE_TYPE = ErdApplianceType.SPLIT_AIR_CONDITIONER
|
|
|
|
|
|
|
|
def get_all_entities(self) -> List[Entity]:
|
|
|
|
base_entities = super().get_all_entities()
|
|
|
|
|
|
|
|
sac_entities = [
|
|
|
|
GeSacClimate(self),
|
2021-12-10 22:18:28 -07:00
|
|
|
GeErdSensor(self, ErdCode.AC_TARGET_TEMPERATURE),
|
|
|
|
GeErdSensor(self, ErdCode.AC_AMBIENT_TEMPERATURE),
|
2021-08-08 09:39:32 -06:00
|
|
|
GeErdSensor(self, ErdCode.AC_FAN_SETTING, icon_override="mdi:fan"),
|
|
|
|
GeErdSensor(self, ErdCode.AC_OPERATION_MODE),
|
|
|
|
GeErdSwitch(self, ErdCode.AC_POWER_STATUS, bool_converter=ErdOnOffBoolConverter(), icon_on_override="mdi:power-on", icon_off_override="mdi:power-off"),
|
|
|
|
]
|
|
|
|
|
|
|
|
if self.has_erd_code(ErdCode.SAC_SLEEP_MODE):
|
2021-08-09 10:33:52 -06:00
|
|
|
sac_entities.append(GeErdSwitch(self, ErdCode.SAC_SLEEP_MODE, bool_converter=ErdOnOffBoolConverter(), icon_on_override="mdi:sleep", icon_off_override="mdi:sleep-off"))
|
2021-08-08 09:39:32 -06:00
|
|
|
if self.has_erd_code(ErdCode.SAC_AUTO_SWING_MODE):
|
2021-08-09 10:33:52 -06:00
|
|
|
sac_entities.append(GeErdSwitch(self, ErdCode.SAC_AUTO_SWING_MODE, bool_converter=ErdOnOffBoolConverter(), icon_on_override="mdi:arrow-decision-auto", icon_off_override="mdi:arrow-decision-auto-outline"))
|
2021-08-08 09:39:32 -06:00
|
|
|
|
|
|
|
|
|
|
|
entities = base_entities + sac_entities
|
|
|
|
return entities
|
|
|
|
|