Fix for issue #53031 (#53343)

Logs from issue #53031 show that not only ints are appearing in the values for the forecast data now, so change the check from just for int, to see whether the value has a "value" attribute before dereferencing it.
This commit is contained in:
Ian Harcombe 2021-07-22 17:24:47 +01:00 committed by GitHub
parent c9c1c62d67
commit 74023fce21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -221,7 +221,7 @@ class MetOfficeCurrentSensor(CoordinatorEntity, SensorEntity):
elif hasattr(self.coordinator.data.now, self._type):
value = getattr(self.coordinator.data.now, self._type)
if not isinstance(value, int):
if hasattr(value, "value"):
value = value.value
return value