From b7044a79b239f6d8942677739d522bb197946ce4 Mon Sep 17 00:00:00 2001 From: Charles Spirakis Date: Sun, 13 Mar 2016 10:51:09 -0700 Subject: [PATCH] Enable openzwave's network heal and soft reset. Makes Zwave's network heal and the controller's soft reset commands available as service calls. They can be used in automation to help keep the zwave netwrok healthy. For example: automation: alias: At 2:35am, heal problematic zwave network routes trigger: platform: time after: '2:35:00' action: service: zwave.heal --- homeassistant/components/zwave.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/homeassistant/components/zwave.py b/homeassistant/components/zwave.py index f920b81e8db..2e36352c2eb 100644 --- a/homeassistant/components/zwave.py +++ b/homeassistant/components/zwave.py @@ -28,6 +28,8 @@ DEFAULT_ZWAVE_CONFIG_PATH = os.path.join(sys.prefix, 'share', SERVICE_ADD_NODE = "add_node" SERVICE_REMOVE_NODE = "remove_node" +SERVICE_HEAL_NETWORK = "heal_network" +SERVICE_SOFT_RESET = "soft_reset" DISCOVER_SENSORS = "zwave.sensors" DISCOVER_SWITCHES = "zwave.switch" @@ -149,6 +151,7 @@ def get_config_value(node, value_index): return get_config_value(node, value_index) +# pylint: disable=R0914 def setup(hass, config): """Setup Z-Wave. @@ -249,6 +252,14 @@ def setup(hass, config): """Switch into exclusion mode.""" NETWORK.controller.begin_command_remove_device() + def heal_network(event): + """Heal the network.""" + NETWORK.heal() + + def soft_reset(event): + """Soft reset the controller.""" + NETWORK.controller.soft_reset() + def stop_zwave(event): """Stop Z-Wave.""" NETWORK.stop() @@ -268,6 +279,8 @@ def setup(hass, config): # hardware inclusion button hass.services.register(DOMAIN, SERVICE_ADD_NODE, add_node) hass.services.register(DOMAIN, SERVICE_REMOVE_NODE, remove_node) + hass.services.register(DOMAIN, SERVICE_HEAL_NETWORK, heal_network) + hass.services.register(DOMAIN, SERVICE_SOFT_RESET, soft_reset) hass.bus.listen_once(EVENT_HOMEASSISTANT_START, start_zwave)