Add 'print_node' service to zwave (#6069)
* add print * Add 'print_node' service to zwave.pull/6073/head^2
parent
843840b963
commit
1f72506f9b
|
@ -150,6 +150,10 @@ PRINT_CONFIG_PARAMETER_SCHEMA = vol.Schema({
|
||||||
vol.Required(const.ATTR_CONFIG_PARAMETER): vol.Coerce(int),
|
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({
|
CHANGE_ASSOCIATION_SCHEMA = vol.Schema({
|
||||||
vol.Required(const.ATTR_ASSOCIATION): cv.string,
|
vol.Required(const.ATTR_ASSOCIATION): cv.string,
|
||||||
vol.Required(const.ATTR_NODE_ID): vol.Coerce(int),
|
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",
|
_LOGGER.info("Config parameter %s on Node %s : %s",
|
||||||
param, node_id, get_config_value(node, param))
|
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):
|
def set_wakeup(service):
|
||||||
"""Set wake-up interval of a node."""
|
"""Set wake-up interval of a node."""
|
||||||
node_id = service.data.get(const.ATTR_NODE_ID)
|
node_id = service.data.get(const.ATTR_NODE_ID)
|
||||||
|
@ -656,6 +666,11 @@ def setup(hass, config):
|
||||||
descriptions[
|
descriptions[
|
||||||
const.SERVICE_SET_WAKEUP],
|
const.SERVICE_SET_WAKEUP],
|
||||||
schema=SET_WAKEUP_SCHEMA)
|
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
|
# Setup autoheal
|
||||||
if autoheal:
|
if autoheal:
|
||||||
|
|
|
@ -25,6 +25,7 @@ SERVICE_SOFT_RESET = "soft_reset"
|
||||||
SERVICE_TEST_NETWORK = "test_network"
|
SERVICE_TEST_NETWORK = "test_network"
|
||||||
SERVICE_SET_CONFIG_PARAMETER = "set_config_parameter"
|
SERVICE_SET_CONFIG_PARAMETER = "set_config_parameter"
|
||||||
SERVICE_PRINT_CONFIG_PARAMETER = "print_config_parameter"
|
SERVICE_PRINT_CONFIG_PARAMETER = "print_config_parameter"
|
||||||
|
SERVICE_PRINT_NODE = "print_node"
|
||||||
SERVICE_SET_WAKEUP = "set_wakeup"
|
SERVICE_SET_WAKEUP = "set_wakeup"
|
||||||
SERVICE_STOP_NETWORK = "stop_network"
|
SERVICE_STOP_NETWORK = "stop_network"
|
||||||
SERVICE_START_NETWORK = "start_network"
|
SERVICE_START_NETWORK = "start_network"
|
||||||
|
|
Loading…
Reference in New Issue