Skip to content

Commit

Permalink
Merge 4bceea2 into 8be50b3
Browse files Browse the repository at this point in the history
  • Loading branch information
rikroe committed Oct 18, 2021
2 parents 8be50b3 + 4bceea2 commit aedb09f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 23 deletions.
6 changes: 2 additions & 4 deletions bimmer_connected/vehicle_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,10 +377,8 @@ def fuel_percent(self) -> int:
@backend_parameter
def check_control_messages(self) -> List[CheckControlMessage]:
"""List of check control messages."""
# TO DO change this in HA binary_sensor.py first
# messages = self._state.attributes[SERVICE_STATUS]['STATUS'].get('checkControlMessages', [])
# return [CheckControlMessage(m) for m in messages]
return self._state.attributes[SERVICE_STATUS].get('checkControlMessages', [])
messages = self._state.attributes[SERVICE_STATUS].get('checkControlMessages', [])
return [CheckControlMessage(m) for m in messages]

@property
@backend_parameter
Expand Down
4 changes: 3 additions & 1 deletion pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
max-line-length=120

[MESSAGES CONTROL]
disable=R0801
disable=
duplicate-code,
consider-using-f-string,
14 changes: 0 additions & 14 deletions test/test_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,17 +238,3 @@ def test_check_control_messages(self):
self.assertTrue(vehicle.state.has_check_control_messages)
else:
self.assertFalse(vehicle.state.has_check_control_messages)

def test_ccm_f48(self):
"""Test parsing of a check control message."""
account = unittest.mock.MagicMock(ConnectedDriveAccount)
state = VehicleState(account, None)
state._attributes[SERVICE_STATUS] = F48_TEST_DATA['vehicleStatus']

ccms = state.vehicle_status.check_control_messages
self.assertEqual(1, len(ccms))
ccm = ccms[0]
self.assertEqual(955, ccm["ccmId"])
self.assertEqual(41544, ccm["ccmMileage"])
self.assertIn("Tyre pressure", ccm["ccmDescriptionShort"])
self.assertIn("continue driving", ccm["ccmDescriptionLong"])
9 changes: 5 additions & 4 deletions test/test_vehicle_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,10 @@ def test_ccm_f48(self):
state._attributes[SERVICE_STATUS] = F48_TEST_DATA['vehicleStatus']

ccms = state.vehicle_status.check_control_messages

self.assertEqual(1, len(ccms))
ccm = ccms[0]
self.assertEqual(955, ccm["ccmId"])
self.assertEqual(41544, ccm["ccmMileage"])
self.assertIn("Tyre pressure", ccm["ccmDescriptionShort"])
self.assertIn("continue driving", ccm["ccmDescriptionLong"])
self.assertEqual(955, ccm.ccm_id)
self.assertEqual(41544, ccm.mileage)
self.assertIn("Tyre pressure", ccm.description_short)
self.assertIn("continue driving", ccm.description_long)

0 comments on commit aedb09f

Please sign in to comment.