Use entity name in homee (#147142)

* add name to HomeeEntity

* review change
This commit is contained in:
Markus Adrario 2025-06-20 16:55:48 +02:00 committed by GitHub
parent f7429f3431
commit d9e5bad55e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 7 deletions

View File

@ -42,6 +42,8 @@ class HomeeEntity(Entity):
model=get_name_for_enum(NodeProfile, node.profile), model=get_name_for_enum(NodeProfile, node.profile),
via_device=(DOMAIN, entry.runtime_data.settings.uid), via_device=(DOMAIN, entry.runtime_data.settings.uid),
) )
if attribute.name:
self._attr_name = attribute.name
self._host_connected = entry.runtime_data.connected self._host_connected = entry.runtime_data.connected

View File

@ -61,7 +61,7 @@
"changed_by_id": 0, "changed_by_id": 0,
"based_on": 1, "based_on": 1,
"data": "", "data": "",
"name": "" "name": "Kitchen Light"
}, },
{ {
"id": 3, "id": 3,

View File

@ -1,5 +1,5 @@
# serializer version: 1 # serializer version: 1
# name: test_event_snapshot[event.remote_control_switch_1-entry] # name: test_event_snapshot[event.remote_control_kitchen_light-entry]
EntityRegistryEntrySnapshot({ EntityRegistryEntrySnapshot({
'aliases': set({ 'aliases': set({
}), }),
@ -18,7 +18,7 @@
'disabled_by': None, 'disabled_by': None,
'domain': 'event', 'domain': 'event',
'entity_category': None, 'entity_category': None,
'entity_id': 'event.remote_control_switch_1', 'entity_id': 'event.remote_control_kitchen_light',
'has_entity_name': True, 'has_entity_name': True,
'hidden_by': None, 'hidden_by': None,
'icon': None, 'icon': None,
@ -30,7 +30,7 @@
}), }),
'original_device_class': <EventDeviceClass.BUTTON: 'button'>, 'original_device_class': <EventDeviceClass.BUTTON: 'button'>,
'original_icon': None, 'original_icon': None,
'original_name': 'Switch 1', 'original_name': 'Kitchen Light',
'platform': 'homee', 'platform': 'homee',
'previous_unique_id': None, 'previous_unique_id': None,
'suggested_object_id': None, 'suggested_object_id': None,
@ -40,7 +40,7 @@
'unit_of_measurement': None, 'unit_of_measurement': None,
}) })
# --- # ---
# name: test_event_snapshot[event.remote_control_switch_1-state] # name: test_event_snapshot[event.remote_control_kitchen_light-state]
StateSnapshot({ StateSnapshot({
'attributes': ReadOnlyDict({ 'attributes': ReadOnlyDict({
'device_class': 'button', 'device_class': 'button',
@ -50,10 +50,10 @@
'lower', 'lower',
'released', 'released',
]), ]),
'friendly_name': 'Remote Control Switch 1', 'friendly_name': 'Remote Control Kitchen Light',
}), }),
'context': <ANY>, 'context': <ANY>,
'entity_id': 'event.remote_control_switch_1', 'entity_id': 'event.remote_control_kitchen_light',
'last_changed': <ANY>, 'last_changed': <ANY>,
'last_reported': <ANY>, 'last_reported': <ANY>,
'last_updated': <ANY>, 'last_updated': <ANY>,