- 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()
oven_config: OvenConfiguration = self.appliance.get_erd_value(ErdCode.OVEN_CONFIGURATION)
_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_TIME_REMAINING),
GeErdSensor(self, ErdCode.UPPER_OVEN_KITCHEN_TIMER),
GeErdSensor(self, ErdCode.UPPER_OVEN_USER_TEMP_OFFSET),
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_TIME_REMAINING),
GeErdSensor(self, ErdCode.LOWER_OVEN_USER_TEMP_OFFSET),
@ -151,7 +151,14 @@ class OvenApi(ApplianceApi):
GeOvenHeaterEntity(self, UPPER_OVEN, True),
])
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

View File

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

View File

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

View File

@ -200,9 +200,10 @@ class GeEntity:
class GeErdEntity(GeEntity):
"""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)
self._erd_code = translate_erd_code(erd_code)
self._erd_override = erd_override
@property
def erd_code(self) -> ErdCodeType:
@ -218,6 +219,11 @@ class GeErdEntity(GeEntity):
@property
def name(self) -> Optional[str]:
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()
return f"{self.serial_number} {erd_title}"