mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 09:17:10 +00:00
Update manual ACP tests to async (#18289)
This commit is contained in:
parent
0d7cb54872
commit
ce069be16e
@ -13,9 +13,10 @@ from homeassistant.const import (
|
|||||||
CONF_PENDING_TIME, CONF_TRIGGER_TIME)
|
CONF_PENDING_TIME, CONF_TRIGGER_TIME)
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
async def async_setup_platform(hass, config, async_add_entities,
|
||||||
|
discovery_info=None):
|
||||||
"""Set up the Demo alarm control panel platform."""
|
"""Set up the Demo alarm control panel platform."""
|
||||||
add_entities([
|
async_add_entities([
|
||||||
manual.ManualAlarm(hass, 'Alarm', '1234', None, False, {
|
manual.ManualAlarm(hass, 'Alarm', '1234', None, False, {
|
||||||
STATE_ALARM_ARMED_AWAY: {
|
STATE_ALARM_ARMED_AWAY: {
|
||||||
CONF_DELAY_TIME: datetime.timedelta(seconds=0),
|
CONF_DELAY_TIME: datetime.timedelta(seconds=0),
|
||||||
|
@ -9,6 +9,21 @@ from homeassistant.const import (
|
|||||||
SERVICE_ALARM_DISARM, SERVICE_ALARM_ARM_HOME, SERVICE_ALARM_ARM_AWAY,
|
SERVICE_ALARM_DISARM, SERVICE_ALARM_ARM_HOME, SERVICE_ALARM_ARM_AWAY,
|
||||||
SERVICE_ALARM_ARM_NIGHT, SERVICE_ALARM_ARM_CUSTOM_BYPASS)
|
SERVICE_ALARM_ARM_NIGHT, SERVICE_ALARM_ARM_CUSTOM_BYPASS)
|
||||||
from homeassistant.loader import bind_hass
|
from homeassistant.loader import bind_hass
|
||||||
|
from homeassistant.core import callback
|
||||||
|
|
||||||
|
|
||||||
|
@callback
|
||||||
|
@bind_hass
|
||||||
|
def async_alarm_disarm(hass, code=None, entity_id=None):
|
||||||
|
"""Send the alarm the command for disarm."""
|
||||||
|
data = {}
|
||||||
|
if code:
|
||||||
|
data[ATTR_CODE] = code
|
||||||
|
if entity_id:
|
||||||
|
data[ATTR_ENTITY_ID] = entity_id
|
||||||
|
|
||||||
|
hass.async_create_task(
|
||||||
|
hass.services.async_call(DOMAIN, SERVICE_ALARM_DISARM, data))
|
||||||
|
|
||||||
|
|
||||||
@bind_hass
|
@bind_hass
|
||||||
@ -23,6 +38,20 @@ def alarm_disarm(hass, code=None, entity_id=None):
|
|||||||
hass.services.call(DOMAIN, SERVICE_ALARM_DISARM, data)
|
hass.services.call(DOMAIN, SERVICE_ALARM_DISARM, data)
|
||||||
|
|
||||||
|
|
||||||
|
@callback
|
||||||
|
@bind_hass
|
||||||
|
def async_alarm_arm_home(hass, code=None, entity_id=None):
|
||||||
|
"""Send the alarm the command for disarm."""
|
||||||
|
data = {}
|
||||||
|
if code:
|
||||||
|
data[ATTR_CODE] = code
|
||||||
|
if entity_id:
|
||||||
|
data[ATTR_ENTITY_ID] = entity_id
|
||||||
|
|
||||||
|
hass.async_create_task(
|
||||||
|
hass.services.async_call(DOMAIN, SERVICE_ALARM_ARM_HOME, data))
|
||||||
|
|
||||||
|
|
||||||
@bind_hass
|
@bind_hass
|
||||||
def alarm_arm_home(hass, code=None, entity_id=None):
|
def alarm_arm_home(hass, code=None, entity_id=None):
|
||||||
"""Send the alarm the command for arm home."""
|
"""Send the alarm the command for arm home."""
|
||||||
@ -35,6 +64,20 @@ def alarm_arm_home(hass, code=None, entity_id=None):
|
|||||||
hass.services.call(DOMAIN, SERVICE_ALARM_ARM_HOME, data)
|
hass.services.call(DOMAIN, SERVICE_ALARM_ARM_HOME, data)
|
||||||
|
|
||||||
|
|
||||||
|
@callback
|
||||||
|
@bind_hass
|
||||||
|
def async_alarm_arm_away(hass, code=None, entity_id=None):
|
||||||
|
"""Send the alarm the command for disarm."""
|
||||||
|
data = {}
|
||||||
|
if code:
|
||||||
|
data[ATTR_CODE] = code
|
||||||
|
if entity_id:
|
||||||
|
data[ATTR_ENTITY_ID] = entity_id
|
||||||
|
|
||||||
|
hass.async_create_task(
|
||||||
|
hass.services.async_call(DOMAIN, SERVICE_ALARM_ARM_AWAY, data))
|
||||||
|
|
||||||
|
|
||||||
@bind_hass
|
@bind_hass
|
||||||
def alarm_arm_away(hass, code=None, entity_id=None):
|
def alarm_arm_away(hass, code=None, entity_id=None):
|
||||||
"""Send the alarm the command for arm away."""
|
"""Send the alarm the command for arm away."""
|
||||||
@ -47,6 +90,20 @@ def alarm_arm_away(hass, code=None, entity_id=None):
|
|||||||
hass.services.call(DOMAIN, SERVICE_ALARM_ARM_AWAY, data)
|
hass.services.call(DOMAIN, SERVICE_ALARM_ARM_AWAY, data)
|
||||||
|
|
||||||
|
|
||||||
|
@callback
|
||||||
|
@bind_hass
|
||||||
|
def async_alarm_arm_night(hass, code=None, entity_id=None):
|
||||||
|
"""Send the alarm the command for disarm."""
|
||||||
|
data = {}
|
||||||
|
if code:
|
||||||
|
data[ATTR_CODE] = code
|
||||||
|
if entity_id:
|
||||||
|
data[ATTR_ENTITY_ID] = entity_id
|
||||||
|
|
||||||
|
hass.async_create_task(
|
||||||
|
hass.services.async_call(DOMAIN, SERVICE_ALARM_ARM_NIGHT, data))
|
||||||
|
|
||||||
|
|
||||||
@bind_hass
|
@bind_hass
|
||||||
def alarm_arm_night(hass, code=None, entity_id=None):
|
def alarm_arm_night(hass, code=None, entity_id=None):
|
||||||
"""Send the alarm the command for arm night."""
|
"""Send the alarm the command for arm night."""
|
||||||
@ -59,6 +116,20 @@ def alarm_arm_night(hass, code=None, entity_id=None):
|
|||||||
hass.services.call(DOMAIN, SERVICE_ALARM_ARM_NIGHT, data)
|
hass.services.call(DOMAIN, SERVICE_ALARM_ARM_NIGHT, data)
|
||||||
|
|
||||||
|
|
||||||
|
@callback
|
||||||
|
@bind_hass
|
||||||
|
def async_alarm_trigger(hass, code=None, entity_id=None):
|
||||||
|
"""Send the alarm the command for disarm."""
|
||||||
|
data = {}
|
||||||
|
if code:
|
||||||
|
data[ATTR_CODE] = code
|
||||||
|
if entity_id:
|
||||||
|
data[ATTR_ENTITY_ID] = entity_id
|
||||||
|
|
||||||
|
hass.async_create_task(
|
||||||
|
hass.services.async_call(DOMAIN, SERVICE_ALARM_TRIGGER, data))
|
||||||
|
|
||||||
|
|
||||||
@bind_hass
|
@bind_hass
|
||||||
def alarm_trigger(hass, code=None, entity_id=None):
|
def alarm_trigger(hass, code=None, entity_id=None):
|
||||||
"""Send the alarm the command for trigger."""
|
"""Send the alarm the command for trigger."""
|
||||||
@ -71,6 +142,21 @@ def alarm_trigger(hass, code=None, entity_id=None):
|
|||||||
hass.services.call(DOMAIN, SERVICE_ALARM_TRIGGER, data)
|
hass.services.call(DOMAIN, SERVICE_ALARM_TRIGGER, data)
|
||||||
|
|
||||||
|
|
||||||
|
@callback
|
||||||
|
@bind_hass
|
||||||
|
def async_alarm_arm_custom_bypass(hass, code=None, entity_id=None):
|
||||||
|
"""Send the alarm the command for disarm."""
|
||||||
|
data = {}
|
||||||
|
if code:
|
||||||
|
data[ATTR_CODE] = code
|
||||||
|
if entity_id:
|
||||||
|
data[ATTR_ENTITY_ID] = entity_id
|
||||||
|
|
||||||
|
hass.async_create_task(
|
||||||
|
hass.services.async_call(
|
||||||
|
DOMAIN, SERVICE_ALARM_ARM_CUSTOM_BYPASS, data))
|
||||||
|
|
||||||
|
|
||||||
@bind_hass
|
@bind_hass
|
||||||
def alarm_arm_custom_bypass(hass, code=None, entity_id=None):
|
def alarm_arm_custom_bypass(hass, code=None, entity_id=None):
|
||||||
"""Send the alarm the command for arm custom bypass."""
|
"""Send the alarm the command for arm custom bypass."""
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user