mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Bump renault-api to 0.3.0 (#143657)
This commit is contained in:
parent
ce7edca136
commit
1075ea1220
@ -74,10 +74,7 @@ BINARY_SENSOR_TYPES: tuple[RenaultBinarySensorEntityDescription, ...] = tuple(
|
|||||||
coordinator="battery",
|
coordinator="battery",
|
||||||
device_class=BinarySensorDeviceClass.PLUG,
|
device_class=BinarySensorDeviceClass.PLUG,
|
||||||
on_key="plugStatus",
|
on_key="plugStatus",
|
||||||
on_value=[
|
on_value=PlugState.PLUGGED.value,
|
||||||
PlugState.PLUGGED.value,
|
|
||||||
PlugState.PLUGGED_WAITING_FOR_CHARGE.value,
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
RenaultBinarySensorEntityDescription(
|
RenaultBinarySensorEntityDescription(
|
||||||
key="charging",
|
key="charging",
|
||||||
|
@ -8,5 +8,5 @@
|
|||||||
"iot_class": "cloud_polling",
|
"iot_class": "cloud_polling",
|
||||||
"loggers": ["renault_api"],
|
"loggers": ["renault_api"],
|
||||||
"quality_scale": "silver",
|
"quality_scale": "silver",
|
||||||
"requirements": ["renault-api==0.2.9"]
|
"requirements": ["renault-api==0.3.0"]
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ import logging
|
|||||||
from typing import TYPE_CHECKING, Any, Concatenate, cast
|
from typing import TYPE_CHECKING, Any, Concatenate, cast
|
||||||
|
|
||||||
from renault_api.exceptions import RenaultException
|
from renault_api.exceptions import RenaultException
|
||||||
from renault_api.kamereon import models
|
from renault_api.kamereon import models, schemas
|
||||||
from renault_api.renault_vehicle import RenaultVehicle
|
from renault_api.renault_vehicle import RenaultVehicle
|
||||||
|
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
@ -201,7 +201,18 @@ class RenaultVehicleProxy:
|
|||||||
@with_error_wrapping
|
@with_error_wrapping
|
||||||
async def get_charging_settings(self) -> models.KamereonVehicleChargingSettingsData:
|
async def get_charging_settings(self) -> models.KamereonVehicleChargingSettingsData:
|
||||||
"""Get vehicle charging settings."""
|
"""Get vehicle charging settings."""
|
||||||
return await self._vehicle.get_charging_settings()
|
full_endpoint = await self._vehicle.get_full_endpoint("charging-settings")
|
||||||
|
response = await self._vehicle.http_get(full_endpoint)
|
||||||
|
response_data = cast(
|
||||||
|
models.KamereonVehicleDataResponse,
|
||||||
|
schemas.KamereonVehicleDataResponseSchema.load(response.raw_data),
|
||||||
|
)
|
||||||
|
return cast(
|
||||||
|
models.KamereonVehicleChargingSettingsData,
|
||||||
|
response_data.get_attributes(
|
||||||
|
schemas.KamereonVehicleChargingSettingsDataSchema
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
@with_error_wrapping
|
@with_error_wrapping
|
||||||
async def set_charge_schedules(
|
async def set_charge_schedules(
|
||||||
|
2
requirements_all.txt
generated
2
requirements_all.txt
generated
@ -2630,7 +2630,7 @@ refoss-ha==1.2.5
|
|||||||
regenmaschine==2024.03.0
|
regenmaschine==2024.03.0
|
||||||
|
|
||||||
# homeassistant.components.renault
|
# homeassistant.components.renault
|
||||||
renault-api==0.2.9
|
renault-api==0.3.0
|
||||||
|
|
||||||
# homeassistant.components.renson
|
# homeassistant.components.renson
|
||||||
renson-endura-delta==1.7.2
|
renson-endura-delta==1.7.2
|
||||||
|
2
requirements_test_all.txt
generated
2
requirements_test_all.txt
generated
@ -2134,7 +2134,7 @@ refoss-ha==1.2.5
|
|||||||
regenmaschine==2024.03.0
|
regenmaschine==2024.03.0
|
||||||
|
|
||||||
# homeassistant.components.renault
|
# homeassistant.components.renault
|
||||||
renault-api==0.2.9
|
renault-api==0.3.0
|
||||||
|
|
||||||
# homeassistant.components.renson
|
# homeassistant.components.renson
|
||||||
renson-endura-delta==1.7.2
|
renson-endura-delta==1.7.2
|
||||||
|
@ -256,17 +256,6 @@ MOCK_VEHICLES = {
|
|||||||
ATTR_STATE: "plugged",
|
ATTR_STATE: "plugged",
|
||||||
ATTR_UNIQUE_ID: "vf1aaaaa555777999_plug_state",
|
ATTR_UNIQUE_ID: "vf1aaaaa555777999_plug_state",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
ATTR_ENTITY_ID: "sensor.reg_number_remote_engine_start",
|
|
||||||
ATTR_STATE: STATE_UNKNOWN,
|
|
||||||
ATTR_UNIQUE_ID: "vf1aaaaa555777999_res_state",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ATTR_DEFAULT_DISABLED: True,
|
|
||||||
ATTR_ENTITY_ID: "sensor.reg_number_remote_engine_start_code",
|
|
||||||
ATTR_STATE: STATE_UNKNOWN,
|
|
||||||
ATTR_UNIQUE_ID: "vf1aaaaa555777999_res_state_code",
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"zoe_50": {
|
"zoe_50": {
|
||||||
|
@ -24,8 +24,6 @@
|
|||||||
'externalTemperature': 8.0,
|
'externalTemperature': 8.0,
|
||||||
'hvacStatus': 'off',
|
'hvacStatus': 'off',
|
||||||
}),
|
}),
|
||||||
'res_state': dict({
|
|
||||||
}),
|
|
||||||
}),
|
}),
|
||||||
'details': dict({
|
'details': dict({
|
||||||
'assets': list([
|
'assets': list([
|
||||||
@ -229,8 +227,6 @@
|
|||||||
'externalTemperature': 8.0,
|
'externalTemperature': 8.0,
|
||||||
'hvacStatus': 'off',
|
'hvacStatus': 'off',
|
||||||
}),
|
}),
|
||||||
'res_state': dict({
|
|
||||||
}),
|
|
||||||
}),
|
}),
|
||||||
'details': dict({
|
'details': dict({
|
||||||
'assets': list([
|
'assets': list([
|
||||||
|
@ -1577,70 +1577,6 @@
|
|||||||
'unique_id': 'vf1aaaaa555777999_hvac_last_activity',
|
'unique_id': 'vf1aaaaa555777999_hvac_last_activity',
|
||||||
'unit_of_measurement': None,
|
'unit_of_measurement': None,
|
||||||
}),
|
}),
|
||||||
EntityRegistryEntrySnapshot({
|
|
||||||
'aliases': set({
|
|
||||||
}),
|
|
||||||
'area_id': None,
|
|
||||||
'capabilities': None,
|
|
||||||
'config_entry_id': <ANY>,
|
|
||||||
'config_subentry_id': <ANY>,
|
|
||||||
'device_class': None,
|
|
||||||
'device_id': <ANY>,
|
|
||||||
'disabled_by': None,
|
|
||||||
'domain': 'sensor',
|
|
||||||
'entity_category': None,
|
|
||||||
'entity_id': 'sensor.reg_number_remote_engine_start',
|
|
||||||
'has_entity_name': True,
|
|
||||||
'hidden_by': None,
|
|
||||||
'icon': None,
|
|
||||||
'id': <ANY>,
|
|
||||||
'labels': set({
|
|
||||||
}),
|
|
||||||
'name': None,
|
|
||||||
'options': dict({
|
|
||||||
}),
|
|
||||||
'original_device_class': None,
|
|
||||||
'original_icon': None,
|
|
||||||
'original_name': 'Remote engine start',
|
|
||||||
'platform': 'renault',
|
|
||||||
'previous_unique_id': None,
|
|
||||||
'supported_features': 0,
|
|
||||||
'translation_key': 'res_state',
|
|
||||||
'unique_id': 'vf1aaaaa555777999_res_state',
|
|
||||||
'unit_of_measurement': None,
|
|
||||||
}),
|
|
||||||
EntityRegistryEntrySnapshot({
|
|
||||||
'aliases': set({
|
|
||||||
}),
|
|
||||||
'area_id': None,
|
|
||||||
'capabilities': None,
|
|
||||||
'config_entry_id': <ANY>,
|
|
||||||
'config_subentry_id': <ANY>,
|
|
||||||
'device_class': None,
|
|
||||||
'device_id': <ANY>,
|
|
||||||
'disabled_by': None,
|
|
||||||
'domain': 'sensor',
|
|
||||||
'entity_category': None,
|
|
||||||
'entity_id': 'sensor.reg_number_remote_engine_start_code',
|
|
||||||
'has_entity_name': True,
|
|
||||||
'hidden_by': None,
|
|
||||||
'icon': None,
|
|
||||||
'id': <ANY>,
|
|
||||||
'labels': set({
|
|
||||||
}),
|
|
||||||
'name': None,
|
|
||||||
'options': dict({
|
|
||||||
}),
|
|
||||||
'original_device_class': None,
|
|
||||||
'original_icon': None,
|
|
||||||
'original_name': 'Remote engine start code',
|
|
||||||
'platform': 'renault',
|
|
||||||
'previous_unique_id': None,
|
|
||||||
'supported_features': 0,
|
|
||||||
'translation_key': 'res_state_code',
|
|
||||||
'unique_id': 'vf1aaaaa555777999_res_state_code',
|
|
||||||
'unit_of_measurement': None,
|
|
||||||
}),
|
|
||||||
])
|
])
|
||||||
# ---
|
# ---
|
||||||
# name: test_sensor_empty[zoe_40].2
|
# name: test_sensor_empty[zoe_40].2
|
||||||
@ -1834,28 +1770,6 @@
|
|||||||
'last_updated': <ANY>,
|
'last_updated': <ANY>,
|
||||||
'state': 'unknown',
|
'state': 'unknown',
|
||||||
}),
|
}),
|
||||||
StateSnapshot({
|
|
||||||
'attributes': ReadOnlyDict({
|
|
||||||
'friendly_name': 'REG-NUMBER Remote engine start',
|
|
||||||
}),
|
|
||||||
'context': <ANY>,
|
|
||||||
'entity_id': 'sensor.reg_number_remote_engine_start',
|
|
||||||
'last_changed': <ANY>,
|
|
||||||
'last_reported': <ANY>,
|
|
||||||
'last_updated': <ANY>,
|
|
||||||
'state': 'unknown',
|
|
||||||
}),
|
|
||||||
StateSnapshot({
|
|
||||||
'attributes': ReadOnlyDict({
|
|
||||||
'friendly_name': 'REG-NUMBER Remote engine start code',
|
|
||||||
}),
|
|
||||||
'context': <ANY>,
|
|
||||||
'entity_id': 'sensor.reg_number_remote_engine_start_code',
|
|
||||||
'last_changed': <ANY>,
|
|
||||||
'last_reported': <ANY>,
|
|
||||||
'last_updated': <ANY>,
|
|
||||||
'state': 'unknown',
|
|
||||||
}),
|
|
||||||
])
|
])
|
||||||
# ---
|
# ---
|
||||||
# name: test_sensor_empty[zoe_50]
|
# name: test_sensor_empty[zoe_50]
|
||||||
@ -4249,70 +4163,6 @@
|
|||||||
'unique_id': 'vf1aaaaa555777999_hvac_last_activity',
|
'unique_id': 'vf1aaaaa555777999_hvac_last_activity',
|
||||||
'unit_of_measurement': None,
|
'unit_of_measurement': None,
|
||||||
}),
|
}),
|
||||||
EntityRegistryEntrySnapshot({
|
|
||||||
'aliases': set({
|
|
||||||
}),
|
|
||||||
'area_id': None,
|
|
||||||
'capabilities': None,
|
|
||||||
'config_entry_id': <ANY>,
|
|
||||||
'config_subentry_id': <ANY>,
|
|
||||||
'device_class': None,
|
|
||||||
'device_id': <ANY>,
|
|
||||||
'disabled_by': None,
|
|
||||||
'domain': 'sensor',
|
|
||||||
'entity_category': None,
|
|
||||||
'entity_id': 'sensor.reg_number_remote_engine_start',
|
|
||||||
'has_entity_name': True,
|
|
||||||
'hidden_by': None,
|
|
||||||
'icon': None,
|
|
||||||
'id': <ANY>,
|
|
||||||
'labels': set({
|
|
||||||
}),
|
|
||||||
'name': None,
|
|
||||||
'options': dict({
|
|
||||||
}),
|
|
||||||
'original_device_class': None,
|
|
||||||
'original_icon': None,
|
|
||||||
'original_name': 'Remote engine start',
|
|
||||||
'platform': 'renault',
|
|
||||||
'previous_unique_id': None,
|
|
||||||
'supported_features': 0,
|
|
||||||
'translation_key': 'res_state',
|
|
||||||
'unique_id': 'vf1aaaaa555777999_res_state',
|
|
||||||
'unit_of_measurement': None,
|
|
||||||
}),
|
|
||||||
EntityRegistryEntrySnapshot({
|
|
||||||
'aliases': set({
|
|
||||||
}),
|
|
||||||
'area_id': None,
|
|
||||||
'capabilities': None,
|
|
||||||
'config_entry_id': <ANY>,
|
|
||||||
'config_subentry_id': <ANY>,
|
|
||||||
'device_class': None,
|
|
||||||
'device_id': <ANY>,
|
|
||||||
'disabled_by': <RegistryEntryDisabler.INTEGRATION: 'integration'>,
|
|
||||||
'domain': 'sensor',
|
|
||||||
'entity_category': None,
|
|
||||||
'entity_id': 'sensor.reg_number_remote_engine_start_code',
|
|
||||||
'has_entity_name': True,
|
|
||||||
'hidden_by': None,
|
|
||||||
'icon': None,
|
|
||||||
'id': <ANY>,
|
|
||||||
'labels': set({
|
|
||||||
}),
|
|
||||||
'name': None,
|
|
||||||
'options': dict({
|
|
||||||
}),
|
|
||||||
'original_device_class': None,
|
|
||||||
'original_icon': None,
|
|
||||||
'original_name': 'Remote engine start code',
|
|
||||||
'platform': 'renault',
|
|
||||||
'previous_unique_id': None,
|
|
||||||
'supported_features': 0,
|
|
||||||
'translation_key': 'res_state_code',
|
|
||||||
'unique_id': 'vf1aaaaa555777999_res_state_code',
|
|
||||||
'unit_of_measurement': None,
|
|
||||||
}),
|
|
||||||
])
|
])
|
||||||
# ---
|
# ---
|
||||||
# name: test_sensors[zoe_40].2
|
# name: test_sensors[zoe_40].2
|
||||||
@ -4506,28 +4356,6 @@
|
|||||||
'last_updated': <ANY>,
|
'last_updated': <ANY>,
|
||||||
'state': 'unknown',
|
'state': 'unknown',
|
||||||
}),
|
}),
|
||||||
StateSnapshot({
|
|
||||||
'attributes': ReadOnlyDict({
|
|
||||||
'friendly_name': 'REG-NUMBER Remote engine start',
|
|
||||||
}),
|
|
||||||
'context': <ANY>,
|
|
||||||
'entity_id': 'sensor.reg_number_remote_engine_start',
|
|
||||||
'last_changed': <ANY>,
|
|
||||||
'last_reported': <ANY>,
|
|
||||||
'last_updated': <ANY>,
|
|
||||||
'state': 'unknown',
|
|
||||||
}),
|
|
||||||
StateSnapshot({
|
|
||||||
'attributes': ReadOnlyDict({
|
|
||||||
'friendly_name': 'REG-NUMBER Remote engine start code',
|
|
||||||
}),
|
|
||||||
'context': <ANY>,
|
|
||||||
'entity_id': 'sensor.reg_number_remote_engine_start_code',
|
|
||||||
'last_changed': <ANY>,
|
|
||||||
'last_reported': <ANY>,
|
|
||||||
'last_updated': <ANY>,
|
|
||||||
'state': 'unknown',
|
|
||||||
}),
|
|
||||||
])
|
])
|
||||||
# ---
|
# ---
|
||||||
# name: test_sensors[zoe_50]
|
# name: test_sensors[zoe_50]
|
||||||
|
@ -253,9 +253,9 @@ async def test_sensor_throttling_after_init(
|
|||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
("vehicle_type", "vehicle_count", "scan_interval"),
|
("vehicle_type", "vehicle_count", "scan_interval"),
|
||||||
[
|
[
|
||||||
("zoe_40", 1, 300), # 5 coordinators => 5 minutes interval
|
("zoe_50", 1, 420), # 7 coordinators => 7 minutes interval
|
||||||
("captur_fuel", 1, 240), # 4 coordinators => 4 minutes interval
|
("captur_fuel", 1, 240), # 4 coordinators => 4 minutes interval
|
||||||
("multi", 2, 540), # 9 coordinators => 9 minutes interval
|
("multi", 2, 480), # 8 coordinators => 8 minutes interval
|
||||||
],
|
],
|
||||||
indirect=["vehicle_type"],
|
indirect=["vehicle_type"],
|
||||||
)
|
)
|
||||||
@ -292,9 +292,9 @@ async def test_dynamic_scan_interval(
|
|||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
("vehicle_type", "vehicle_count", "scan_interval"),
|
("vehicle_type", "vehicle_count", "scan_interval"),
|
||||||
[
|
[
|
||||||
("zoe_40", 1, 240), # (5-1) coordinators => 4 minutes interval
|
("zoe_50", 1, 300), # (7-2) coordinators => 5 minutes interval
|
||||||
("captur_fuel", 1, 180), # (4-1) coordinators => 3 minutes interval
|
("captur_fuel", 1, 180), # (4-1) coordinators => 3 minutes interval
|
||||||
("multi", 2, 420), # (9-2) coordinators => 7 minutes interval
|
("multi", 2, 360), # (8-2) coordinators => 6 minutes interval
|
||||||
],
|
],
|
||||||
indirect=["vehicle_type"],
|
indirect=["vehicle_type"],
|
||||||
)
|
)
|
||||||
|
@ -159,11 +159,12 @@ async def test_service_set_charge_schedule(
|
|||||||
}
|
}
|
||||||
|
|
||||||
with (
|
with (
|
||||||
|
patch("renault_api.renault_vehicle.RenaultVehicle.get_full_endpoint"),
|
||||||
patch(
|
patch(
|
||||||
"renault_api.renault_vehicle.RenaultVehicle.get_charging_settings",
|
"renault_api.renault_vehicle.RenaultVehicle.http_get",
|
||||||
return_value=schemas.KamereonVehicleDataResponseSchema.loads(
|
return_value=schemas.KamereonResponseSchema.loads(
|
||||||
load_fixture("renault/charging_settings.json")
|
load_fixture("renault/charging_settings.json")
|
||||||
).get_attributes(schemas.KamereonVehicleChargingSettingsDataSchema),
|
),
|
||||||
),
|
),
|
||||||
patch(
|
patch(
|
||||||
"renault_api.renault_vehicle.RenaultVehicle.set_charge_schedules",
|
"renault_api.renault_vehicle.RenaultVehicle.set_charge_schedules",
|
||||||
@ -208,11 +209,12 @@ async def test_service_set_charge_schedule_multi(
|
|||||||
}
|
}
|
||||||
|
|
||||||
with (
|
with (
|
||||||
|
patch("renault_api.renault_vehicle.RenaultVehicle.get_full_endpoint"),
|
||||||
patch(
|
patch(
|
||||||
"renault_api.renault_vehicle.RenaultVehicle.get_charging_settings",
|
"renault_api.renault_vehicle.RenaultVehicle.http_get",
|
||||||
return_value=schemas.KamereonVehicleDataResponseSchema.loads(
|
return_value=schemas.KamereonResponseSchema.loads(
|
||||||
load_fixture("renault/charging_settings.json")
|
load_fixture("renault/charging_settings.json")
|
||||||
).get_attributes(schemas.KamereonVehicleChargingSettingsDataSchema),
|
),
|
||||||
),
|
),
|
||||||
patch(
|
patch(
|
||||||
"renault_api.renault_vehicle.RenaultVehicle.set_charge_schedules",
|
"renault_api.renault_vehicle.RenaultVehicle.set_charge_schedules",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user