Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions custom_components/plant/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ async def async_added_to_hass(self) -> None:
state = await self.async_get_last_state()

# We do not restore the state for these they are read from the external sensor anyway
self._attr_native_value = STATE_UNKNOWN
self._attr_native_value = None
if state:
if "external_sensor" in state.attributes:
self.replace_external_sensor(state.attributes["external_sensor"])
Expand Down Expand Up @@ -450,9 +450,9 @@ async def async_update(self) -> None:
if external_sensor:
self._attr_native_value = self.ppfd(external_sensor.state)
else:
self._attr_native_value = STATE_UNKNOWN
self._attr_native_value = None
else:
self._attr_native_value = STATE_UNKNOWN
self._attr_native_value = None

@callback
def state_changed(self, entity_id: str, new_state: str) -> None:
Expand All @@ -466,9 +466,9 @@ def state_changed(self, entity_id: str, new_state: str) -> None:
if external_sensor:
self._attr_native_value = self.ppfd(external_sensor.state)
else:
self._attr_native_value = STATE_UNKNOWN
self._attr_native_value = None
else:
self._attr_native_value = STATE_UNKNOWN
self._attr_native_value = None


class PlantTotalLightIntegral(IntegrationSensor):
Expand Down