1
mirror of https://github.com/home-assistant/core synced 2024-08-28 03:36:46 +02:00

Handle AttributeError in ViCare integration (#106470)

This commit is contained in:
Christopher Fenner 2023-12-28 09:35:39 +01:00 committed by GitHub
parent a6af2be675
commit af881d7ac8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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