From 1f72506f9b40f4aeba6a526b21b99cd298741eea Mon Sep 17 00:00:00 2001 From: Andrey Date: Fri, 17 Feb 2017 22:03:55 +0200 Subject: [PATCH] Add 'print_node' service to zwave (#6069) * add print * Add 'print_node' service to zwave. --- homeassistant/components/zwave/__init__.py | 15 +++++++++++++++ homeassistant/components/zwave/const.py | 1 + 2 files changed, 16 insertions(+) diff --git a/homeassistant/components/zwave/__init__.py b/homeassistant/components/zwave/__init__.py index 7e005ced69a..72ca67027d9 100755 --- a/homeassistant/components/zwave/__init__.py +++ b/homeassistant/components/zwave/__init__.py @@ -150,6 +150,10 @@ PRINT_CONFIG_PARAMETER_SCHEMA = vol.Schema({ vol.Required(const.ATTR_CONFIG_PARAMETER): vol.Coerce(int), }) +PRINT_NODE_SCHEMA = vol.Schema({ + vol.Required(const.ATTR_NODE_ID): vol.Coerce(int), +}) + CHANGE_ASSOCIATION_SCHEMA = vol.Schema({ vol.Required(const.ATTR_ASSOCIATION): cv.string, vol.Required(const.ATTR_NODE_ID): vol.Coerce(int), @@ -543,6 +547,12 @@ def setup(hass, config): _LOGGER.info("Config parameter %s on Node %s : %s", param, node_id, get_config_value(node, param)) + def print_node(service): + """Print all information about z-wave node.""" + node_id = service.data.get(const.ATTR_NODE_ID) + node = NETWORK.nodes[node_id] + nice_print_node(node) + def set_wakeup(service): """Set wake-up interval of a node.""" node_id = service.data.get(const.ATTR_NODE_ID) @@ -656,6 +666,11 @@ def setup(hass, config): descriptions[ const.SERVICE_SET_WAKEUP], schema=SET_WAKEUP_SCHEMA) + hass.services.register(DOMAIN, const.SERVICE_PRINT_NODE, + print_node, + descriptions[ + const.SERVICE_PRINT_NODE], + schema=PRINT_NODE_SCHEMA) # Setup autoheal if autoheal: diff --git a/homeassistant/components/zwave/const.py b/homeassistant/components/zwave/const.py index 8e28d924cfa..e9a17395735 100644 --- a/homeassistant/components/zwave/const.py +++ b/homeassistant/components/zwave/const.py @@ -25,6 +25,7 @@ SERVICE_SOFT_RESET = "soft_reset" SERVICE_TEST_NETWORK = "test_network" SERVICE_SET_CONFIG_PARAMETER = "set_config_parameter" SERVICE_PRINT_CONFIG_PARAMETER = "print_config_parameter" +SERVICE_PRINT_NODE = "print_node" SERVICE_SET_WAKEUP = "set_wakeup" SERVICE_STOP_NETWORK = "stop_network" SERVICE_START_NETWORK = "start_network"