diff --git a/custom_components/ge_home/devices/oven.py b/custom_components/ge_home/devices/oven.py index c83ce8d..2bd7bbd 100644 --- a/custom_components/ge_home/devices/oven.py +++ b/custom_components/ge_home/devices/oven.py @@ -100,18 +100,27 @@ class OvenApi(ApplianceApi): if oven_config.has_warming_drawer and warm_drawer is not None: oven_entities.append(GeErdSensor(self, ErdCode.WARMING_DRAWER_STATE)) - if cooktop_config == ErdCooktopConfig.PRESENT: + if cooktop_config == ErdCooktopConfig.PRESENT: + # attempt to get the cooktop status using legacy status + cooktop_status_erd = ErdCode.COOKTOP_STATUS cooktop_status: CooktopStatus = self.try_get_erd_value(ErdCode.COOKTOP_STATUS) + + # if we didn't get it, try using the new version + if cooktop_status is None: + cooktop_status_erd = ErdCode.COOKTOP_STATUS_EXT + cooktop_status: CooktopStatus = self.try_get_erd_value(ErdCode.COOKTOP_STATUS_EXT) + + # if we got a status through either mechanism, we can add the entities if cooktop_status is not None: - cooktop_entities.append(GeErdBinarySensor(self, ErdCode.COOKTOP_STATUS)) + cooktop_entities.append(GeErdBinarySensor(self, cooktop_status_erd)) for (k, v) in cooktop_status.burners.items(): if v.exists: prop = self._camel_to_snake(k) - cooktop_entities.append(GeErdPropertyBinarySensor(self, ErdCode.COOKTOP_STATUS, prop+".on")) - cooktop_entities.append(GeErdPropertyBinarySensor(self, ErdCode.COOKTOP_STATUS, prop+".synchronized")) + cooktop_entities.append(GeErdPropertyBinarySensor(self, cooktop_status_erd, prop+".on")) + cooktop_entities.append(GeErdPropertyBinarySensor(self, cooktop_status_erd, prop+".synchronized")) if not v.on_off_only: - cooktop_entities.append(GeErdPropertySensor(self, ErdCode.COOKTOP_STATUS, prop+".power_pct", icon_override="mdi:fire", device_class_override=DEVICE_CLASS_POWER_FACTOR, data_type_override=ErdDataType.INT)) + cooktop_entities.append(GeErdPropertySensor(self, cooktop_status_erd, prop+".power_pct", icon_override="mdi:fire", device_class_override=DEVICE_CLASS_POWER_FACTOR, data_type_override=ErdDataType.INT)) return base_entities + oven_entities + cooktop_entities