From 4b0f58ec637736cffc8a2d8101e646c70ea3ed67 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Fri, 24 May 2024 22:23:25 -0400 Subject: [PATCH] Add device info to Google (#118074) --- .../google_generative_ai_conversation/conversation.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/google_generative_ai_conversation/conversation.py b/homeassistant/components/google_generative_ai_conversation/conversation.py index f743c991759..ad50c544ac7 100644 --- a/homeassistant/components/google_generative_ai_conversation/conversation.py +++ b/homeassistant/components/google_generative_ai_conversation/conversation.py @@ -16,7 +16,7 @@ from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_LLM_HASS_API, MATCH_ALL from homeassistant.core import HomeAssistant from homeassistant.exceptions import HomeAssistantError, TemplateError -from homeassistant.helpers import intent, llm, template +from homeassistant.helpers import device_registry as dr, intent, llm, template from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.util import ulid @@ -111,13 +111,20 @@ class GoogleGenerativeAIConversationEntity( """Google Generative AI conversation agent.""" _attr_has_entity_name = True + _attr_name = None def __init__(self, entry: ConfigEntry) -> None: """Initialize the agent.""" self.entry = entry self.history: dict[str, list[genai_types.ContentType]] = {} - self._attr_name = entry.title self._attr_unique_id = entry.entry_id + self._attr_device_info = dr.DeviceInfo( + identifiers={(DOMAIN, entry.entry_id)}, + name=entry.title, + manufacturer="Google", + model="Generative AI", + entry_type=dr.DeviceEntryType.SERVICE, + ) @property def supported_languages(self) -> list[str] | Literal["*"]: