mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
Rename zwave nodes by node ID instead of entity ID (#6938)
This commit is contained in:
parent
a5f77d5f46
commit
75a3747f61
@ -68,7 +68,7 @@ DATA_ZWAVE_DICT = 'zwave_devices'
|
|||||||
NETWORK = None
|
NETWORK = None
|
||||||
|
|
||||||
RENAME_NODE_SCHEMA = vol.Schema({
|
RENAME_NODE_SCHEMA = vol.Schema({
|
||||||
vol.Required(ATTR_ENTITY_ID): cv.entity_id,
|
vol.Required(const.ATTR_NODE_ID): vol.Coerce(int),
|
||||||
vol.Required(const.ATTR_NAME): cv.string,
|
vol.Required(const.ATTR_NAME): cv.string,
|
||||||
})
|
})
|
||||||
SET_CONFIG_PARAMETER_SCHEMA = vol.Schema({
|
SET_CONFIG_PARAMETER_SCHEMA = vol.Schema({
|
||||||
@ -393,8 +393,7 @@ def setup(hass, config):
|
|||||||
|
|
||||||
def rename_node(service):
|
def rename_node(service):
|
||||||
"""Rename a node."""
|
"""Rename a node."""
|
||||||
state = hass.states.get(service.data.get(ATTR_ENTITY_ID))
|
node_id = service.data.get(const.ATTR_NODE_ID)
|
||||||
node_id = state.attributes.get(const.ATTR_NODE_ID)
|
|
||||||
node = NETWORK.nodes[node_id]
|
node = NETWORK.nodes[node_id]
|
||||||
name = service.data.get(const.ATTR_NAME)
|
name = service.data.get(const.ATTR_NAME)
|
||||||
node.name = name
|
node.name = name
|
||||||
|
@ -102,9 +102,9 @@ test_network:
|
|||||||
rename_node:
|
rename_node:
|
||||||
description: Set the name(s) of a node.
|
description: Set the name(s) of a node.
|
||||||
fields:
|
fields:
|
||||||
entity_id:
|
node_id:
|
||||||
description: Name(s) of entities to to rename
|
description: ID of the node to rename.
|
||||||
example: 'light.leviton_vrmx11lz_multilevel_scene_switch_level_40'
|
example: 10
|
||||||
name:
|
name:
|
||||||
description: New Name
|
description: New Name
|
||||||
example: 'kitchen'
|
example: 'kitchen'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user