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
This commit is contained in:
John Arild Berentsen 2016-08-02 20:17:10 +02:00 committed by GitHub
parent ad0224e9aa
commit e36c6b24ee
2 changed files with 21 additions and 2 deletions

View file

@ -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.

View file

@ -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)