From e36c6b24eeda4b53d7ea7b4217fc469358648804 Mon Sep 17 00:00:00 2001 From: John Arild Berentsen Date: Tue, 2 Aug 2016 20:17:10 +0200 Subject: [PATCH] Add secure inclusion of nodes for zwave network (#2715) * Add secure inclusion of nodes for zwave network * Add secure inclusion of nodes for zwave network --- homeassistant/components/services.yaml | 6 ++++++ homeassistant/components/zwave.py | 17 +++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/services.yaml b/homeassistant/components/services.yaml index 03f5b0cda26..3068aed9e67 100644 --- a/homeassistant/components/services.yaml +++ b/homeassistant/components/services.yaml @@ -45,9 +45,15 @@ zwave: add_node: description: Add a new node to the zwave network. Refer to OZW.log for details. + add_node_secure: + description: Add a new node to the zwave network with secure communications. Node must support this, and network key must be set. Refer to OZW.log for details. + remove_node: description: Remove a node from the zwave network. Refer to OZW.log for details. + remove_node_secure: + description: Remove a node from the zwave network with secure communications. Node must support this, and network key must be set. Refer to OZW.log for details. + test_network: description: This will send test to nodes in the zwave network. This will greatly slow down the zwave network while it is being processed. Refer to OZW.log for details. diff --git a/homeassistant/components/zwave.py b/homeassistant/components/zwave.py index 93e77ca86a1..d31884d1767 100644 --- a/homeassistant/components/zwave.py +++ b/homeassistant/components/zwave.py @@ -32,7 +32,9 @@ DEFAULT_CONF_AUTOHEAL = True NETWORK_READY_WAIT_SECS = 30 SERVICE_ADD_NODE = "add_node" +SERVICE_ADD_NODE_SECURE = "add_node_secure" SERVICE_REMOVE_NODE = "remove_node" +SERVICE_REMOVE_NODE_SECURE = "remove_node_secure" SERVICE_HEAL_NETWORK = "heal_network" SERVICE_SOFT_RESET = "soft_reset" SERVICE_TEST_NETWORK = "test_network" @@ -404,10 +406,18 @@ def setup(hass, config): """Switch into inclusion mode.""" NETWORK.controller.add_node() + def add_node_secure(service): + """Switch into secure inclusion mode.""" + NETWORK.controller.add_node(True) + def remove_node(service): """Switch into exclusion mode.""" NETWORK.controller.remove_node() + def remove_node_secure(service): + """Switch into secure exclusion mode.""" + NETWORK.controller.remove_node(True) + def heal_network(service): """Heal the network.""" _LOGGER.info("ZWave heal running.") @@ -456,10 +466,13 @@ def setup(hass, config): hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, stop_zwave) - # Register add / remove node services for Z-Wave sticks without - # hardware inclusion button + # Register node services for Z-Wave network hass.services.register(DOMAIN, SERVICE_ADD_NODE, add_node) + hass.services.register(DOMAIN, SERVICE_ADD_NODE_SECURE, + add_node_secure) hass.services.register(DOMAIN, SERVICE_REMOVE_NODE, remove_node) + hass.services.register(DOMAIN, SERVICE_REMOVE_NODE_SECURE, + remove_node_secure) hass.services.register(DOMAIN, SERVICE_HEAL_NETWORK, heal_network) hass.services.register(DOMAIN, SERVICE_SOFT_RESET, soft_reset) hass.services.register(DOMAIN, SERVICE_TEST_NETWORK, test_network)