- more naming changes

This commit is contained in:
Jack Simbah 2020-12-18 00:00:48 -05:00
parent 0475306eb5
commit 32a93cfea0
4 changed files with 25 additions and 12 deletions

View File

@ -133,16 +133,16 @@ class OvenApi(ApplianceApi):
base_entities = super().get_all_entities() base_entities = super().get_all_entities()
oven_config: OvenConfiguration = self.appliance.get_erd_value(ErdCode.OVEN_CONFIGURATION) oven_config: OvenConfiguration = self.appliance.get_erd_value(ErdCode.OVEN_CONFIGURATION)
_LOGGER.debug(f"Oven Config: {oven_config}") _LOGGER.debug(f"Oven Config: {oven_config}")
oven_entities = [ oven_entities = []
if oven_config.has_lower_oven:
oven_entities.extend([
GeErdSensor(self, ErdCode.UPPER_OVEN_COOK_MODE), GeErdSensor(self, ErdCode.UPPER_OVEN_COOK_MODE),
GeErdSensor(self, ErdCode.UPPER_OVEN_COOK_TIME_REMAINING), GeErdSensor(self, ErdCode.UPPER_OVEN_COOK_TIME_REMAINING),
GeErdSensor(self, ErdCode.UPPER_OVEN_KITCHEN_TIMER), GeErdSensor(self, ErdCode.UPPER_OVEN_KITCHEN_TIMER),
GeErdSensor(self, ErdCode.UPPER_OVEN_USER_TEMP_OFFSET), GeErdSensor(self, ErdCode.UPPER_OVEN_USER_TEMP_OFFSET),
GeErdBinarySensor(self, ErdCode.UPPER_OVEN_REMOTE_ENABLED), GeErdBinarySensor(self, ErdCode.UPPER_OVEN_REMOTE_ENABLED),
]
if oven_config.has_lower_oven:
oven_entities.extend([
GeErdSensor(self, ErdCode.LOWER_OVEN_COOK_MODE), GeErdSensor(self, ErdCode.LOWER_OVEN_COOK_MODE),
GeErdSensor(self, ErdCode.LOWER_OVEN_COOK_TIME_REMAINING), GeErdSensor(self, ErdCode.LOWER_OVEN_COOK_TIME_REMAINING),
GeErdSensor(self, ErdCode.LOWER_OVEN_USER_TEMP_OFFSET), GeErdSensor(self, ErdCode.LOWER_OVEN_USER_TEMP_OFFSET),
@ -151,7 +151,14 @@ class OvenApi(ApplianceApi):
GeOvenHeaterEntity(self, UPPER_OVEN, True), GeOvenHeaterEntity(self, UPPER_OVEN, True),
]) ])
else: else:
oven_entities.append(GeOvenHeaterEntity(self, UPPER_OVEN, False)) oven_entities.extend([
GeErdSensor(self, ErdCode.UPPER_OVEN_COOK_MODE, "Oven Cook Mode"),
GeErdSensor(self, ErdCode.UPPER_OVEN_COOK_TIME_REMAINING, "Oven Cook Time Remaining"),
GeErdSensor(self, ErdCode.UPPER_OVEN_KITCHEN_TIMER, "Oven Kitchen Timer"),
GeErdSensor(self, ErdCode.UPPER_OVEN_USER_TEMP_OFFSET, "Oven User Temp Offset"),
GeErdBinarySensor(self, ErdCode.UPPER_OVEN_REMOTE_ENABLED, "Oven Remote Enabled"),
GeOvenHeaterEntity(self, UPPER_OVEN, False)
])
return base_entities + oven_entities return base_entities + oven_entities

View File

@ -82,7 +82,7 @@ class GeAbstractFridgeEntity(GeEntity, WaterHeaterEntity, metaclass=abc.ABCMeta)
@property @property
def name(self) -> Optional[str]: def name(self) -> Optional[str]:
return f"{self.heater_type.title()} {self.serial_number}" return f"{self.serial_number} {self.heater_type.title()}"
@property @property
def temperature_unit(self): def temperature_unit(self):

View File

@ -81,7 +81,7 @@ class GeOvenHeaterEntity(GeEntity, WaterHeaterEntity):
else: else:
oven_title = "Oven" oven_title = "Oven"
return f"{oven_title} {self.serial_number}" return f"{self.serial_number} {oven_title}"
@property @property
def temperature_unit(self): def temperature_unit(self):

View File

@ -200,9 +200,10 @@ class GeEntity:
class GeErdEntity(GeEntity): class GeErdEntity(GeEntity):
"""Parent class for GE entities tied to a specific ERD""" """Parent class for GE entities tied to a specific ERD"""
def __init__(self, api: "ApplianceApi", erd_code: ErdCodeType): def __init__(self, api: "ApplianceApi", erd_code: ErdCodeType, erd_override: str = None):
super().__init__(api) super().__init__(api)
self._erd_code = translate_erd_code(erd_code) self._erd_code = translate_erd_code(erd_code)
self._erd_override = erd_override
@property @property
def erd_code(self) -> ErdCodeType: def erd_code(self) -> ErdCodeType:
@ -218,6 +219,11 @@ class GeErdEntity(GeEntity):
@property @property
def name(self) -> Optional[str]: def name(self) -> Optional[str]:
erd_string = self.erd_string erd_string = self.erd_string
#override the name if specified
if self._erd_override != None:
erd_string = self._erd_override
erd_title = " ".join(erd_string.split("_")).title() erd_title = " ".join(erd_string.split("_")).title()
return f"{self.serial_number} {erd_title}" return f"{self.serial_number} {erd_title}"