Fix esphome binary sensors when state is missing (#95140)

* Fix esphome binary sensors when state is missing

* Fix esphome binary sensors when state is missing

* Fix esphome binary sensors when state is missing
This commit is contained in:
J. Nick Koston 2023-06-24 22:09:26 -05:00 committed by GitHub
parent c6b3d538de
commit 9eedc8a602
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 125 additions and 16 deletions

View file

@ -49,10 +49,9 @@ class EsphomeBinarySensor(
# Status binary sensors indicated connected state.
# So in their case what's usually _availability_ is now state
return self._entry_data.available
state = self._state
if not self._has_state or state.missing_state:
if not self._has_state or self._state.missing_state:
return None
return state.state
return self._state.state
@callback
def _on_static_info_update(self, static_info: EntityInfo) -> None: