diff --git a/homeassistant/components/config/__init__.py b/homeassistant/components/config/__init__.py index 601b12ffe4a4..4d0295c382a7 100644 --- a/homeassistant/components/config/__init__.py +++ b/homeassistant/components/config/__init__.py @@ -14,24 +14,16 @@ from homeassistant.util.yaml import load_yaml, dump DOMAIN = 'config' DEPENDENCIES = ['http'] SECTIONS = ('core', 'customize', 'group', 'hassbian', 'automation', 'script', - 'entity_registry') + 'entity_registry', 'config_entries') ON_DEMAND = ('zwave',) -FEATURE_FLAGS = ('config_entries',) @asyncio.coroutine def async_setup(hass, config): """Set up the config component.""" - global SECTIONS - yield from hass.components.frontend.async_register_built_in_panel( 'config', 'config', 'mdi:settings') - # Temporary way of allowing people to opt-in for unreleased config sections - for key, value in config.get(DOMAIN, {}).items(): - if key in FEATURE_FLAGS and value: - SECTIONS += (key,) - @asyncio.coroutine def setup_panel(panel_name): """Set up a panel.""" diff --git a/homeassistant/components/config_entry_example/.translations/de.json b/homeassistant/components/config_entry_example/.translations/de.json deleted file mode 100644 index 75b88f2f822e..000000000000 --- a/homeassistant/components/config_entry_example/.translations/de.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "config": { - "error": { - "invalid_object_id": "Ung\u00fcltige Objekt-ID" - }, - "step": { - "init": { - "data": { - "object_id": "Objekt-ID" - }, - "description": "Bitte gib eine Objekt_ID f\u00fcr das Test-Entity ein.", - "title": "W\u00e4hle eine Objekt-ID" - }, - "name": { - "data": { - "name": "Name" - }, - "description": "Bitte gib einen Namen f\u00fcr das Test-Entity ein", - "title": "Name des Test-Entity" - } - }, - "title": "Beispiel Konfig-Eintrag" - } -} \ No newline at end of file diff --git a/homeassistant/components/config_entry_example/.translations/en.json b/homeassistant/components/config_entry_example/.translations/en.json deleted file mode 100644 index ec24d01ebc86..000000000000 --- a/homeassistant/components/config_entry_example/.translations/en.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "config": { - "error": { - "invalid_object_id": "Invalid object ID" - }, - "step": { - "init": { - "data": { - "object_id": "Object ID" - }, - "description": "Please enter an object_id for the test entity.", - "title": "Pick object id" - }, - "name": { - "data": { - "name": "Name" - }, - "description": "Please enter a name for the test entity.", - "title": "Name of the entity" - } - }, - "title": "Config Entry Example" - } -} \ No newline at end of file diff --git a/homeassistant/components/config_entry_example/.translations/fi.json b/homeassistant/components/config_entry_example/.translations/fi.json deleted file mode 100644 index 054a6f372bc1..000000000000 --- a/homeassistant/components/config_entry_example/.translations/fi.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "config": { - "step": { - "name": { - "data": { - "name": "Nimi" - } - } - } - } -} \ No newline at end of file diff --git a/homeassistant/components/config_entry_example/.translations/ko.json b/homeassistant/components/config_entry_example/.translations/ko.json deleted file mode 100644 index f12e3fc52f1c..000000000000 --- a/homeassistant/components/config_entry_example/.translations/ko.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "config": { - "error": { - "invalid_object_id": "\uc624\ube0c\uc81d\ud2b8 ID\uac00 \uc798\ubabb\ub418\uc5c8\uc2b5\ub2c8\ub2e4" - }, - "step": { - "init": { - "data": { - "object_id": "\uc624\ube0c\uc81d\ud2b8 ID" - }, - "description": "\ud14c\uc2a4\ud2b8 \uad6c\uc131\uc694\uc18c\uc758 \uc624\ube0c\uc81d\ud2b8 ID \ub97c \uc785\ub825\ud558\uc138\uc694", - "title": "\uc624\ube0c\uc81d\ud2b8 ID \uc120\ud0dd" - }, - "name": { - "data": { - "name": "\uc774\ub984" - }, - "description": "\ud14c\uc2a4\ud2b8 \uad6c\uc131\uc694\uc18c\uc758 \uc774\ub984\uc744 \uc785\ub825\ud558\uc138\uc694.", - "title": "\uad6c\uc131\uc694\uc18c \uc774\ub984" - } - }, - "title": "\uc785\ub825 \uc608\uc81c \uad6c\uc131" - } -} \ No newline at end of file diff --git a/homeassistant/components/config_entry_example/.translations/nl.json b/homeassistant/components/config_entry_example/.translations/nl.json deleted file mode 100644 index 7b52ac88cf01..000000000000 --- a/homeassistant/components/config_entry_example/.translations/nl.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "config": { - "error": { - "invalid_object_id": "Ongeldig object ID" - }, - "step": { - "init": { - "data": { - "object_id": "Object ID" - }, - "description": "Voer een object_id in voor het testen van de entiteit.", - "title": "Kies object id" - }, - "name": { - "data": { - "name": "Naam" - }, - "description": "Voer een naam in voor het testen van de entiteit.", - "title": "Naam van de entiteit" - } - }, - "title": "Voorbeeld van de config vermelding" - } -} \ No newline at end of file diff --git a/homeassistant/components/config_entry_example/.translations/no.json b/homeassistant/components/config_entry_example/.translations/no.json deleted file mode 100644 index 380c539f8af7..000000000000 --- a/homeassistant/components/config_entry_example/.translations/no.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "config": { - "error": { - "invalid_object_id": "Ugyldig objekt ID" - }, - "step": { - "init": { - "data": { - "object_id": "Objekt ID" - }, - "description": "Vennligst skriv inn en object_id for testenheten.", - "title": "Velg objekt ID" - }, - "name": { - "data": { - "name": "Navn" - }, - "description": "Vennligst skriv inn et navn for testenheten.", - "title": "Navn p\u00e5 enheten" - } - }, - "title": "Konfigureringseksempel" - } -} \ No newline at end of file diff --git a/homeassistant/components/config_entry_example/.translations/pl.json b/homeassistant/components/config_entry_example/.translations/pl.json deleted file mode 100644 index 35cca168249d..000000000000 --- a/homeassistant/components/config_entry_example/.translations/pl.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "config": { - "error": { - "invalid_object_id": "Nieprawid\u0142owy identyfikator obiektu" - }, - "step": { - "init": { - "data": { - "object_id": "Identyfikator obiektu" - }, - "description": "Prosz\u0119 wprowadzi\u0107 identyfikator obiektu (object_id) dla jednostki testowej.", - "title": "Wybierz identyfikator obiektu" - }, - "name": { - "data": { - "name": "Nazwa" - }, - "description": "Prosz\u0119 wprowadzi\u0107 nazw\u0119 dla jednostki testowej.", - "title": "Nazwa jednostki" - } - }, - "title": "Przyk\u0142ad wpisu do konfiguracji" - } -} \ No newline at end of file diff --git a/homeassistant/components/config_entry_example/.translations/ro.json b/homeassistant/components/config_entry_example/.translations/ro.json deleted file mode 100644 index 1a4cdd6bbb7a..000000000000 --- a/homeassistant/components/config_entry_example/.translations/ro.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "config": { - "step": { - "init": { - "description": "Introduce\u021bi un obiect_id pentru entitatea testat\u0103.", - "title": "Alege\u021bi id-ul obiectului" - }, - "name": { - "data": { - "name": "Nume" - } - } - } - } -} \ No newline at end of file diff --git a/homeassistant/components/config_entry_example/.translations/sl.json b/homeassistant/components/config_entry_example/.translations/sl.json deleted file mode 100644 index 11d2d3f5e800..000000000000 --- a/homeassistant/components/config_entry_example/.translations/sl.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "config": { - "error": { - "invalid_object_id": "Neveljaven ID objekta" - }, - "step": { - "init": { - "data": { - "object_id": "ID objekta" - }, - "description": "Prosimo, vnesite Id_objekta za testni subjekt.", - "title": "Izberite ID objekta" - }, - "name": { - "data": { - "name": "Ime" - }, - "description": "Vnesite ime za testni subjekt.", - "title": "Ime subjekta" - } - }, - "title": "Primer nastavitve" - } -} \ No newline at end of file diff --git a/homeassistant/components/config_entry_example/.translations/vi.json b/homeassistant/components/config_entry_example/.translations/vi.json deleted file mode 100644 index e40c4d38e9f0..000000000000 --- a/homeassistant/components/config_entry_example/.translations/vi.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "config": { - "error": { - "invalid_object_id": "ID \u0111\u1ed1i t\u01b0\u1ee3ng kh\u00f4ng h\u1ee3p l\u1ec7" - }, - "step": { - "init": { - "data": { - "object_id": "ID \u0111\u1ed1i t\u01b0\u1ee3ng" - }, - "description": "Xin vui l\u00f2ng nh\u1eadp m\u1ed9t object_id cho th\u1eed nghi\u1ec7m th\u1ef1c th\u1ec3.", - "title": "Ch\u1ecdn id \u0111\u1ed1i t\u01b0\u1ee3ng" - }, - "name": { - "data": { - "name": "T\u00ean" - }, - "description": "Xin vui l\u00f2ng nh\u1eadp t\u00ean cho th\u1eed nghi\u1ec7m th\u1ef1c th\u1ec3.", - "title": "T\u00ean c\u1ee7a th\u1ef1c th\u1ec3" - } - }, - "title": "V\u00ed d\u1ee5 v\u1ec1 c\u1ea5u h\u00ecnh th\u1ef1c th\u1ec3" - } -} \ No newline at end of file diff --git a/homeassistant/components/config_entry_example/.translations/zh-Hans.json b/homeassistant/components/config_entry_example/.translations/zh-Hans.json deleted file mode 100644 index ee10e6d7b482..000000000000 --- a/homeassistant/components/config_entry_example/.translations/zh-Hans.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "config": { - "error": { - "invalid_object_id": "\u65e0\u6548\u7684\u5bf9\u8c61 ID" - }, - "step": { - "init": { - "data": { - "object_id": "\u5bf9\u8c61 ID" - }, - "description": "\u8bf7\u4e3a\u6d4b\u8bd5\u8bbe\u5907\u8f93\u5165\u5bf9\u8c61 ID", - "title": "\u8bf7\u9009\u62e9\u5bf9\u8c61 ID" - }, - "name": { - "data": { - "name": "\u540d\u79f0" - }, - "description": "\u8bf7\u4e3a\u6d4b\u8bd5\u8bbe\u5907\u8f93\u5165\u540d\u79f0", - "title": "\u8bbe\u5907\u540d\u79f0" - } - }, - "title": "\u6837\u4f8b\u914d\u7f6e\u6761\u76ee" - } -} \ No newline at end of file diff --git a/homeassistant/components/config_entry_example/__init__.py b/homeassistant/components/config_entry_example/__init__.py deleted file mode 100644 index 3ebfdc3a183e..000000000000 --- a/homeassistant/components/config_entry_example/__init__.py +++ /dev/null @@ -1,98 +0,0 @@ -"""Example component to show how config entries work.""" - -import asyncio - -import voluptuous as vol - -from homeassistant import config_entries -from homeassistant.const import ATTR_FRIENDLY_NAME -from homeassistant.util import slugify - - -DOMAIN = 'config_entry_example' - - -@asyncio.coroutine -def async_setup(hass, config): - """Setup for our example component.""" - return True - - -@asyncio.coroutine -def async_setup_entry(hass, entry): - """Initialize an entry.""" - entity_id = '{}.{}'.format(DOMAIN, entry.data['object_id']) - hass.states.async_set(entity_id, 'loaded', { - ATTR_FRIENDLY_NAME: entry.data['name'] - }) - - # Indicate setup was successful. - return True - - -@asyncio.coroutine -def async_unload_entry(hass, entry): - """Unload an entry.""" - entity_id = '{}.{}'.format(DOMAIN, entry.data['object_id']) - hass.states.async_remove(entity_id) - - # Indicate unload was successful. - return True - - -@config_entries.HANDLERS.register(DOMAIN) -class ExampleConfigFlow(config_entries.ConfigFlowHandler): - """Handle an example configuration flow.""" - - VERSION = 1 - - def __init__(self): - """Initialize a Hue config handler.""" - self.object_id = None - - @asyncio.coroutine - def async_step_init(self, user_input=None): - """Start config flow.""" - errors = None - if user_input is not None: - object_id = user_input['object_id'] - - if object_id != '' and object_id == slugify(object_id): - self.object_id = user_input['object_id'] - return (yield from self.async_step_name()) - - errors = { - 'object_id': 'invalid_object_id' - } - - return self.async_show_form( - step_id='init', - data_schema=vol.Schema({ - 'object_id': str - }), - errors=errors - ) - - @asyncio.coroutine - def async_step_name(self, user_input=None): - """Ask user to enter the name.""" - errors = None - if user_input is not None: - name = user_input['name'] - - if name != '': - return self.async_create_entry( - title=name, - data={ - 'name': name, - 'object_id': self.object_id, - } - ) - - return self.async_show_form( - step_id='name', - data_schema=vol.Schema({ - 'name': str - }), - errors=errors - ) diff --git a/homeassistant/components/config_entry_example/strings.json b/homeassistant/components/config_entry_example/strings.json deleted file mode 100644 index a7a8cd4025b2..000000000000 --- a/homeassistant/components/config_entry_example/strings.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "config": { - "title": "Config Entry Example", - "step": { - "init": { - "title": "Pick object id", - "description": "Please enter an object_id for the test entity.", - "data": { - "object_id": "Object ID" - } - }, - "name": { - "title": "Name of the entity", - "description": "Please enter a name for the test entity.", - "data": { - "name": "Name" - } - } - }, - "error": { - "invalid_object_id": "Invalid object ID" - } - } -} diff --git a/homeassistant/config_entries.py b/homeassistant/config_entries.py index 6b2000b2ea6a..69491af1aad0 100644 --- a/homeassistant/config_entries.py +++ b/homeassistant/config_entries.py @@ -126,9 +126,8 @@ _LOGGER = logging.getLogger(__name__) HANDLERS = Registry() # Components that have config flows. In future we will auto-generate this list. FLOWS = [ - 'config_entry_example', - 'hue', 'deconz', + 'hue', ] SOURCE_USER = 'user' diff --git a/tests/components/test_config_entry_example.py b/tests/components/test_config_entry_example.py deleted file mode 100644 index 31084384c313..000000000000 --- a/tests/components/test_config_entry_example.py +++ /dev/null @@ -1,38 +0,0 @@ -"""Test the config entry example component.""" -import asyncio - -from homeassistant import config_entries - - -@asyncio.coroutine -def test_flow_works(hass): - """Test that the config flow works.""" - result = yield from hass.config_entries.flow.async_init( - 'config_entry_example') - - assert result['type'] == config_entries.RESULT_TYPE_FORM - - result = yield from hass.config_entries.flow.async_configure( - result['flow_id'], { - 'object_id': 'bla' - }) - - assert result['type'] == config_entries.RESULT_TYPE_FORM - - result = yield from hass.config_entries.flow.async_configure( - result['flow_id'], { - 'name': 'Hello' - }) - - assert result['type'] == config_entries.RESULT_TYPE_CREATE_ENTRY - state = hass.states.get('config_entry_example.bla') - assert state is not None - assert state.name == 'Hello' - assert 'config_entry_example' in hass.config.components - assert len(hass.config_entries.async_entries()) == 1 - - # Test removing entry. - entry = hass.config_entries.async_entries()[0] - yield from hass.config_entries.async_remove(entry.entry_id) - state = hass.states.get('config_entry_example.bla') - assert state is None