mirror of https://github.com/simbaja/ha_gehome.git
- added logic to prevent oven mode changes if not remote enabled
- added additional cook modes to oven op list
This commit is contained in:
parent
a900c15002
commit
8dfb9c23ed
|
@ -6,6 +6,7 @@ from homeassistant.components.water_heater import (
|
|||
)
|
||||
from gekitchensdk import ErdOvenCookMode
|
||||
|
||||
SUPPORT_NONE = 0
|
||||
GE_OVEN_SUPPORT = (SUPPORT_OPERATION_MODE | SUPPORT_TARGET_TEMPERATURE)
|
||||
|
||||
OP_MODE_OFF = "Off"
|
||||
|
@ -14,6 +15,11 @@ OP_MODE_CONVMULTIBAKE = "Conv. Multi-Bake"
|
|||
OP_MODE_CONVBAKE = "Convection Bake"
|
||||
OP_MODE_CONVROAST = "Convection Roast"
|
||||
OP_MODE_COOK_UNK = "Unknown"
|
||||
OP_MODE_PIZZA = "Frozen Pizza"
|
||||
OP_MODE_FROZEN_SNACKS = "Frozen Snacks"
|
||||
OP_MODE_BAKED_GOODS = "Baked Goods"
|
||||
OP_MODE_FROZEN_PIZZA_MULTI = "Frozen Pizza Multi"
|
||||
OP_MODE_FROZEN_SNACKS_MULTI = "Frozen Snacks Multi"
|
||||
|
||||
UPPER_OVEN = "UPPER_OVEN"
|
||||
LOWER_OVEN = "LOWER_OVEN"
|
||||
|
@ -23,6 +29,11 @@ COOK_MODE_OP_MAP = bidict.bidict({
|
|||
ErdOvenCookMode.CONVMULTIBAKE_NOOPTION: OP_MODE_CONVMULTIBAKE,
|
||||
ErdOvenCookMode.CONVBAKE_NOOPTION: OP_MODE_CONVBAKE,
|
||||
ErdOvenCookMode.CONVROAST_NOOPTION: OP_MODE_CONVROAST,
|
||||
ErdOvenCookMode.BAKE_NOOPTION: OP_MODE_BAKE
|
||||
ErdOvenCookMode.BAKE_NOOPTION: OP_MODE_BAKE,
|
||||
ErdOvenCookMode.FROZEN_PIZZA: OP_MODE_PIZZA,
|
||||
ErdOvenCookMode.FROZEN_SNACKS: OP_MODE_FROZEN_SNACKS,
|
||||
ErdOvenCookMode.BAKED_GOODS: OP_MODE_BAKED_GOODS,
|
||||
ErdOvenCookMode.FROZEN_PIZZA_MULTI: OP_MODE_FROZEN_PIZZA_MULTI,
|
||||
ErdOvenCookMode.FROZEN_SNACKS_MULTI: OP_MODE_FROZEN_SNACKS_MULTI
|
||||
})
|
||||
|
||||
|
|
|
@ -33,7 +33,10 @@ class GeOven(GeWaterHeater):
|
|||
|
||||
@property
|
||||
def supported_features(self):
|
||||
return GE_OVEN_SUPPORT
|
||||
if self.remote_enabled:
|
||||
return GE_OVEN_SUPPORT
|
||||
else:
|
||||
return SUPPORT_NONE
|
||||
|
||||
@property
|
||||
def unique_id(self) -> str:
|
||||
|
@ -63,6 +66,12 @@ class GeOven(GeWaterHeater):
|
|||
"""Return the appropriate ERD code for this oven_select"""
|
||||
return ErdCode[f"{self.oven_select}_{suffix}"]
|
||||
|
||||
@property
|
||||
def remote_enabled(self) -> bool:
|
||||
"""Returns whether the oven is remote enabled"""
|
||||
value = self.get_erd_value("REMOTE_ENABLED")
|
||||
return value == True
|
||||
|
||||
@property
|
||||
def current_temperature(self) -> Optional[int]:
|
||||
current_temp = self.get_erd_value("DISPLAY_TEMPERATURE")
|
||||
|
@ -124,37 +133,40 @@ class GeOven(GeWaterHeater):
|
|||
async def async_set_operation_mode(self, operation_mode: str):
|
||||
"""Set the operation mode."""
|
||||
|
||||
erd_cook_mode = COOK_MODE_OP_MAP.inverse[operation_mode]
|
||||
# Pick a temperature to set. If there's not one already set, default to
|
||||
# good old 350F.
|
||||
if operation_mode == OP_MODE_OFF:
|
||||
target_temp = 0
|
||||
elif self.target_temperature:
|
||||
target_temp = self.target_temperature
|
||||
elif self.temperature_unit == TEMP_FAHRENHEIT:
|
||||
target_temp = 350
|
||||
else:
|
||||
target_temp = 177
|
||||
if self.remote_enabled:
|
||||
erd_cook_mode = COOK_MODE_OP_MAP.inverse[operation_mode]
|
||||
# Pick a temperature to set. If there's not one already set, default to
|
||||
# good old 350F.
|
||||
if operation_mode == OP_MODE_OFF:
|
||||
target_temp = 0
|
||||
elif self.target_temperature:
|
||||
target_temp = self.target_temperature
|
||||
elif self.temperature_unit == TEMP_FAHRENHEIT:
|
||||
target_temp = 350
|
||||
else:
|
||||
target_temp = 177
|
||||
|
||||
new_cook_mode = OvenCookSetting(OVEN_COOK_MODE_MAP[erd_cook_mode], target_temp)
|
||||
erd_code = self.get_erd_code("COOK_MODE")
|
||||
await self.appliance.async_set_erd_value(erd_code, new_cook_mode)
|
||||
new_cook_mode = OvenCookSetting(OVEN_COOK_MODE_MAP[erd_cook_mode], target_temp)
|
||||
erd_code = self.get_erd_code("COOK_MODE")
|
||||
await self.appliance.async_set_erd_value(erd_code, new_cook_mode)
|
||||
|
||||
async def async_set_temperature(self, **kwargs):
|
||||
"""Set the cook temperature"""
|
||||
target_temp = kwargs.get(ATTR_TEMPERATURE)
|
||||
if target_temp is None:
|
||||
return
|
||||
|
||||
current_op = self.current_operation
|
||||
if current_op != OP_MODE_OFF:
|
||||
erd_cook_mode = COOK_MODE_OP_MAP.inverse[current_op]
|
||||
else:
|
||||
erd_cook_mode = ErdOvenCookMode.BAKE_NOOPTION
|
||||
if self.remote_enabled:
|
||||
target_temp = kwargs.get(ATTR_TEMPERATURE)
|
||||
if target_temp is None:
|
||||
return
|
||||
|
||||
new_cook_mode = OvenCookSetting(OVEN_COOK_MODE_MAP[erd_cook_mode], target_temp)
|
||||
erd_code = self.get_erd_code("COOK_MODE")
|
||||
await self.appliance.async_set_erd_value(erd_code, new_cook_mode)
|
||||
current_op = self.current_operation
|
||||
if current_op != OP_MODE_OFF:
|
||||
erd_cook_mode = COOK_MODE_OP_MAP.inverse[current_op]
|
||||
else:
|
||||
erd_cook_mode = ErdOvenCookMode.BAKE_NOOPTION
|
||||
|
||||
new_cook_mode = OvenCookSetting(OVEN_COOK_MODE_MAP[erd_cook_mode], target_temp)
|
||||
erd_code = self.get_erd_code("COOK_MODE")
|
||||
await self.appliance.async_set_erd_value(erd_code, new_cook_mode)
|
||||
|
||||
def get_erd_value(self, suffix: str) -> Any:
|
||||
erd_code = self.get_erd_code(suffix)
|
||||
|
|
Loading…
Reference in New Issue