Skip to content

Bugfix restore loading cache with startup state#6189

Merged
balloob merged 1 commit into
home-assistant:devfrom
kellerza:recorder_corestate
Feb 24, 2017
Merged

Bugfix restore loading cache with startup state#6189
balloob merged 1 commit into
home-assistant:devfrom
kellerza:recorder_corestate

Conversation

@kellerza
Copy link
Copy Markdown
Member

Description:
Fix #4614.

I always test with hass.restart and have got "commented" out invalid config items, so never really tested this because of no restart on validation failures :-(

Related issue (if applicable): fixes #6172

Checklist:

If the code does not interact with devices:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • Tests have been added to verify that the new code works.

@mention-bot
Copy link
Copy Markdown

@kellerza, thanks for your PR! By analyzing the history of the files in this pull request, we identified @balloob, @wokar and @fabaff to be potential reviewers.

@kellerza
Copy link
Copy Markdown
Member Author

starting only happens on hass.start(), before that it is not_running

None, _load_restore_cache, hass)

return hass.data[DATA_RESTORE_CACHE].get(entity_id)
return hass.data.get(DATA_RESTORE_CACHE, {}).get(entity_id)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you change this? There are no paths in _load_restore_cache that do not set the cache

@balloob
Copy link
Copy Markdown
Member

balloob commented Feb 24, 2017

Merging this to make it to 0.39. For 0.40 I will have a PR to remove CoreState.starting. Due to the way asyncio works, it will actually never be "starting" as it is immediately overwritten. (the responses to the event are being executed after that method is done)

@balloob balloob merged commit c940d26 into home-assistant:dev Feb 24, 2017
@asyncio.coroutine
def async_get_last_state(hass, entity_id: str):
"""Helper to restore state."""
if (_RECORDER not in hass.config.components or
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't have done this as we now will allow restoring from cache if we are running?

balloob pushed a commit that referenced this pull request Feb 25, 2017
@kellerza kellerza deleted the recorder_corestate branch February 28, 2017 20:09
@home-assistant home-assistant locked and limited conversation to collaborators Jun 2, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

State restoration doesn't work because of wrong HomeAssistant.state attribute's value when async_added_to_hass is called.

4 participants