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/vlc_telnet/* @rodripf @dmcc @MartinHjelmare
homeassistant/components/volkszaehler/* @fabaff homeassistant/components/volkszaehler/* @fabaff
homeassistant/components/volumio/* @OnFreund homeassistant/components/volumio/* @OnFreund
homeassistant/components/volvooncall/* @molobrakos @decompil3d
homeassistant/components/wake_on_lan/* @ntilley905 homeassistant/components/wake_on_lan/* @ntilley905
homeassistant/components/wallbox/* @hesselonline homeassistant/components/wallbox/* @hesselonline
homeassistant/components/waqi/* @andrey-git homeassistant/components/waqi/* @andrey-git

View File

@ -156,7 +156,12 @@ async def async_setup(hass, config):
hass, hass,
PLATFORMS[instrument.component], PLATFORMS[instrument.component],
DOMAIN, DOMAIN,
(vehicle.vin, instrument.component, instrument.attr), (
vehicle.vin,
instrument.component,
instrument.attr,
instrument.slug_attr,
),
config, config,
) )
) )
@ -192,7 +197,7 @@ class VolvoData:
self.config = config[DOMAIN] self.config = config[DOMAIN]
self.names = self.config.get(CONF_NAME) 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 corresponding instrument."""
return next( return next(
( (
@ -201,6 +206,7 @@ class VolvoData:
if instrument.vehicle.vin == vin if instrument.vehicle.vin == vin
and instrument.component == component and instrument.component == component
and instrument.attr == attr and instrument.attr == attr
and instrument.slug_attr == slug_attr
), ),
None, None,
) )
@ -223,12 +229,13 @@ class VolvoData:
class VolvoEntity(Entity): class VolvoEntity(Entity):
"""Base class for all VOC entities.""" """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.""" """Initialize the entity."""
self.data = data self.data = data
self.vin = vin self.vin = vin
self.component = component self.component = component
self.attribute = attribute self.attribute = attribute
self.slug_attr = slug_attr
async def async_added_to_hass(self): async def async_added_to_hass(self):
"""Register update dispatcher.""" """Register update dispatcher."""
@ -241,7 +248,9 @@ class VolvoEntity(Entity):
@property @property
def instrument(self): def instrument(self):
"""Return corresponding instrument.""" """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 @property
def icon(self): def icon(self):
@ -287,4 +296,7 @@ class VolvoEntity(Entity):
@property @property
def unique_id(self) -> str: def unique_id(self) -> str:
"""Return a unique ID.""" """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: if discovery_info is None:
return return
vin, component, attr = discovery_info vin, component, attr, slug_attr = discovery_info
data = hass.data[DATA_KEY] data = hass.data[DATA_KEY]
instrument = data.instrument(vin, component, attr) instrument = data.instrument(vin, component, attr, slug_attr)
async def see_vehicle(): async def see_vehicle():
"""Handle the reporting of the vehicle position.""" """Handle the reporting of the vehicle position."""

View File

@ -2,7 +2,7 @@
"domain": "volvooncall", "domain": "volvooncall",
"name": "Volvo On Call", "name": "Volvo On Call",
"documentation": "https://www.home-assistant.io/integrations/volvooncall", "documentation": "https://www.home-assistant.io/integrations/volvooncall",
"requirements": ["volvooncall==0.8.12"], "requirements": ["volvooncall==0.9.1"],
"codeowners": [], "codeowners": ["@molobrakos", "@decompil3d"],
"iot_class": "cloud_polling" "iot_class": "cloud_polling"
} }

View File

@ -2393,7 +2393,7 @@ vilfo-api-client==0.3.2
volkszaehler==0.2.1 volkszaehler==0.2.1
# homeassistant.components.volvooncall # homeassistant.components.volvooncall
volvooncall==0.8.12 volvooncall==0.9.1
# homeassistant.components.verisure # homeassistant.components.verisure
vsure==1.7.3 vsure==1.7.3