Skip to content

Commit 85a1afb

Browse files
authored
Add lock reduced guard button to Volvo integration (home-assistant#157004)
1 parent 9668a68 commit 85a1afb

File tree

5 files changed

+227
-3
lines changed

5 files changed

+227
-3
lines changed

homeassistant/components/volvo/button.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ class VolvoButtonDescription(VolvoEntityDescription, ButtonEntityDescription):
6464
api_command="honk-flash",
6565
required_command_key="HONK_AND_FLASH",
6666
),
67+
VolvoButtonDescription(
68+
key="lock_reduced_guard",
69+
api_command="lock-reduced-guard",
70+
required_command_key="LOCK_REDUCED_GUARD",
71+
),
6772
)
6873

6974

homeassistant/components/volvo/icons.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,9 @@
281281
},
282282
"honk_flash": {
283283
"default": "mdi:alarm-light"
284+
},
285+
"lock_reduced_guard": {
286+
"default": "mdi:lock-minus"
284287
}
285288
},
286289
"device_tracker": {

homeassistant/components/volvo/strings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,9 @@
208208
},
209209
"honk_flash": {
210210
"name": "Honk & flash"
211+
},
212+
"lock_reduced_guard": {
213+
"name": "Lock reduced guard"
211214
}
212215
},
213216
"device_tracker": {

tests/components/volvo/snapshots/test_button.ambr

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,54 @@
143143
'state': 'unknown',
144144
})
145145
# ---
146+
# name: test_button[ex30_2024][button.volvo_ex30_lock_reduced_guard-entry]
147+
EntityRegistryEntrySnapshot({
148+
'aliases': set({
149+
}),
150+
'area_id': None,
151+
'capabilities': None,
152+
'config_entry_id': <ANY>,
153+
'config_subentry_id': <ANY>,
154+
'device_class': None,
155+
'device_id': <ANY>,
156+
'disabled_by': None,
157+
'domain': 'button',
158+
'entity_category': None,
159+
'entity_id': 'button.volvo_ex30_lock_reduced_guard',
160+
'has_entity_name': True,
161+
'hidden_by': None,
162+
'icon': None,
163+
'id': <ANY>,
164+
'labels': set({
165+
}),
166+
'name': None,
167+
'options': dict({
168+
}),
169+
'original_device_class': None,
170+
'original_icon': None,
171+
'original_name': 'Lock reduced guard',
172+
'platform': 'volvo',
173+
'previous_unique_id': None,
174+
'suggested_object_id': None,
175+
'supported_features': 0,
176+
'translation_key': 'lock_reduced_guard',
177+
'unique_id': 'yv1abcdefg1234567_lock_reduced_guard',
178+
'unit_of_measurement': None,
179+
})
180+
# ---
181+
# name: test_button[ex30_2024][button.volvo_ex30_lock_reduced_guard-state]
182+
StateSnapshot({
183+
'attributes': ReadOnlyDict({
184+
'friendly_name': 'Volvo EX30 Lock reduced guard',
185+
}),
186+
'context': <ANY>,
187+
'entity_id': 'button.volvo_ex30_lock_reduced_guard',
188+
'last_changed': <ANY>,
189+
'last_reported': <ANY>,
190+
'last_updated': <ANY>,
191+
'state': 'unknown',
192+
})
193+
# ---
146194
# name: test_button[ex30_2024][button.volvo_ex30_start_climatization-entry]
147195
EntityRegistryEntrySnapshot({
148196
'aliases': set({
@@ -383,6 +431,54 @@
383431
'state': 'unknown',
384432
})
385433
# ---
434+
# name: test_button[s90_diesel_2018][button.volvo_s90_lock_reduced_guard-entry]
435+
EntityRegistryEntrySnapshot({
436+
'aliases': set({
437+
}),
438+
'area_id': None,
439+
'capabilities': None,
440+
'config_entry_id': <ANY>,
441+
'config_subentry_id': <ANY>,
442+
'device_class': None,
443+
'device_id': <ANY>,
444+
'disabled_by': None,
445+
'domain': 'button',
446+
'entity_category': None,
447+
'entity_id': 'button.volvo_s90_lock_reduced_guard',
448+
'has_entity_name': True,
449+
'hidden_by': None,
450+
'icon': None,
451+
'id': <ANY>,
452+
'labels': set({
453+
}),
454+
'name': None,
455+
'options': dict({
456+
}),
457+
'original_device_class': None,
458+
'original_icon': None,
459+
'original_name': 'Lock reduced guard',
460+
'platform': 'volvo',
461+
'previous_unique_id': None,
462+
'suggested_object_id': None,
463+
'supported_features': 0,
464+
'translation_key': 'lock_reduced_guard',
465+
'unique_id': 'yv1abcdefg1234567_lock_reduced_guard',
466+
'unit_of_measurement': None,
467+
})
468+
# ---
469+
# name: test_button[s90_diesel_2018][button.volvo_s90_lock_reduced_guard-state]
470+
StateSnapshot({
471+
'attributes': ReadOnlyDict({
472+
'friendly_name': 'Volvo S90 Lock reduced guard',
473+
}),
474+
'context': <ANY>,
475+
'entity_id': 'button.volvo_s90_lock_reduced_guard',
476+
'last_changed': <ANY>,
477+
'last_reported': <ANY>,
478+
'last_updated': <ANY>,
479+
'state': 'unknown',
480+
})
481+
# ---
386482
# name: test_button[s90_diesel_2018][button.volvo_s90_start_climatization-entry]
387483
EntityRegistryEntrySnapshot({
388484
'aliases': set({
@@ -623,6 +719,54 @@
623719
'state': 'unknown',
624720
})
625721
# ---
722+
# name: test_button[xc40_electric_2024][button.volvo_xc40_lock_reduced_guard-entry]
723+
EntityRegistryEntrySnapshot({
724+
'aliases': set({
725+
}),
726+
'area_id': None,
727+
'capabilities': None,
728+
'config_entry_id': <ANY>,
729+
'config_subentry_id': <ANY>,
730+
'device_class': None,
731+
'device_id': <ANY>,
732+
'disabled_by': None,
733+
'domain': 'button',
734+
'entity_category': None,
735+
'entity_id': 'button.volvo_xc40_lock_reduced_guard',
736+
'has_entity_name': True,
737+
'hidden_by': None,
738+
'icon': None,
739+
'id': <ANY>,
740+
'labels': set({
741+
}),
742+
'name': None,
743+
'options': dict({
744+
}),
745+
'original_device_class': None,
746+
'original_icon': None,
747+
'original_name': 'Lock reduced guard',
748+
'platform': 'volvo',
749+
'previous_unique_id': None,
750+
'suggested_object_id': None,
751+
'supported_features': 0,
752+
'translation_key': 'lock_reduced_guard',
753+
'unique_id': 'yv1abcdefg1234567_lock_reduced_guard',
754+
'unit_of_measurement': None,
755+
})
756+
# ---
757+
# name: test_button[xc40_electric_2024][button.volvo_xc40_lock_reduced_guard-state]
758+
StateSnapshot({
759+
'attributes': ReadOnlyDict({
760+
'friendly_name': 'Volvo XC40 Lock reduced guard',
761+
}),
762+
'context': <ANY>,
763+
'entity_id': 'button.volvo_xc40_lock_reduced_guard',
764+
'last_changed': <ANY>,
765+
'last_reported': <ANY>,
766+
'last_updated': <ANY>,
767+
'state': 'unknown',
768+
})
769+
# ---
626770
# name: test_button[xc40_electric_2024][button.volvo_xc40_start_climatization-entry]
627771
EntityRegistryEntrySnapshot({
628772
'aliases': set({
@@ -863,6 +1007,54 @@
8631007
'state': 'unknown',
8641008
})
8651009
# ---
1010+
# name: test_button[xc90_petrol_2019][button.volvo_xc90_lock_reduced_guard-entry]
1011+
EntityRegistryEntrySnapshot({
1012+
'aliases': set({
1013+
}),
1014+
'area_id': None,
1015+
'capabilities': None,
1016+
'config_entry_id': <ANY>,
1017+
'config_subentry_id': <ANY>,
1018+
'device_class': None,
1019+
'device_id': <ANY>,
1020+
'disabled_by': None,
1021+
'domain': 'button',
1022+
'entity_category': None,
1023+
'entity_id': 'button.volvo_xc90_lock_reduced_guard',
1024+
'has_entity_name': True,
1025+
'hidden_by': None,
1026+
'icon': None,
1027+
'id': <ANY>,
1028+
'labels': set({
1029+
}),
1030+
'name': None,
1031+
'options': dict({
1032+
}),
1033+
'original_device_class': None,
1034+
'original_icon': None,
1035+
'original_name': 'Lock reduced guard',
1036+
'platform': 'volvo',
1037+
'previous_unique_id': None,
1038+
'suggested_object_id': None,
1039+
'supported_features': 0,
1040+
'translation_key': 'lock_reduced_guard',
1041+
'unique_id': 'yv1abcdefg1234567_lock_reduced_guard',
1042+
'unit_of_measurement': None,
1043+
})
1044+
# ---
1045+
# name: test_button[xc90_petrol_2019][button.volvo_xc90_lock_reduced_guard-state]
1046+
StateSnapshot({
1047+
'attributes': ReadOnlyDict({
1048+
'friendly_name': 'Volvo XC90 Lock reduced guard',
1049+
}),
1050+
'context': <ANY>,
1051+
'entity_id': 'button.volvo_xc90_lock_reduced_guard',
1052+
'last_changed': <ANY>,
1053+
'last_reported': <ANY>,
1054+
'last_updated': <ANY>,
1055+
'state': 'unknown',
1056+
})
1057+
# ---
8661058
# name: test_button[xc90_petrol_2019][button.volvo_xc90_start_climatization-entry]
8671059
EntityRegistryEntrySnapshot({
8681060
'aliases': set({

tests/components/volvo/test_button.py

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,14 @@ async def test_button(
4343
@pytest.mark.usefixtures("full_model")
4444
@pytest.mark.parametrize(
4545
"command",
46-
["start_climatization", "stop_climatization", "flash", "honk", "honk_flash"],
46+
[
47+
"start_climatization",
48+
"stop_climatization",
49+
"flash",
50+
"honk",
51+
"honk_flash",
52+
"lock_reduced_guard",
53+
],
4754
)
4855
async def test_button_press(
4956
hass: HomeAssistant,
@@ -72,7 +79,14 @@ async def test_button_press(
7279
@pytest.mark.usefixtures("full_model")
7380
@pytest.mark.parametrize(
7481
"command",
75-
["start_climatization", "stop_climatization", "flash", "honk", "honk_flash"],
82+
[
83+
"start_climatization",
84+
"stop_climatization",
85+
"flash",
86+
"honk",
87+
"honk_flash",
88+
"lock_reduced_guard",
89+
],
7690
)
7791
async def test_button_press_error(
7892
hass: HomeAssistant,
@@ -99,7 +113,14 @@ async def test_button_press_error(
99113
@pytest.mark.usefixtures("full_model")
100114
@pytest.mark.parametrize(
101115
"command",
102-
["start_climatization", "stop_climatization", "flash", "honk", "honk_flash"],
116+
[
117+
"start_climatization",
118+
"stop_climatization",
119+
"flash",
120+
"honk",
121+
"honk_flash",
122+
"lock_reduced_guard",
123+
],
103124
)
104125
async def test_button_press_failure(
105126
hass: HomeAssistant,

0 commit comments

Comments
 (0)