Fix issue clearing renault schedules (#105719)
* Fix issue clearing renault schedules * Adjust
This commit is contained in:
parent
9095027363
commit
351b07b14d
5 changed files with 27 additions and 17 deletions
|
@ -8,5 +8,5 @@
|
||||||
"iot_class": "cloud_polling",
|
"iot_class": "cloud_polling",
|
||||||
"loggers": ["renault_api"],
|
"loggers": ["renault_api"],
|
||||||
"quality_scale": "platinum",
|
"quality_scale": "platinum",
|
||||||
"requirements": ["renault-api==0.2.0"]
|
"requirements": ["renault-api==0.2.1"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,13 +43,15 @@ SERVICE_CHARGE_SET_SCHEDULE_SCHEMA = vol.Schema(
|
||||||
{
|
{
|
||||||
vol.Required("id"): cv.positive_int,
|
vol.Required("id"): cv.positive_int,
|
||||||
vol.Optional("activated"): cv.boolean,
|
vol.Optional("activated"): cv.boolean,
|
||||||
vol.Optional("monday"): vol.Schema(SERVICE_CHARGE_SET_SCHEDULE_DAY_SCHEMA),
|
vol.Optional("monday"): vol.Any(None, SERVICE_CHARGE_SET_SCHEDULE_DAY_SCHEMA),
|
||||||
vol.Optional("tuesday"): vol.Schema(SERVICE_CHARGE_SET_SCHEDULE_DAY_SCHEMA),
|
vol.Optional("tuesday"): vol.Any(None, SERVICE_CHARGE_SET_SCHEDULE_DAY_SCHEMA),
|
||||||
vol.Optional("wednesday"): vol.Schema(SERVICE_CHARGE_SET_SCHEDULE_DAY_SCHEMA),
|
vol.Optional("wednesday"): vol.Any(
|
||||||
vol.Optional("thursday"): vol.Schema(SERVICE_CHARGE_SET_SCHEDULE_DAY_SCHEMA),
|
None, SERVICE_CHARGE_SET_SCHEDULE_DAY_SCHEMA
|
||||||
vol.Optional("friday"): vol.Schema(SERVICE_CHARGE_SET_SCHEDULE_DAY_SCHEMA),
|
),
|
||||||
vol.Optional("saturday"): vol.Schema(SERVICE_CHARGE_SET_SCHEDULE_DAY_SCHEMA),
|
vol.Optional("thursday"): vol.Any(None, SERVICE_CHARGE_SET_SCHEDULE_DAY_SCHEMA),
|
||||||
vol.Optional("sunday"): vol.Schema(SERVICE_CHARGE_SET_SCHEDULE_DAY_SCHEMA),
|
vol.Optional("friday"): vol.Any(None, SERVICE_CHARGE_SET_SCHEDULE_DAY_SCHEMA),
|
||||||
|
vol.Optional("saturday"): vol.Any(None, SERVICE_CHARGE_SET_SCHEDULE_DAY_SCHEMA),
|
||||||
|
vol.Optional("sunday"): vol.Any(None, SERVICE_CHARGE_SET_SCHEDULE_DAY_SCHEMA),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
SERVICE_CHARGE_SET_SCHEDULES_SCHEMA = SERVICE_VEHICLE_SCHEMA.extend(
|
SERVICE_CHARGE_SET_SCHEDULES_SCHEMA = SERVICE_VEHICLE_SCHEMA.extend(
|
||||||
|
|
|
@ -2348,7 +2348,7 @@ raspyrfm-client==1.2.8
|
||||||
regenmaschine==2023.06.0
|
regenmaschine==2023.06.0
|
||||||
|
|
||||||
# homeassistant.components.renault
|
# homeassistant.components.renault
|
||||||
renault-api==0.2.0
|
renault-api==0.2.1
|
||||||
|
|
||||||
# homeassistant.components.renson
|
# homeassistant.components.renson
|
||||||
renson-endura-delta==1.7.1
|
renson-endura-delta==1.7.1
|
||||||
|
|
|
@ -1763,7 +1763,7 @@ rapt-ble==0.1.2
|
||||||
regenmaschine==2023.06.0
|
regenmaschine==2023.06.0
|
||||||
|
|
||||||
# homeassistant.components.renault
|
# homeassistant.components.renault
|
||||||
renault-api==0.2.0
|
renault-api==0.2.1
|
||||||
|
|
||||||
# homeassistant.components.renson
|
# homeassistant.components.renson
|
||||||
renson-endura-delta==1.7.1
|
renson-endura-delta==1.7.1
|
||||||
|
|
|
@ -203,13 +203,12 @@ async def test_service_set_charge_schedule_multi(
|
||||||
{
|
{
|
||||||
"id": 2,
|
"id": 2,
|
||||||
"activated": True,
|
"activated": True,
|
||||||
"monday": {"startTime": "T12:00Z", "duration": 15},
|
"monday": {"startTime": "T12:00Z", "duration": 30},
|
||||||
"tuesday": {"startTime": "T12:00Z", "duration": 15},
|
"tuesday": {"startTime": "T12:00Z", "duration": 30},
|
||||||
"wednesday": {"startTime": "T12:00Z", "duration": 15},
|
"wednesday": None,
|
||||||
"thursday": {"startTime": "T12:00Z", "duration": 15},
|
"friday": {"startTime": "T12:00Z", "duration": 30},
|
||||||
"friday": {"startTime": "T12:00Z", "duration": 15},
|
"saturday": {"startTime": "T12:00Z", "duration": 30},
|
||||||
"saturday": {"startTime": "T12:00Z", "duration": 15},
|
"sunday": {"startTime": "T12:00Z", "duration": 30},
|
||||||
"sunday": {"startTime": "T12:00Z", "duration": 15},
|
|
||||||
},
|
},
|
||||||
{"id": 3},
|
{"id": 3},
|
||||||
]
|
]
|
||||||
|
@ -238,6 +237,15 @@ async def test_service_set_charge_schedule_multi(
|
||||||
mock_call_data: list[ChargeSchedule] = mock_action.mock_calls[0][1][0]
|
mock_call_data: list[ChargeSchedule] = mock_action.mock_calls[0][1][0]
|
||||||
assert mock_action.mock_calls[0][1] == (mock_call_data,)
|
assert mock_action.mock_calls[0][1] == (mock_call_data,)
|
||||||
|
|
||||||
|
# Monday updated with new values
|
||||||
|
assert mock_call_data[1].monday.startTime == "T12:00Z"
|
||||||
|
assert mock_call_data[1].monday.duration == 30
|
||||||
|
# Wednesday has original values cleared
|
||||||
|
assert mock_call_data[1].wednesday is None
|
||||||
|
# Thursday keeps original values
|
||||||
|
assert mock_call_data[1].thursday.startTime == "T23:30Z"
|
||||||
|
assert mock_call_data[1].thursday.duration == 15
|
||||||
|
|
||||||
|
|
||||||
async def test_service_invalid_device_id(
|
async def test_service_invalid_device_id(
|
||||||
hass: HomeAssistant, config_entry: ConfigEntry
|
hass: HomeAssistant, config_entry: ConfigEntry
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue