diff --git a/homeassistant/components/automation/__init__.py b/homeassistant/components/automation/__init__.py index 27332bfaa9f..58c86ff0c6d 100644 --- a/homeassistant/components/automation/__init__.py +++ b/homeassistant/components/automation/__init__.py @@ -27,7 +27,6 @@ from homeassistant.helpers.restore_state import async_get_last_state from homeassistant.loader import get_platform from homeassistant.util.dt import utcnow import homeassistant.helpers.config_validation as cv -from homeassistant.components.frontend import register_built_in_panel DOMAIN = 'automation' DEPENDENCIES = ['group'] @@ -232,10 +231,6 @@ def async_setup(hass, config): DOMAIN, service, turn_onoff_service_handler, descriptions.get(service), schema=SERVICE_SCHEMA) - if 'frontend' in hass.config.components: - register_built_in_panel(hass, 'automation', 'Automations', - 'mdi:playlist-play') - return True diff --git a/homeassistant/components/config/zwave.py b/homeassistant/components/config/zwave.py index 576ff09bf2b..a40e1f64043 100644 --- a/homeassistant/components/config/zwave.py +++ b/homeassistant/components/config/zwave.py @@ -1,12 +1,17 @@ """Provide configuration end points for Z-Wave.""" import asyncio +import homeassistant.core as ha +from homeassistant.const import HTTP_NOT_FOUND +from homeassistant.components.http import HomeAssistantView from homeassistant.components.config import EditKeyBasedConfigView -from homeassistant.components.zwave import DEVICE_CONFIG_SCHEMA_ENTRY +from homeassistant.components.zwave import const, DEVICE_CONFIG_SCHEMA_ENTRY import homeassistant.helpers.config_validation as cv CONFIG_PATH = 'zwave_device_config.yaml' +OZW_LOG_FILENAME = 'OZW_Log.txt' +URL_API_OZW_LOG = '/api/zwave/ozwlog' @asyncio.coroutine @@ -16,4 +21,123 @@ def async_setup(hass): 'zwave', 'device_config', CONFIG_PATH, cv.entity_id, DEVICE_CONFIG_SCHEMA_ENTRY )) + hass.http.register_view(ZWaveNodeValueView) + hass.http.register_view(ZWaveNodeGroupView) + hass.http.register_view(ZWaveNodeConfigView) + hass.http.register_view(ZWaveUserCodeView) + hass.http.register_static_path( + URL_API_OZW_LOG, hass.config.path(OZW_LOG_FILENAME), False) + return True + + +class ZWaveNodeValueView(HomeAssistantView): + """View to return the node values.""" + + url = r"/api/zwave/values/{node_id:\d+}" + name = "api:zwave:values" + + @ha.callback + def get(self, request, node_id): + """Retrieve groups of node.""" + nodeid = int(node_id) + hass = request.app['hass'] + values_list = hass.data[const.DATA_ENTITY_VALUES] + + values_data = {} + # Return a list of values for this node that are used as a + # primary value for an entity + for entity_values in values_list: + if entity_values.primary.node.node_id != nodeid: + continue + + values_data[entity_values.primary.value_id] = { + 'label': entity_values.primary.label, + 'index': entity_values.primary.index, + 'instance': entity_values.primary.instance, + } + return self.json(values_data) + + +class ZWaveNodeGroupView(HomeAssistantView): + """View to return the nodes group configuration.""" + + url = r"/api/zwave/groups/{node_id:\d+}" + name = "api:zwave:groups" + + @ha.callback + def get(self, request, node_id): + """Retrieve groups of node.""" + nodeid = int(node_id) + hass = request.app['hass'] + network = hass.data.get(const.DATA_NETWORK) + node = network.nodes.get(nodeid) + if node is None: + return self.json_message('Node not found', HTTP_NOT_FOUND) + groupdata = node.groups + groups = {} + for key, value in groupdata.items(): + groups[key] = {'associations': value.associations, + 'association_instances': + value.associations_instances, + 'label': value.label, + 'max_associations': value.max_associations} + return self.json(groups) + + +class ZWaveNodeConfigView(HomeAssistantView): + """View to return the nodes configuration options.""" + + url = r"/api/zwave/config/{node_id:\d+}" + name = "api:zwave:config" + + @ha.callback + def get(self, request, node_id): + """Retrieve configurations of node.""" + nodeid = int(node_id) + hass = request.app['hass'] + network = hass.data.get(const.DATA_NETWORK) + node = network.nodes.get(nodeid) + if node is None: + return self.json_message('Node not found', HTTP_NOT_FOUND) + config = {} + for value in ( + node.get_values(class_id=const.COMMAND_CLASS_CONFIGURATION) + .values()): + config[value.index] = {'label': value.label, + 'type': value.type, + 'help': value.help, + 'data_items': value.data_items, + 'data': value.data, + 'max': value.max, + 'min': value.min} + return self.json(config) + + +class ZWaveUserCodeView(HomeAssistantView): + """View to return the nodes usercode configuration.""" + + url = r"/api/zwave/usercodes/{node_id:\d+}" + name = "api:zwave:usercodes" + + @ha.callback + def get(self, request, node_id): + """Retrieve usercodes of node.""" + nodeid = int(node_id) + hass = request.app['hass'] + network = hass.data.get(const.DATA_NETWORK) + node = network.nodes.get(nodeid) + if node is None: + return self.json_message('Node not found', HTTP_NOT_FOUND) + usercodes = {} + if not node.has_command_class(const.COMMAND_CLASS_USER_CODE): + return self.json(usercodes) + for value in ( + node.get_values(class_id=const.COMMAND_CLASS_USER_CODE) + .values()): + if value.genre != const.GENRE_USER: + continue + usercodes[value.index] = {'code': value.data, + 'label': value.label, + 'length': len(value.data)} + return self.json(usercodes) diff --git a/homeassistant/components/frontend/version.py b/homeassistant/components/frontend/version.py index 211b1cecc8b..ceb7121ff7d 100644 --- a/homeassistant/components/frontend/version.py +++ b/homeassistant/components/frontend/version.py @@ -3,23 +3,21 @@ FINGERPRINTS = { "compatibility.js": "1686167ff210e001f063f5c606b2e74b", "core.js": "2a7d01e45187c7d4635da05065b5e54e", - "frontend.html": "da3a65fd69361319864767a3ce0b4b9d", + "frontend.html": "3579bb550f8a407d452f70eb11c04b21", "mdi.html": "e91f61a039ed0a9936e7ee5360da3870", "micromarkdown-js.html": "93b5ec4016f0bba585521cf4d18dec1a", - "panels/ha-panel-automation.html": "6c3a3345b63f3a36d32f43cff3e10c53", - "panels/ha-panel-config.html": "3d7ef351e5154bbc909662a20ce812e2", + "panels/ha-panel-config.html": "a8f9761410139dca558c44db21465470", "panels/ha-panel-dev-event.html": "d409e7ab537d9fe629126d122345279c", "panels/ha-panel-dev-info.html": "b0e55eb657fd75f21aba2426ac0cedc0", "panels/ha-panel-dev-mqtt.html": "94b222b013a98583842de3e72d5888c6", - "panels/ha-panel-dev-service.html": "61b164e0c0964782a539cba7008bb716", + "panels/ha-panel-dev-service.html": "94790b45e4b05e8722dba192940b16f6", "panels/ha-panel-dev-state.html": "7948d3dba058f31517d880df8ed0e857", "panels/ha-panel-dev-template.html": "f47b6910d8e4880e22cc508ca452f9b6", "panels/ha-panel-hassio.html": "b46e7619f3c355f872d5370741d89f6a", - "panels/ha-panel-history.html": "788d6324badd9f189a3c8f593f76301e", + "panels/ha-panel-history.html": "fe2daac10a14f51fa3eb7d23978df1f7", "panels/ha-panel-iframe.html": "56930204d6e067a3d600cf030f4b34c8", "panels/ha-panel-kiosk.html": "b40aa5cb52dd7675bea744afcf9eebf8", "panels/ha-panel-logbook.html": "771afdcf48dc7e308b0282417d2e02d8", "panels/ha-panel-map.html": "c2544fff3eedb487d44105cf94b335ec", - "panels/ha-panel-shopping-list.html": "d8cfd0ecdb3aa6214c0f6908c34c7141", - "panels/ha-panel-zwave.html": "48a71bd864f1f047ff74322be6430f00" + "panels/ha-panel-shopping-list.html": "d8cfd0ecdb3aa6214c0f6908c34c7141" } diff --git a/homeassistant/components/frontend/www_static/frontend.html b/homeassistant/components/frontend/www_static/frontend.html index 36805081438..0886a77e50d 100644 --- a/homeassistant/components/frontend/www_static/frontend.html +++ b/homeassistant/components/frontend/www_static/frontend.html @@ -10,7 +10,7 @@ .flex-1{-ms-flex:1 1 0.000000001px;-webkit-flex:1;flex:1;-webkit-flex-basis:0.000000001px;flex-basis:0.000000001px;}.flex-2{-ms-flex:2;-webkit-flex:2;flex:2;}.flex-3{-ms-flex:3;-webkit-flex:3;flex:3;}.flex-4{-ms-flex:4;-webkit-flex:4;flex:4;}.flex-5{-ms-flex:5;-webkit-flex:5;flex:5;}.flex-6{-ms-flex:6;-webkit-flex:6;flex:6;}.flex-7{-ms-flex:7;-webkit-flex:7;flex:7;}.flex-8{-ms-flex:8;-webkit-flex:8;flex:8;}.flex-9{-ms-flex:9;-webkit-flex:9;flex:9;}.flex-10{-ms-flex:10;-webkit-flex:10;flex:10;}.flex-11{-ms-flex:11;-webkit-flex:11;flex:11;}.flex-12{-ms-flex:12;-webkit-flex:12;flex:12;} \ No newline at end of file + :host-context([dir="rtl"]) iron-icon{left:0;right:auto;}:host([no-label-float]) iron-icon{margin-top:0px;}.error{display:inline-block;visibility:hidden;color:var(--paper-dropdown-error-color, var(--error-color));@apply --paper-font-caption;position:absolute;left:0;right:0;bottom:-12px;}:host([invalid]) .error{visibility:visible;} \ No newline at end of file diff --git a/homeassistant/components/frontend/www_static/frontend.html.gz b/homeassistant/components/frontend/www_static/frontend.html.gz index 1507b30d12d..de0fba914bf 100644 Binary files a/homeassistant/components/frontend/www_static/frontend.html.gz and b/homeassistant/components/frontend/www_static/frontend.html.gz differ diff --git a/homeassistant/components/frontend/www_static/home-assistant-polymer b/homeassistant/components/frontend/www_static/home-assistant-polymer index 1ea7137c78b..e81326cb650 160000 --- a/homeassistant/components/frontend/www_static/home-assistant-polymer +++ b/homeassistant/components/frontend/www_static/home-assistant-polymer @@ -1 +1 @@ -Subproject commit 1ea7137c78b3df577f5df72a6c9bbe91bb5f7cd0 +Subproject commit e81326cb6507d15ab94b4d69de87b909ef3e383e diff --git a/homeassistant/components/frontend/www_static/panels/ha-panel-automation.html b/homeassistant/components/frontend/www_static/panels/ha-panel-automation.html deleted file mode 100644 index 6e03db64c35..00000000000 --- a/homeassistant/components/frontend/www_static/panels/ha-panel-automation.html +++ /dev/null @@ -1,4 +0,0 @@ - \ No newline at end of file diff --git a/homeassistant/components/frontend/www_static/panels/ha-panel-automation.html.gz b/homeassistant/components/frontend/www_static/panels/ha-panel-automation.html.gz deleted file mode 100644 index 6be71ce9b34..00000000000 Binary files a/homeassistant/components/frontend/www_static/panels/ha-panel-automation.html.gz and /dev/null differ diff --git a/homeassistant/components/frontend/www_static/panels/ha-panel-config.html b/homeassistant/components/frontend/www_static/panels/ha-panel-config.html index 65b79bebba5..8613e4a7f6a 100644 --- a/homeassistant/components/frontend/www_static/panels/ha-panel-config.html +++ b/homeassistant/components/frontend/www_static/panels/ha-panel-config.html @@ -1 +1,4 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/homeassistant/components/frontend/www_static/panels/ha-panel-config.html.gz b/homeassistant/components/frontend/www_static/panels/ha-panel-config.html.gz index c0775a559c9..ba6beba798d 100644 Binary files a/homeassistant/components/frontend/www_static/panels/ha-panel-config.html.gz and b/homeassistant/components/frontend/www_static/panels/ha-panel-config.html.gz differ diff --git a/homeassistant/components/frontend/www_static/panels/ha-panel-dev-service.html b/homeassistant/components/frontend/www_static/panels/ha-panel-dev-service.html index 0f715309854..e7a94c1fcdc 100644 --- a/homeassistant/components/frontend/www_static/panels/ha-panel-dev-service.html +++ b/homeassistant/components/frontend/www_static/panels/ha-panel-dev-service.html @@ -1,4 +1,4 @@ -