Skip to content

Commit

Permalink
Merge pull request #339 from henricm/ignore-unknown-state
Browse files Browse the repository at this point in the history
fix: ignore unknown last state
  • Loading branch information
argoyle authored May 2, 2023
2 parents bb77c9a + 09dcf4a commit 5ce2de8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion custom_components/ferroamp/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ async def async_added_to_hass(self) -> None:
"""Handle entity which will be added."""
await super().async_added_to_hass()
state = await self.async_get_last_state()
if state:
if state and state.state != "unknown":
self._attr_native_value = state.state
self.hass.data[DOMAIN][DATA_DEVICES][self.config_id][self.device_id][self.unique_id] = self
self._added = True
Expand Down

0 comments on commit 5ce2de8

Please sign in to comment.