Migrate google assistant to has entity name (#96593)

* Migrate google assistant to has entity name

* Fix tests

* Add device name

* Update homeassistant/components/google_assistant/button.py

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>

---------

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
Joost Lekkerkerker 2023-07-16 17:39:27 +02:00 committed by GitHub
parent 7ec506907c
commit 28540b0cb2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 5 deletions

View file

@ -34,14 +34,19 @@ async def async_setup_entry(
class SyncButton(ButtonEntity):
"""Representation of a synchronization button."""
_attr_has_entity_name = True
_attr_translation_key = "sync_devices"
def __init__(self, project_id: str, google_config: GoogleConfig) -> None:
"""Initialize button."""
super().__init__()
self._google_config = google_config
self._attr_entity_category = EntityCategory.DIAGNOSTIC
self._attr_unique_id = f"{project_id}_sync"
self._attr_name = "Synchronize Devices"
self._attr_device_info = DeviceInfo(identifiers={(DOMAIN, project_id)})
self._attr_device_info = DeviceInfo(
identifiers={(DOMAIN, project_id)},
name="Google Assistant",
)
async def async_press(self) -> None:
"""Press the button."""