From 625f80d08033d3327b8f033408a6819a60c5368d Mon Sep 17 00:00:00 2001 From: Anders Hoglund Date: Fri, 12 Jan 2024 14:37:56 +0100 Subject: [PATCH] Added float type cast to fix OpenAPI returned string type. --- custom_components/fusion_solar/fusion_solar/energy_sensor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/fusion_solar/fusion_solar/energy_sensor.py b/custom_components/fusion_solar/fusion_solar/energy_sensor.py index 0dbe8a1..6f0d3ec 100644 --- a/custom_components/fusion_solar/fusion_solar/energy_sensor.py +++ b/custom_components/fusion_solar/fusion_solar/energy_sensor.py @@ -65,7 +65,7 @@ def native_value(self) -> float: return realtime_power = self.coordinator.data[self._data_name][ATTR_REALTIME_POWER] - if math.isclose(realtime_power, 0, abs_tol = 0.001): + if math.isclose(float(realtime_power), 0, abs_tol = 0.001): _LOGGER.info(f'{self.entity_id}: not producing any power, so no energy update to prevent glitches.') return float(current_value)