Skip to content

Commit

Permalink
Fix #54 - Added validation if state is not available to restore it
Browse files Browse the repository at this point in the history
  • Loading branch information
elad-bar committed Apr 20, 2020
1 parent 6a0ea6a commit 8067a84
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 2020-04-20

**Fixed bugs:**

- Added validation if state is not available to restore it [\#54](https://github.com/elad-bar/ha-bleuiris/issues/54)

## 2020-04-19

**Fixed bugs:**
Expand Down
Empty file removed custom_components/__init__.py
Empty file.
8 changes: 6 additions & 2 deletions custom_components/blueiris/managers/entity_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,14 @@ async def _async_update(self):
entity_component.entity_id = entity_id

state = self.hass.states.get(entity_id)
restored = state.attributes.get("restored", False)

if restored:
if state is None:
restored = True
else:
restored = state.attributes.get("restored", False)
_LOGGER.info(f"Entity {entity.name} restored | {entity_id}")

if restored:
entities_to_add.append(entity_component)
else:
entities_to_add.append(entity_component)
Expand Down

0 comments on commit 8067a84

Please sign in to comment.