Skip to content

Commit 280c25c

Browse files
authored
Enable volvo engine status for all engine types (#158437)
1 parent 4064b6d commit 280c25c

File tree

3 files changed

+106
-4
lines changed

3 files changed

+106
-4
lines changed

homeassistant/components/volvo/coordinator.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,9 @@ def __init__(
297297
async def _async_determine_api_calls(
298298
self,
299299
) -> list[Callable[[], Coroutine[Any, Any, Any]]]:
300-
api_calls: list[Any] = []
301300
api = self.context.api
302301
vehicle = self.context.vehicle
302+
api_calls: list[Any] = [api.async_get_engine_status]
303303

304304
if vehicle.has_battery_engine():
305305
capabilities = await api.async_get_energy_capabilities()
@@ -317,9 +317,6 @@ def _normalize_key(key: str) -> str:
317317

318318
api_calls.append(self._async_get_energy_state)
319319

320-
if vehicle.has_combustion_engine():
321-
api_calls.append(api.async_get_engine_status)
322-
323320
return api_calls
324321

325322
async def _async_get_energy_state(

tests/components/volvo/snapshots/test_binary_sensor.ambr

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,55 @@
538538
'state': 'off',
539539
})
540540
# ---
541+
# name: test_binary_sensor[ex30_2024][binary_sensor.volvo_ex30_engine_status-entry]
542+
EntityRegistryEntrySnapshot({
543+
'aliases': set({
544+
}),
545+
'area_id': None,
546+
'capabilities': None,
547+
'config_entry_id': <ANY>,
548+
'config_subentry_id': <ANY>,
549+
'device_class': None,
550+
'device_id': <ANY>,
551+
'disabled_by': None,
552+
'domain': 'binary_sensor',
553+
'entity_category': None,
554+
'entity_id': 'binary_sensor.volvo_ex30_engine_status',
555+
'has_entity_name': True,
556+
'hidden_by': None,
557+
'icon': None,
558+
'id': <ANY>,
559+
'labels': set({
560+
}),
561+
'name': None,
562+
'options': dict({
563+
}),
564+
'original_device_class': <BinarySensorDeviceClass.RUNNING: 'running'>,
565+
'original_icon': None,
566+
'original_name': 'Engine status',
567+
'platform': 'volvo',
568+
'previous_unique_id': None,
569+
'suggested_object_id': None,
570+
'supported_features': 0,
571+
'translation_key': 'engine_status',
572+
'unique_id': 'yv1abcdefg1234567_engine_status',
573+
'unit_of_measurement': None,
574+
})
575+
# ---
576+
# name: test_binary_sensor[ex30_2024][binary_sensor.volvo_ex30_engine_status-state]
577+
StateSnapshot({
578+
'attributes': ReadOnlyDict({
579+
'device_class': 'running',
580+
'friendly_name': 'Volvo EX30 Engine status',
581+
}),
582+
'context': <ANY>,
583+
'entity_id': 'binary_sensor.volvo_ex30_engine_status',
584+
'last_changed': <ANY>,
585+
'last_reported': <ANY>,
586+
'last_updated': <ANY>,
587+
'state': 'off',
588+
})
589+
# ---
541590
# name: test_binary_sensor[ex30_2024][binary_sensor.volvo_ex30_fog_light_front-entry]
542591
EntityRegistryEntrySnapshot({
543592
'aliases': set({
@@ -4801,6 +4850,55 @@
48014850
'state': 'off',
48024851
})
48034852
# ---
4853+
# name: test_binary_sensor[xc40_electric_2024][binary_sensor.volvo_xc40_engine_status-entry]
4854+
EntityRegistryEntrySnapshot({
4855+
'aliases': set({
4856+
}),
4857+
'area_id': None,
4858+
'capabilities': None,
4859+
'config_entry_id': <ANY>,
4860+
'config_subentry_id': <ANY>,
4861+
'device_class': None,
4862+
'device_id': <ANY>,
4863+
'disabled_by': None,
4864+
'domain': 'binary_sensor',
4865+
'entity_category': None,
4866+
'entity_id': 'binary_sensor.volvo_xc40_engine_status',
4867+
'has_entity_name': True,
4868+
'hidden_by': None,
4869+
'icon': None,
4870+
'id': <ANY>,
4871+
'labels': set({
4872+
}),
4873+
'name': None,
4874+
'options': dict({
4875+
}),
4876+
'original_device_class': <BinarySensorDeviceClass.RUNNING: 'running'>,
4877+
'original_icon': None,
4878+
'original_name': 'Engine status',
4879+
'platform': 'volvo',
4880+
'previous_unique_id': None,
4881+
'suggested_object_id': None,
4882+
'supported_features': 0,
4883+
'translation_key': 'engine_status',
4884+
'unique_id': 'yv1abcdefg1234567_engine_status',
4885+
'unit_of_measurement': None,
4886+
})
4887+
# ---
4888+
# name: test_binary_sensor[xc40_electric_2024][binary_sensor.volvo_xc40_engine_status-state]
4889+
StateSnapshot({
4890+
'attributes': ReadOnlyDict({
4891+
'device_class': 'running',
4892+
'friendly_name': 'Volvo XC40 Engine status',
4893+
}),
4894+
'context': <ANY>,
4895+
'entity_id': 'binary_sensor.volvo_xc40_engine_status',
4896+
'last_changed': <ANY>,
4897+
'last_reported': <ANY>,
4898+
'last_updated': <ANY>,
4899+
'state': 'off',
4900+
})
4901+
# ---
48044902
# name: test_binary_sensor[xc40_electric_2024][binary_sensor.volvo_xc40_fog_light_front-entry]
48054903
EntityRegistryEntrySnapshot({
48064904
'aliases': set({

tests/components/volvo/snapshots/test_diagnostics.ambr

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,13 @@
167167
'unit': 'mi',
168168
'value': 150,
169169
}),
170+
'engineStatus': dict({
171+
'extra_data': dict({
172+
}),
173+
'timestamp': '2024-12-30T15:00:00+00:00',
174+
'unit': None,
175+
'value': 'STOPPED',
176+
}),
170177
'estimatedChargingTimeToTargetBatteryChargeLevel': dict({
171178
'extra_data': dict({
172179
'updated_at': '2025-07-02T08:51:23Z',

0 commit comments

Comments
 (0)