From 849688f71fcaaeab2e9e80d143359bf36192d3bb Mon Sep 17 00:00:00 2001 From: DanielV Date: Fri, 14 Oct 2022 12:11:53 +0200 Subject: [PATCH] Add volvo on call device_info to group entities in one device per vehicle (#79329) --- homeassistant/components/volvooncall/__init__.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/homeassistant/components/volvooncall/__init__.py b/homeassistant/components/volvooncall/__init__.py index 5a24712b7a3..65bc6c1cfbe 100644 --- a/homeassistant/components/volvooncall/__init__.py +++ b/homeassistant/components/volvooncall/__init__.py @@ -23,6 +23,7 @@ from homeassistant.exceptions import ConfigEntryAuthFailed from homeassistant.helpers.aiohttp_client import async_get_clientsession import homeassistant.helpers.config_validation as cv from homeassistant.helpers.dispatcher import async_dispatcher_send +from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.issue_registry import IssueSeverity, async_create_issue from homeassistant.helpers.typing import ConfigType from homeassistant.helpers.update_coordinator import ( @@ -314,6 +315,16 @@ class VolvoEntity(CoordinatorEntity): """Return true if unable to access real state of entity.""" return True + @property + def device_info(self) -> DeviceInfo: + """Return a inique set of attributes for each vehicle.""" + return DeviceInfo( + identifiers={(DOMAIN, self.vehicle.vin)}, + name=self._vehicle_name, + model=self.vehicle.vehicle_type, + manufacturer="Volvo", + ) + @property def extra_state_attributes(self): """Return device specific state attributes."""