From 7bbeeb679a84ab3f656959fe661187b76eb20799 Mon Sep 17 00:00:00 2001 From: Jack Simbach Date: Tue, 29 Dec 2020 22:49:12 -0500 Subject: [PATCH] - removed guards on the ove set temp/set op (supported modes seems sufficient) --- ge_kitchen/entities/oven/ge_oven.py | 52 ++++++++++++++--------------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/ge_kitchen/entities/oven/ge_oven.py b/ge_kitchen/entities/oven/ge_oven.py index b5af4b4..91ec9eb 100644 --- a/ge_kitchen/entities/oven/ge_oven.py +++ b/ge_kitchen/entities/oven/ge_oven.py @@ -133,40 +133,38 @@ 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. - 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 + 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""" - if self.remote_enabled: - target_temp = kwargs.get(ATTR_TEMPERATURE) - if target_temp is None: - return + 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 + 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) + 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)