From 74023fce21159623339dda7c18fd3ab72a6dfba5 Mon Sep 17 00:00:00 2001 From: Ian Harcombe Date: Thu, 22 Jul 2021 17:24:47 +0100 Subject: [PATCH] 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. --- homeassistant/components/metoffice/sensor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/metoffice/sensor.py b/homeassistant/components/metoffice/sensor.py index 1307c3aae45..1120e75c50a 100644 --- a/homeassistant/components/metoffice/sensor.py +++ b/homeassistant/components/metoffice/sensor.py @@ -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