From fc330f797d4a9cd459563d2a5b917975bebd9f89 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Thu, 18 Nov 2021 19:58:31 +0100 Subject: [PATCH] Use native datetime value in Forecast Solar sensors (#59913) --- homeassistant/components/forecast_solar/sensor.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/homeassistant/components/forecast_solar/sensor.py b/homeassistant/components/forecast_solar/sensor.py index cd672311c52..c1ebbaf60bd 100644 --- a/homeassistant/components/forecast_solar/sensor.py +++ b/homeassistant/components/forecast_solar/sensor.py @@ -61,7 +61,7 @@ class ForecastSolarSensorEntity(CoordinatorEntity, SensorEntity): ) @property - def native_value(self) -> StateType: + def native_value(self) -> datetime | StateType: """Return the state of the sensor.""" if self.entity_description.state is None: state: StateType | datetime = getattr( @@ -70,6 +70,4 @@ class ForecastSolarSensorEntity(CoordinatorEntity, SensorEntity): else: state = self.entity_description.state(self.coordinator.data) - if isinstance(state, datetime): - return state.isoformat() return state