Update volvooncall, add hybrid plug status (#58919)

This commit is contained in:
Jonathan Keslin 2021-12-03 11:07:03 -08:00 committed by GitHub
parent 88b93546f3
commit c915aa1493
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 10 deletions

View file

@ -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

View file

@ -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}"

View file

@ -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."""

View file

@ -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"
}

View file

@ -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