2021-07-10 20:48:28 -06:00
|
|
|
import logging
|
|
|
|
from typing import List
|
|
|
|
|
|
|
|
from homeassistant.helpers.entity import Entity
|
2021-12-10 22:18:28 -07:00
|
|
|
from gehomesdk.erd import ErdCode, ErdApplianceType, ErdDataType
|
2021-07-10 20:48:28 -06:00
|
|
|
|
|
|
|
from .base import ApplianceApi
|
2021-08-07 12:36:40 -06:00
|
|
|
from ..entities import GeAdvantium, GeErdSensor, GeErdBinarySensor, GeErdPropertySensor, GeErdPropertyBinarySensor, UPPER_OVEN
|
2021-07-10 20:48:28 -06:00
|
|
|
|
|
|
|
_LOGGER = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
class AdvantiumApi(ApplianceApi):
|
|
|
|
"""API class for Advantium objects"""
|
|
|
|
APPLIANCE_TYPE = ErdApplianceType.ADVANTIUM
|
|
|
|
|
|
|
|
def get_all_entities(self) -> List[Entity]:
|
|
|
|
base_entities = super().get_all_entities()
|
|
|
|
|
|
|
|
advantium_entities = [
|
|
|
|
GeErdSensor(self, ErdCode.UNIT_TYPE),
|
|
|
|
GeErdBinarySensor(self, ErdCode.UPPER_OVEN_REMOTE_ENABLED, self._single_name(ErdCode.UPPER_OVEN_REMOTE_ENABLED)),
|
|
|
|
GeErdBinarySensor(self, ErdCode.MICROWAVE_REMOTE_ENABLE),
|
|
|
|
GeErdSensor(self, ErdCode.UPPER_OVEN_DISPLAY_TEMPERATURE, self._single_name(ErdCode.UPPER_OVEN_DISPLAY_TEMPERATURE)),
|
|
|
|
GeErdSensor(self, ErdCode.ADVANTIUM_KITCHEN_TIME_REMAINING),
|
|
|
|
GeErdSensor(self, ErdCode.ADVANTIUM_COOK_TIME_REMAINING),
|
2021-07-16 21:11:11 -06:00
|
|
|
GeAdvantium(self),
|
2021-07-10 20:48:28 -06:00
|
|
|
|
|
|
|
#Cook Status
|
|
|
|
GeErdPropertySensor(self, ErdCode.ADVANTIUM_COOK_STATUS, "cook_mode"),
|
2021-07-24 11:12:35 -06:00
|
|
|
GeErdPropertySensor(self, ErdCode.ADVANTIUM_COOK_STATUS, "termination_reason", icon_override="mdi:information-outline"),
|
|
|
|
GeErdPropertySensor(self, ErdCode.ADVANTIUM_COOK_STATUS, "preheat_status", icon_override="mdi:fire"),
|
2021-12-10 22:18:28 -07:00
|
|
|
GeErdPropertySensor(self, ErdCode.ADVANTIUM_COOK_STATUS, "temperature", icon_override="mdi:thermometer", data_type_override=ErdDataType.INT),
|
|
|
|
GeErdPropertySensor(self, ErdCode.ADVANTIUM_COOK_STATUS, "power_level", icon_override="mdi:gauge", data_type_override=ErdDataType.INT),
|
2021-07-24 11:12:35 -06:00
|
|
|
GeErdPropertySensor(self, ErdCode.ADVANTIUM_COOK_STATUS, "warm_status", icon_override="mdi:radiator"),
|
|
|
|
GeErdPropertyBinarySensor(self, ErdCode.ADVANTIUM_COOK_STATUS, "door_status", device_class_override="door"),
|
|
|
|
GeErdPropertyBinarySensor(self, ErdCode.ADVANTIUM_COOK_STATUS, "sensing_active", icon_on_override="mdi:flash-auto", icon_off_override="mdi:flash-off"),
|
|
|
|
GeErdPropertyBinarySensor(self, ErdCode.ADVANTIUM_COOK_STATUS, "cooling_fan_status", icon_on_override="mdi:fan", icon_off_override="mdi:fan-off"),
|
|
|
|
GeErdPropertyBinarySensor(self, ErdCode.ADVANTIUM_COOK_STATUS, "oven_light_status", icon_on_override="mdi:lightbulb-on", icon_off_override="mdi:lightbulb-off"),
|
2021-07-10 20:48:28 -06:00
|
|
|
]
|
|
|
|
entities = base_entities + advantium_entities
|
|
|
|
return entities
|
|
|
|
|
|
|
|
def _single_name(self, erd_code: ErdCode):
|
|
|
|
return erd_code.name.replace(UPPER_OVEN+"_","").replace("_", " ").title()
|
|
|
|
|