- added logic to prevent oven mode changes if not remote enabled

- added additional cook modes to oven op list
This commit is contained in:
Jack Simbach 2020-12-29 19:32:48 -05:00
parent a900c15002
commit 8dfb9c23ed
2 changed files with 50 additions and 27 deletions

View File

@ -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
})

View File

@ -33,7 +33,10 @@ class GeOven(GeWaterHeater):
@property
def supported_features(self):
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,6 +133,7 @@ class GeOven(GeWaterHeater):
async def async_set_operation_mode(self, operation_mode: str):
"""Set the operation mode."""
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.
@ -142,6 +152,8 @@ class GeOven(GeWaterHeater):
async def async_set_temperature(self, **kwargs):
"""Set the cook temperature"""
if self.remote_enabled:
target_temp = kwargs.get(ATTR_TEMPERATURE)
if target_temp is None:
return