2021-05-16 10:07:48 -06:00
|
|
|
import logging
|
|
|
|
from typing import List
|
|
|
|
|
|
|
|
from homeassistant.helpers.entity import Entity
|
2021-07-08 12:08:40 -06:00
|
|
|
from gehomesdk import ErdCode, ErdApplianceType
|
2021-05-16 10:07:48 -06:00
|
|
|
|
|
|
|
from .base import ApplianceApi
|
|
|
|
from ..entities import GeErdSensor, GeErdBinarySensor
|
|
|
|
|
|
|
|
_LOGGER = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
class WasherApi(ApplianceApi):
|
|
|
|
"""API class for washer objects"""
|
|
|
|
APPLIANCE_TYPE = ErdApplianceType.WASHER
|
|
|
|
|
|
|
|
def get_all_entities(self) -> List[Entity]:
|
|
|
|
base_entities = super().get_all_entities()
|
|
|
|
|
2021-07-08 12:08:40 -06:00
|
|
|
common_entities = [
|
2021-05-16 10:07:48 -06:00
|
|
|
GeErdSensor(self, ErdCode.LAUNDRY_MACHINE_STATE),
|
2021-07-08 12:08:40 -06:00
|
|
|
GeErdSensor(self, ErdCode.LAUNDRY_CYCLE),
|
|
|
|
GeErdSensor(self, ErdCode.LAUNDRY_SUB_CYCLE),
|
2021-05-16 10:07:48 -06:00
|
|
|
GeErdBinarySensor(self, ErdCode.LAUNDRY_END_OF_CYCLE),
|
|
|
|
GeErdSensor(self, ErdCode.LAUNDRY_TIME_REMAINING),
|
|
|
|
GeErdSensor(self, ErdCode.LAUNDRY_DELAY_TIME_REMAINING),
|
2021-07-08 12:08:40 -06:00
|
|
|
GeErdBinarySensor(self, ErdCode.LAUNDRY_DOOR),
|
|
|
|
GeErdBinarySensor(self, ErdCode.LAUNDRY_REMOTE_STATUS),
|
2021-05-16 10:07:48 -06:00
|
|
|
]
|
2021-07-08 12:08:40 -06:00
|
|
|
|
|
|
|
washer_entities = self.get_washer_entities()
|
|
|
|
|
|
|
|
entities = base_entities + common_entities + washer_entities
|
2021-05-16 10:07:48 -06:00
|
|
|
return entities
|
2021-05-20 09:15:49 -06:00
|
|
|
|
2021-07-08 12:08:40 -06:00
|
|
|
def get_washer_entities(self) -> List[Entity]:
|
|
|
|
washer_entities = [
|
|
|
|
GeErdSensor(self, ErdCode.LAUNDRY_WASHER_SOIL_LEVEL),
|
|
|
|
GeErdSensor(self, ErdCode.LAUNDRY_WASHER_WASHTEMP_LEVEL),
|
|
|
|
GeErdSensor(self, ErdCode.LAUNDRY_WASHER_SPINTIME_LEVEL),
|
|
|
|
GeErdSensor(self, ErdCode.LAUNDRY_WASHER_RINSE_OPTION),
|
|
|
|
]
|
2021-06-28 10:08:41 -06:00
|
|
|
|
2021-07-08 12:08:40 -06:00
|
|
|
if self.has_erd_code(ErdCode.LAUNDRY_WASHER_DOOR_LOCK):
|
|
|
|
washer_entities.extend([GeErdBinarySensor(self, ErdCode.LAUNDRY_WASHER_DOOR_LOCK)])
|
|
|
|
if self.has_erd_code(ErdCode.LAUNDRY_WASHER_TANK_STATUS):
|
|
|
|
washer_entities.extend([GeErdSensor(self, ErdCode.LAUNDRY_WASHER_TANK_STATUS)])
|
|
|
|
if self.has_erd_code(ErdCode.LAUNDRY_WASHER_TANK_SELECTED):
|
|
|
|
washer_entities.extend([GeErdSensor(self, ErdCode.LAUNDRY_WASHER_TANK_SELECTED)])
|
|
|
|
|
2021-07-08 12:58:10 -06:00
|
|
|
return washer_entities
|