mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 04:37:06 +00:00
Use native datetime value in Forecast Solar sensors (#59913)
This commit is contained in:
parent
9ccee205ca
commit
fc330f797d
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user