diff --git a/CODEOWNERS b/CODEOWNERS index 7b872ade7ff..513115a9953 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -585,6 +585,7 @@ homeassistant/components/vizio/* @raman325 homeassistant/components/vlc_telnet/* @rodripf @dmcc @MartinHjelmare homeassistant/components/volkszaehler/* @fabaff homeassistant/components/volumio/* @OnFreund +homeassistant/components/volvooncall/* @molobrakos @decompil3d homeassistant/components/wake_on_lan/* @ntilley905 homeassistant/components/wallbox/* @hesselonline homeassistant/components/waqi/* @andrey-git diff --git a/homeassistant/components/volvooncall/__init__.py b/homeassistant/components/volvooncall/__init__.py index 556a5f25114..1d4f95b9341 100644 --- a/homeassistant/components/volvooncall/__init__.py +++ b/homeassistant/components/volvooncall/__init__.py @@ -156,7 +156,12 @@ async def async_setup(hass, config): hass, PLATFORMS[instrument.component], DOMAIN, - (vehicle.vin, instrument.component, instrument.attr), + ( + vehicle.vin, + instrument.component, + instrument.attr, + instrument.slug_attr, + ), config, ) ) @@ -192,7 +197,7 @@ class VolvoData: self.config = config[DOMAIN] self.names = self.config.get(CONF_NAME) - def instrument(self, vin, component, attr): + def instrument(self, vin, component, attr, slug_attr): """Return corresponding instrument.""" return next( ( @@ -201,6 +206,7 @@ class VolvoData: if instrument.vehicle.vin == vin and instrument.component == component and instrument.attr == attr + and instrument.slug_attr == slug_attr ), None, ) @@ -223,12 +229,13 @@ class VolvoData: class VolvoEntity(Entity): """Base class for all VOC entities.""" - def __init__(self, data, vin, component, attribute): + def __init__(self, data, vin, component, attribute, slug_attr): """Initialize the entity.""" self.data = data self.vin = vin self.component = component self.attribute = attribute + self.slug_attr = slug_attr async def async_added_to_hass(self): """Register update dispatcher.""" @@ -241,7 +248,9 @@ class VolvoEntity(Entity): @property def instrument(self): """Return corresponding instrument.""" - return self.data.instrument(self.vin, self.component, self.attribute) + return self.data.instrument( + self.vin, self.component, self.attribute, self.slug_attr + ) @property def icon(self): @@ -287,4 +296,7 @@ class VolvoEntity(Entity): @property def unique_id(self) -> str: """Return a unique ID.""" - return f"{self.vin}-{self.component}-{self.attribute}" + slug_override = "" + if self.instrument.slug_override is not None: + slug_override = f"-{self.instrument.slug_override}" + return f"{self.vin}-{self.component}-{self.attribute}{slug_override}" diff --git a/homeassistant/components/volvooncall/device_tracker.py b/homeassistant/components/volvooncall/device_tracker.py index ebc4990db55..15615c9d807 100644 --- a/homeassistant/components/volvooncall/device_tracker.py +++ b/homeassistant/components/volvooncall/device_tracker.py @@ -11,9 +11,9 @@ async def async_setup_scanner(hass, config, async_see, discovery_info=None): if discovery_info is None: return - vin, component, attr = discovery_info + vin, component, attr, slug_attr = discovery_info data = hass.data[DATA_KEY] - instrument = data.instrument(vin, component, attr) + instrument = data.instrument(vin, component, attr, slug_attr) async def see_vehicle(): """Handle the reporting of the vehicle position.""" diff --git a/homeassistant/components/volvooncall/manifest.json b/homeassistant/components/volvooncall/manifest.json index 5201614ab8b..eac179efa8d 100644 --- a/homeassistant/components/volvooncall/manifest.json +++ b/homeassistant/components/volvooncall/manifest.json @@ -2,7 +2,7 @@ "domain": "volvooncall", "name": "Volvo On Call", "documentation": "https://www.home-assistant.io/integrations/volvooncall", - "requirements": ["volvooncall==0.8.12"], - "codeowners": [], + "requirements": ["volvooncall==0.9.1"], + "codeowners": ["@molobrakos", "@decompil3d"], "iot_class": "cloud_polling" } diff --git a/requirements_all.txt b/requirements_all.txt index 0160ed64b6b..e49e0aae85d 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -2393,7 +2393,7 @@ vilfo-api-client==0.3.2 volkszaehler==0.2.1 # homeassistant.components.volvooncall -volvooncall==0.8.12 +volvooncall==0.9.1 # homeassistant.components.verisure vsure==1.7.3