mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Add unique_id to zwave node entity (#14201)
* Add unique_id to zwave node entity * Wait 30s before adding zwave node if its unique_id is not ready * Use only node_id in unique_id. Update name, manufacturer, and product attributes on node update.
This commit is contained in:
@@ -182,8 +182,6 @@ class TestZWaveNodeEntity(unittest.TestCase):
|
||||
query_stage='Dynamic', is_awake=True, is_ready=False,
|
||||
is_failed=False, is_info_received=True, max_baud_rate=40000,
|
||||
is_zwave_plus=False, capabilities=[], neighbors=[], location=None)
|
||||
self.node.manufacturer_name = 'Test Manufacturer'
|
||||
self.node.product_name = 'Test Product'
|
||||
self.entity = node_entity.ZWaveNodeEntity(self.node,
|
||||
self.zwave_network)
|
||||
|
||||
@@ -357,3 +355,14 @@ class TestZWaveNodeEntity(unittest.TestCase):
|
||||
def test_not_polled(self):
|
||||
"""Test should_poll property."""
|
||||
self.assertFalse(self.entity.should_poll)
|
||||
|
||||
def test_unique_id(self):
|
||||
"""Test unique_id."""
|
||||
self.assertEqual('node-567', self.entity.unique_id)
|
||||
|
||||
def test_unique_id_missing_data(self):
|
||||
"""Test unique_id."""
|
||||
self.node.manufacturer_name = None
|
||||
entity = node_entity.ZWaveNodeEntity(self.node, self.zwave_network)
|
||||
|
||||
self.assertIsNone(entity.unique_id)
|
||||
|
||||
Reference in New Issue
Block a user