Handle AttributeError in ViCare integration (#106470)

pull/106970/head
Christopher Fenner 2023-12-28 09:35:39 +01:00 committed by Bram Kragten
parent 924e47c2a8
commit b685584b91
1 changed files with 10 additions and 5 deletions

View File

@ -21,13 +21,12 @@ def is_supported(
try: try:
entity_description.value_getter(vicare_device) entity_description.value_getter(vicare_device)
_LOGGER.debug("Found entity %s", name) _LOGGER.debug("Found entity %s", name)
return True
except PyViCareNotSupportedFeatureError: except PyViCareNotSupportedFeatureError:
_LOGGER.info("Feature not supported %s", name) _LOGGER.debug("Feature not supported %s", name)
return False
except AttributeError as error: except AttributeError as error:
_LOGGER.debug("Attribute Error %s: %s", name, error) _LOGGER.debug("Feature not supported %s: %s", name, error)
return False return False
return True
def get_burners(device: PyViCareDevice) -> list[PyViCareHeatingDeviceComponent]: def get_burners(device: PyViCareDevice) -> list[PyViCareHeatingDeviceComponent]:
@ -36,6 +35,8 @@ def get_burners(device: PyViCareDevice) -> list[PyViCareHeatingDeviceComponent]:
return device.burners return device.burners
except PyViCareNotSupportedFeatureError: except PyViCareNotSupportedFeatureError:
_LOGGER.debug("No burners found") _LOGGER.debug("No burners found")
except AttributeError as error:
_LOGGER.debug("No burners found: %s", error)
return [] return []
@ -45,6 +46,8 @@ def get_circuits(device: PyViCareDevice) -> list[PyViCareHeatingDeviceComponent]
return device.circuits return device.circuits
except PyViCareNotSupportedFeatureError: except PyViCareNotSupportedFeatureError:
_LOGGER.debug("No circuits found") _LOGGER.debug("No circuits found")
except AttributeError as error:
_LOGGER.debug("No circuits found: %s", error)
return [] return []
@ -54,4 +57,6 @@ def get_compressors(device: PyViCareDevice) -> list[PyViCareHeatingDeviceCompone
return device.compressors return device.compressors
except PyViCareNotSupportedFeatureError: except PyViCareNotSupportedFeatureError:
_LOGGER.debug("No compressors found") _LOGGER.debug("No compressors found")
except AttributeError as error:
_LOGGER.debug("No compressors found: %s", error)
return [] return []