Give unknown zwave nodes a better name (#14353)

* Give unknown zwave nodes a better name

* Update util.py
This commit is contained in:
Andrey authored and Paulus Schoutsen committed 2018-05-28 21:49:38 -04:00
1 parent 07255a29b4
commit 6c3e2021df
3 files changed
+9 -5

No files matched your search

+5 -3
View File
@@ -68,8 +68,10 @@ def check_value_schema(value, schema):
def node_name(node):
"""Return the name of the node."""
return node.name or '{} {}'.format(
node.manufacturer_name, node.product_name)
if is_node_parsed(node):
return node.name or '{} {}'.format(
node.manufacturer_name, node.product_name)
return 'Unknown Node {}'.format(node.node_id)
async def check_has_unique_id(entity, ready_callback, timeout_callback, loop):
@@ -89,4 +91,4 @@ async def check_has_unique_id(entity, ready_callback, timeout_callback, loop):
def is_node_parsed(node):
"""Check whether the node has been parsed or still waiting to be parsed."""
return node.manufacturer_name and node.product_name
return bool((node.manufacturer_name and node.product_name) or node.name)