mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +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
|
@property
|
||||||
def native_value(self) -> StateType:
|
def native_value(self) -> datetime | StateType:
|
||||||
"""Return the state of the sensor."""
|
"""Return the state of the sensor."""
|
||||||
if self.entity_description.state is None:
|
if self.entity_description.state is None:
|
||||||
state: StateType | datetime = getattr(
|
state: StateType | datetime = getattr(
|
||||||
@ -70,6 +70,4 @@ class ForecastSolarSensorEntity(CoordinatorEntity, SensorEntity):
|
|||||||
else:
|
else:
|
||||||
state = self.entity_description.state(self.coordinator.data)
|
state = self.entity_description.state(self.coordinator.data)
|
||||||
|
|
||||||
if isinstance(state, datetime):
|
|
||||||
return state.isoformat()
|
|
||||||
return state
|
return state
|
||||||
|
Loading…
x
Reference in New Issue
Block a user