Skip to content

Add Safe Mode#30723

Merged
balloob merged 11 commits into
devfrom
safe-mode
Jan 14, 2020
Merged

Add Safe Mode#30723
balloob merged 11 commits into
devfrom
safe-mode

Conversation

@balloob
Copy link
Copy Markdown
Member

@balloob balloob commented Jan 13, 2020

Breaking Change:

--demo-mode has been removed as apparently it has been broken for a while and no one noticed 🤷‍♂

Description:

This introduces a new safe mode. In this mode we load the bare minimum necessary to load the Home Assistant frontend and being able to manage the configuration.

To be able to do this succesfully, the http integration will now store the last working configuration in storage. It is only used in safe mode.

The setup_hass method has been moved from __main__.py to bootstrap.py, which was more appropriate. Tests have been added.

Demo mode has been removed as apparently it has been broken for a while and no one noticed 🤷‍♂

It's not perfect yet. If a user has invalid core configuration Home Assistant can still refuse to start up. Leaving that for a future PR.

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

@probot-home-assistant
Copy link
Copy Markdown

Hey there @home-assistant/core, mind taking a look at this pull request as its been labeled with a integration (http) you are listed as a codeowner for? Thanks!

@probot-home-assistant
Copy link
Copy Markdown

Hey there @home-assistant/frontend, mind taking a look at this pull request as its been labeled with a integration (frontend) you are listed as a codeowner for? Thanks!

@balloob balloob changed the title Add Safe mode Add Safe Mode Jan 13, 2020
@yuvalabou
Copy link
Copy Markdown
Contributor

I didn't read all the changes but would like to propose the option to log everything in safe mode to ease the debugging process and override user logging definition

@balloob
Copy link
Copy Markdown
Member Author

balloob commented Jan 13, 2020

I don't think that it's necessary to set all logging to debug. In safe mode we won't load any integrations. We really only end up here if a user has written invalid YAML.

@pvizeli
Copy link
Copy Markdown
Member

pvizeli commented Jan 13, 2020

Depending on the conversation, we should allow to load Hass.io integration for ingress/editors.

EDIT: that works with hass.io in this approach. Nice!

Comment thread homeassistant/bootstrap.py Outdated
config_dict = await conf_util.async_hass_config_yaml(hass)
except HomeAssistantError as err:
_LOGGER.error(
"Failed to parse configuration.yaml: %s. Falling back to safe mode.",
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.

Remove trailing period.

Comment thread homeassistant/bootstrap.py Outdated
clear_secret_cache()

if safe_mode or config_dict is None:
_LOGGER.info("Starting in safe mode.")
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.

Remove trailing period.

@balloob balloob merged commit 5fdc60e into dev Jan 14, 2020
@delete-merged-branch delete-merged-branch Bot deleted the safe-mode branch January 14, 2020 21:03
raman325 added a commit to raman325/home-assistant that referenced this pull request Jan 15, 2020
* upstream/dev: (82 commits)
  Add support for vacuums to Alexa. (home-assistant#30764)
  Refactor Ring data handling (home-assistant#30777)
  Restore unit_of_measurement from entity registry (home-assistant#30780)
  Update pyubee to 0.8 (home-assistant#30785)
  Update emulated_roku to 0.1.9 (home-assistant#30791)
  Add Config Flow support, Device Registry support, available property to vizio component (home-assistant#30653)
  Allow input_* and timer component setup without config (home-assistant#30772)
  Search: Add search to default config and don't resolve area (home-assistant#30762)
  [ci skip] Translation update
  Use storage based collections for Timer platform (home-assistant#30765)
  Upgrade youtube_dl to version 2020.01.15 (home-assistant#30767)
  Whitelist Frenck for release
  Hass.io allow to reset password with CLI (home-assistant#30755)
  Revert home-assistant#29701 (home-assistant#30766)
  Add Safe Mode (home-assistant#30723)
  Update Ring to 0.6.0 (home-assistant#30748)
  Add support for the voltage sensor on the greeneye GEM (home-assistant#30484)
  Fix supported_features in MQTT fan (home-assistant#28680)
  Fix small typo in alarmdotcom component (home-assistant#30758)
  bump aiokef to 0.2.5 which uses locks (home-assistant#30753)
  ...
@lock lock Bot locked and limited conversation to collaborators Jan 16, 2020
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.

6 participants