2020-12-28 16:36:38 -07:00
|
|
|
"""GE Kitchen Sensor Entities - Dispenser"""
|
2020-12-17 19:20:43 -07:00
|
|
|
|
2020-12-28 16:36:38 -07:00
|
|
|
import logging
|
|
|
|
from typing import List, Optional
|
2020-12-17 19:20:43 -07:00
|
|
|
|
|
|
|
from gekitchen import (
|
|
|
|
ErdCode,
|
|
|
|
ErdPresent,
|
2020-12-28 16:36:38 -07:00
|
|
|
ErdPodStatus,
|
2020-12-17 19:20:43 -07:00
|
|
|
HotWaterStatus
|
|
|
|
)
|
|
|
|
|
2020-12-28 16:36:38 -07:00
|
|
|
from ..common import GeWaterHeater
|
|
|
|
from .const import (
|
|
|
|
HEATER_TYPE_DISPENSER, OP_MODE_K_CUP,
|
2020-12-17 19:20:43 -07:00
|
|
|
OP_MODE_NORMAL,
|
2020-12-28 16:36:38 -07:00
|
|
|
OP_MODE_SABBATH
|
2020-12-17 19:20:43 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
_LOGGER = logging.getLogger(__name__)
|
|
|
|
|
2020-12-28 16:36:38 -07:00
|
|
|
class GeDispenser(GeWaterHeater):
|
|
|
|
"""Entity for in-fridge dispensers"""
|
|
|
|
|
2020-12-17 19:20:43 -07:00
|
|
|
# These values are from FridgeHotWaterFragment.smali in the android app
|
|
|
|
min_temp = 90
|
|
|
|
max_temp = 185
|
|
|
|
|
2020-12-28 16:36:38 -07:00
|
|
|
heater_type = HEATER_TYPE_DISPENSER
|
|
|
|
|
2020-12-17 19:20:43 -07:00
|
|
|
@property
|
|
|
|
def hot_water_status(self) -> HotWaterStatus:
|
|
|
|
"""Access the main status value conveniently."""
|
|
|
|
return self.appliance.get_erd_value(ErdCode.HOT_WATER_STATUS)
|
|
|
|
|
|
|
|
@property
|
|
|
|
def supports_k_cups(self) -> bool:
|
|
|
|
"""Return True if the device supports k-cup brewing."""
|
|
|
|
status = self.hot_water_status
|
|
|
|
return status.pod_status != ErdPodStatus.NA and status.brew_module != ErdPresent.NA
|
|
|
|
|
|
|
|
@property
|
|
|
|
def operation_list(self) -> List[str]:
|
|
|
|
"""Supported Operations List"""
|
|
|
|
ops_list = [OP_MODE_NORMAL, OP_MODE_SABBATH]
|
|
|
|
if self.supports_k_cups:
|
|
|
|
ops_list.append(OP_MODE_K_CUP)
|
|
|
|
return ops_list
|
|
|
|
|
|
|
|
async def async_set_temperature(self, **kwargs):
|
|
|
|
pass
|
|
|
|
|
|
|
|
async def async_set_operation_mode(self, operation_mode):
|
|
|
|
pass
|
|
|
|
|
|
|
|
@property
|
|
|
|
def supported_features(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
@property
|
|
|
|
def current_operation(self) -> str:
|
|
|
|
"""Get the current operation mode."""
|
|
|
|
if self.appliance.get_erd_value(ErdCode.SABBATH_MODE):
|
|
|
|
return OP_MODE_SABBATH
|
|
|
|
return OP_MODE_NORMAL
|
|
|
|
|
|
|
|
@property
|
|
|
|
def current_temperature(self) -> Optional[int]:
|
|
|
|
"""Return the current temperature."""
|
|
|
|
return self.hot_water_status.current_temp
|