mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 09:17:10 +00:00
Break product name up into manufacturer name and product name
This commit is contained in:
parent
b6ee2332f4
commit
e5756ba41d
@ -16,6 +16,7 @@ ATTR_AWAKE = 'is_awake'
|
|||||||
ATTR_READY = 'is_ready'
|
ATTR_READY = 'is_ready'
|
||||||
ATTR_FAILED = 'is_failed'
|
ATTR_FAILED = 'is_failed'
|
||||||
ATTR_PRODUCT_NAME = 'product_name'
|
ATTR_PRODUCT_NAME = 'product_name'
|
||||||
|
ATTR_MANUFACTURER_NAME = 'manufacturer_name'
|
||||||
|
|
||||||
STAGE_COMPLETE = 'Complete'
|
STAGE_COMPLETE = 'Complete'
|
||||||
|
|
||||||
@ -80,8 +81,8 @@ class ZWaveNodeEntity(ZWaveBaseEntity):
|
|||||||
self.node = node
|
self.node = node
|
||||||
self.node_id = self.node.node_id
|
self.node_id = self.node.node_id
|
||||||
self._name = node_name(self.node)
|
self._name = node_name(self.node)
|
||||||
self._product_name = '{} {}'.format(
|
self._product_name = node.product_name
|
||||||
node.manufacturer_name, node.product_name)
|
self._manufacturer_name = node.manufacturer_name
|
||||||
self.entity_id = "{}.{}_{}".format(
|
self.entity_id = "{}.{}_{}".format(
|
||||||
DOMAIN, slugify(self._name), self.node_id)
|
DOMAIN, slugify(self._name), self.node_id)
|
||||||
self._attributes = {}
|
self._attributes = {}
|
||||||
@ -164,6 +165,7 @@ class ZWaveNodeEntity(ZWaveBaseEntity):
|
|||||||
"""Return the device specific state attributes."""
|
"""Return the device specific state attributes."""
|
||||||
attrs = {
|
attrs = {
|
||||||
ATTR_NODE_ID: self.node_id,
|
ATTR_NODE_ID: self.node_id,
|
||||||
|
ATTR_MANUFACTURER_NAME: self._manufacturer_name,
|
||||||
ATTR_PRODUCT_NAME: self._product_name,
|
ATTR_PRODUCT_NAME: self._product_name,
|
||||||
}
|
}
|
||||||
attrs.update(self._attributes)
|
attrs.update(self._attributes)
|
||||||
|
@ -83,7 +83,8 @@ class TestZWaveNodeEntity(unittest.TestCase):
|
|||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
{'node_id': self.node.node_id,
|
{'node_id': self.node.node_id,
|
||||||
'product_name': 'Test Manufacturer Test Product'},
|
'manufacturer_name': 'Test Manufacturer',
|
||||||
|
'product_name': 'Test Product'},
|
||||||
self.entity.device_state_attributes)
|
self.entity.device_state_attributes)
|
||||||
|
|
||||||
self.node.get_values.return_value = {
|
self.node.get_values.return_value = {
|
||||||
@ -139,7 +140,8 @@ class TestZWaveNodeEntity(unittest.TestCase):
|
|||||||
self.entity.node_changed()
|
self.entity.node_changed()
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
{'node_id': self.node.node_id,
|
{'node_id': self.node.node_id,
|
||||||
'product_name': 'Test Manufacturer Test Product',
|
'manufacturer_name': 'Test Manufacturer',
|
||||||
|
'product_name': 'Test Product',
|
||||||
'query_stage': 'Dynamic',
|
'query_stage': 'Dynamic',
|
||||||
'is_awake': True,
|
'is_awake': True,
|
||||||
'is_ready': False,
|
'is_ready': False,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user