Add an introduction component to support first usage
This commit is contained in:
parent
e2cfe2a7d2
commit
ba7b9c625e
3 changed files with 56 additions and 6 deletions
41
homeassistant/components/introduction.py
Normal file
41
homeassistant/components/introduction.py
Normal file
|
@ -0,0 +1,41 @@
|
|||
"""
|
||||
homeassistant.components.introduction
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Component that will help guide the user taking its first steps.
|
||||
"""
|
||||
import logging
|
||||
|
||||
DOMAIN = 'introduction'
|
||||
DEPENDENCIES = []
|
||||
|
||||
|
||||
def setup(hass, config=None):
|
||||
""" Setup the introduction component. """
|
||||
log = logging.getLogger(__name__)
|
||||
log.info("""
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Hello, and welcome to Home Assistant!
|
||||
|
||||
We'll hope that we can make all your dreams come true.
|
||||
|
||||
Here are some resources to get started:
|
||||
|
||||
- Configuring Home Assistant:
|
||||
https://home-assistant.io/getting-started/configuration.html
|
||||
|
||||
- Available components:
|
||||
https://home-assistant.io/components/
|
||||
|
||||
- Chat room:
|
||||
https://gitter.im/balloob/home-assistant
|
||||
|
||||
This message is generated by the introduction component. You can
|
||||
disable it in configuration.yaml.
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
""")
|
||||
|
||||
return True
|
|
@ -28,8 +28,15 @@ DEFAULT_CONFIG = (
|
|||
(CONF_TIME_ZONE, 'UTC', 'time_zone', 'Pick yours from here: http://en.wiki'
|
||||
'pedia.org/wiki/List_of_tz_database_time_zones'),
|
||||
)
|
||||
DEFAULT_COMPONENTS = (
|
||||
'discovery', 'frontend', 'conversation', 'history', 'logbook', 'sun')
|
||||
DEFAULT_COMPONENTS = {
|
||||
'introduction': 'Show links to resources in log and frontend',
|
||||
'frontend': 'Enables the frontend',
|
||||
'discovery': 'Discover some devices automatically',
|
||||
'conversation': 'Allows you to issue voice commands from the frontend',
|
||||
'history': 'Enables support for tracking state changes over time.',
|
||||
'logbook': 'View all events in a logbook',
|
||||
'sun': 'Track the sun',
|
||||
}
|
||||
|
||||
|
||||
def ensure_config_exists(config_dir, detect_location=True):
|
||||
|
@ -78,7 +85,8 @@ def create_default_config(config_dir, detect_location=True):
|
|||
|
||||
config_file.write("\n")
|
||||
|
||||
for component in DEFAULT_COMPONENTS:
|
||||
for component, description in DEFAULT_COMPONENTS.items():
|
||||
config_file.write("# {}\n".format(description))
|
||||
config_file.write("{}:\n\n".format(component))
|
||||
|
||||
return config_path
|
||||
|
|
|
@ -166,9 +166,10 @@ def load_order_components(components):
|
|||
key=lambda order: 'group' in order):
|
||||
load_order.update(comp_load_order)
|
||||
|
||||
# Push recorder to first place in load order
|
||||
if 'recorder' in load_order:
|
||||
load_order.promote('recorder')
|
||||
# Push some to first place in load order
|
||||
for comp in ('recorder', 'introduction'):
|
||||
if comp in load_order:
|
||||
load_order.promote(comp)
|
||||
|
||||
return load_order
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue