Skip to content

Commit

Permalink
Add ChargingMode.NO_ACTION (#634)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: sshaikh <sshaikh@users.noreply.github.com>
  • Loading branch information
rikroe and sshaikh authored Jul 14, 2024
1 parent 034fc35 commit 2e3eb11
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bimmer_connected/tests/test_remote_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ async def test_set_charging_settings(bmw_fixture: respx.Router):


@pytest.mark.asyncio
async def test_set_charging_profile(bmw_fixture: respx.Router):
async def test_set_charging_profile(bmw_fixture: respx.Router, monkeypatch: pytest.MonkeyPatch):
"""Test setting the charging profile on a car."""

account = await prepare_account_with_vehicles()
Expand Down Expand Up @@ -238,6 +238,11 @@ async def test_set_charging_profile(bmw_fixture: respx.Router):
await vehicle.remote_services.trigger_charging_profile_update(precondition_climate=True)
assert vehicle.charging_profile.is_pre_entry_climatization_enabled is True

# test with an unknown charging mode
monkeypatch.setattr(vehicle.charging_profile, "charging_mode", ChargingMode.UNKNOWN)
await vehicle.remote_services.trigger_charging_profile_update(charging_mode=ChargingMode.IMMEDIATE_CHARGING)
assert vehicle.charging_profile.charging_mode == ChargingMode.IMMEDIATE_CHARGING


@pytest.mark.asyncio
async def test_vehicles_without_enabled_services(bmw_fixture: respx.Router):
Expand Down
3 changes: 3 additions & 0 deletions bimmer_connected/vehicle/charging_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@ class ChargingMode(StrEnum):

IMMEDIATE_CHARGING = "IMMEDIATE_CHARGING"
DELAYED_CHARGING = "DELAYED_CHARGING"
NO_ACTION = "NO_ACTION"
UNKNOWN = "UNKNOWN"


MAP_CHARGING_MODE_TO_REMOTE_SERVICE = {
ChargingMode.IMMEDIATE_CHARGING: "CHARGING_IMMEDIATELY",
ChargingMode.DELAYED_CHARGING: "TIME_SLOT",
ChargingMode.NO_ACTION: "NO_ACTION",
ChargingMode.UNKNOWN: "NO_ACTION",
}


Expand Down

0 comments on commit 2e3eb11

Please sign in to comment.