Add code_arm_required to manual alarm (#22618)
* Add code_arm_required to manual alarm * Add fix for alarm front end more-info-alarm_control_panel
This commit is contained in:
1 parent
f722a6c08d
commit
1460f7bd80
3 files changed
+119
-6
No files matched your search
@@ -48,6 +48,31 @@ async def test_arm_home_no_pending(hass):
|
||||
hass.states.get(entity_id).state
|
||||
|
||||
|
||||
async def test_arm_home_no_pending_when_code_not_req(hass):
|
||||
"""Test arm home method."""
|
||||
assert await async_setup_component(
|
||||
hass, alarm_control_panel.DOMAIN,
|
||||
{'alarm_control_panel': {
|
||||
'platform': 'manual',
|
||||
'name': 'test',
|
||||
'code': CODE,
|
||||
'code_arm_required': False,
|
||||
'pending_time': 0,
|
||||
'disarm_after_trigger': False
|
||||
}})
|
||||
|
||||
entity_id = 'alarm_control_panel.test'
|
||||
|
||||
assert STATE_ALARM_DISARMED == \
|
||||
hass.states.get(entity_id).state
|
||||
|
||||
common.async_alarm_arm_home(hass, 0)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert STATE_ALARM_ARMED_HOME == \
|
||||
hass.states.get(entity_id).state
|
||||
|
||||
|
||||
async def test_arm_home_with_pending(hass):
|
||||
"""Test arm home method."""
|
||||
assert await async_setup_component(
|
||||
@@ -129,6 +154,31 @@ async def test_arm_away_no_pending(hass):
|
||||
hass.states.get(entity_id).state
|
||||
|
||||
|
||||
async def test_arm_away_no_pending_when_code_not_req(hass):
|
||||
"""Test arm home method."""
|
||||
assert await async_setup_component(
|
||||
hass, alarm_control_panel.DOMAIN,
|
||||
{'alarm_control_panel': {
|
||||
'platform': 'manual',
|
||||
'name': 'test',
|
||||
'code': CODE,
|
||||
'code_arm_required': False,
|
||||
'pending_time': 0,
|
||||
'disarm_after_trigger': False
|
||||
}})
|
||||
|
||||
entity_id = 'alarm_control_panel.test'
|
||||
|
||||
assert STATE_ALARM_DISARMED == \
|
||||
hass.states.get(entity_id).state
|
||||
|
||||
common.async_alarm_arm_away(hass, 0, entity_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert STATE_ALARM_ARMED_AWAY == \
|
||||
hass.states.get(entity_id).state
|
||||
|
||||
|
||||
async def test_arm_home_with_template_code(hass):
|
||||
"""Attempt to arm with a template-based code."""
|
||||
assert await async_setup_component(
|
||||
@@ -233,6 +283,31 @@ async def test_arm_night_no_pending(hass):
|
||||
hass.states.get(entity_id).state
|
||||
|
||||
|
||||
async def test_arm_night_no_pending_when_code_not_req(hass):
|
||||
"""Test arm night method."""
|
||||
assert await async_setup_component(
|
||||
hass, alarm_control_panel.DOMAIN,
|
||||
{'alarm_control_panel': {
|
||||
'platform': 'manual',
|
||||
'name': 'test',
|
||||
'code': CODE,
|
||||
'code_arm_required': False,
|
||||
'pending_time': 0,
|
||||
'disarm_after_trigger': False
|
||||
}})
|
||||
|
||||
entity_id = 'alarm_control_panel.test'
|
||||
|
||||
assert STATE_ALARM_DISARMED == \
|
||||
hass.states.get(entity_id).state
|
||||
|
||||
common.async_alarm_arm_night(hass, 0)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert STATE_ALARM_ARMED_NIGHT == \
|
||||
hass.states.get(entity_id).state
|
||||
|
||||
|
||||
async def test_arm_night_with_pending(hass):
|
||||
"""Test arm night method."""
|
||||
assert await async_setup_component(
|
||||
@@ -1128,6 +1203,31 @@ async def test_arm_custom_bypass_no_pending(hass):
|
||||
hass.states.get(entity_id).state
|
||||
|
||||
|
||||
async def test_arm_custom_bypass_no_pending_when_code_not_req(hass):
|
||||
"""Test arm custom bypass method."""
|
||||
assert await async_setup_component(
|
||||
hass, alarm_control_panel.DOMAIN,
|
||||
{'alarm_control_panel': {
|
||||
'platform': 'manual',
|
||||
'name': 'test',
|
||||
'code': CODE,
|
||||
'code_arm_required': False,
|
||||
'pending_time': 0,
|
||||
'disarm_after_trigger': False
|
||||
}})
|
||||
|
||||
entity_id = 'alarm_control_panel.test'
|
||||
|
||||
assert STATE_ALARM_DISARMED == \
|
||||
hass.states.get(entity_id).state
|
||||
|
||||
common.async_alarm_arm_custom_bypass(hass, 0)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert STATE_ALARM_ARMED_CUSTOM_BYPASS == \
|
||||
hass.states.get(entity_id).state
|
||||
|
||||
|
||||
async def test_arm_custom_bypass_with_pending(hass):
|
||||
"""Test arm custom bypass method."""
|
||||
assert await async_setup_component(
|
||||
|
||||
Reference in new issue
Block a user