core/homeassistant/components/envisalink/alarm_control_panel.py

212 lines
6.4 KiB
Python
Raw Normal View History

"""Support for Envisalink-based alarm control panels (Honeywell/DSC)."""
import logging
Add keypress & output control services to Envisalink component (#3932) * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Moved the Alarm_Keypress service into Envisalink component out of the generic * Update envisalink.py * Update services.yaml
2016-11-18 06:13:22 +00:00
import voluptuous as vol
from homeassistant.components.alarm_control_panel import (
FORMAT_NUMBER,
AlarmControlPanel,
)
from homeassistant.components.alarm_control_panel.const import (
SUPPORT_ALARM_ARM_AWAY,
SUPPORT_ALARM_ARM_HOME,
SUPPORT_ALARM_ARM_NIGHT,
SUPPORT_ALARM_TRIGGER,
)
from homeassistant.const import (
2019-07-31 19:25:30 +00:00
ATTR_ENTITY_ID,
STATE_ALARM_ARMED_AWAY,
STATE_ALARM_ARMED_HOME,
STATE_ALARM_ARMED_NIGHT,
2019-07-31 19:25:30 +00:00
STATE_ALARM_DISARMED,
STATE_ALARM_PENDING,
STATE_ALARM_TRIGGERED,
STATE_UNKNOWN,
)
from homeassistant.core import callback
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from . import (
2019-07-31 19:25:30 +00:00
CONF_CODE,
CONF_PANIC,
CONF_PARTITIONNAME,
DATA_EVL,
DOMAIN,
2019-07-31 19:25:30 +00:00
PARTITION_SCHEMA,
SIGNAL_KEYPAD_UPDATE,
SIGNAL_PARTITION_UPDATE,
EnvisalinkDevice,
)
_LOGGER = logging.getLogger(__name__)
SERVICE_ALARM_KEYPRESS = "alarm_keypress"
2019-07-31 19:25:30 +00:00
ATTR_KEYPRESS = "keypress"
ALARM_KEYPRESS_SCHEMA = vol.Schema(
{
vol.Required(ATTR_ENTITY_ID): cv.entity_ids,
vol.Required(ATTR_KEYPRESS): cv.string,
}
)
Add keypress & output control services to Envisalink component (#3932) * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Moved the Alarm_Keypress service into Envisalink component out of the generic * Update envisalink.py * Update services.yaml
2016-11-18 06:13:22 +00:00
2019-07-31 19:25:30 +00:00
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Perform the setup for Envisalink alarm panels."""
2019-07-31 19:25:30 +00:00
configured_partitions = discovery_info["partitions"]
code = discovery_info[CONF_CODE]
panic_type = discovery_info[CONF_PANIC]
devices = []
for part_num in configured_partitions:
device_config_data = PARTITION_SCHEMA(configured_partitions[part_num])
device = EnvisalinkAlarm(
2019-07-31 19:25:30 +00:00
hass,
part_num,
device_config_data[CONF_PARTITIONNAME],
code,
panic_type,
hass.data[DATA_EVL].alarm_state["partition"][part_num],
hass.data[DATA_EVL],
)
devices.append(device)
Add keypress & output control services to Envisalink component (#3932) * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Moved the Alarm_Keypress service into Envisalink component out of the generic * Update envisalink.py * Update services.yaml
2016-11-18 06:13:22 +00:00
async_add_entities(devices)
Add keypress & output control services to Envisalink component (#3932) * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Moved the Alarm_Keypress service into Envisalink component out of the generic * Update envisalink.py * Update services.yaml
2016-11-18 06:13:22 +00:00
@callback
def alarm_keypress_handler(service):
"""Map services to methods on Alarm."""
entity_ids = service.data.get(ATTR_ENTITY_ID)
keypress = service.data.get(ATTR_KEYPRESS)
2019-07-31 19:25:30 +00:00
target_devices = [
device for device in devices if device.entity_id in entity_ids
]
Add keypress & output control services to Envisalink component (#3932) * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Moved the Alarm_Keypress service into Envisalink component out of the generic * Update envisalink.py * Update services.yaml
2016-11-18 06:13:22 +00:00
for device in target_devices:
device.async_alarm_keypress(keypress)
Add keypress & output control services to Envisalink component (#3932) * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Moved the Alarm_Keypress service into Envisalink component out of the generic * Update envisalink.py * Update services.yaml
2016-11-18 06:13:22 +00:00
hass.services.async_register(
DOMAIN,
2019-07-31 19:25:30 +00:00
SERVICE_ALARM_KEYPRESS,
alarm_keypress_handler,
schema=ALARM_KEYPRESS_SCHEMA,
)
return True
class EnvisalinkAlarm(EnvisalinkDevice, AlarmControlPanel):
"""Representation of an Envisalink-based alarm panel."""
2019-07-31 19:25:30 +00:00
def __init__(
self, hass, partition_number, alarm_name, code, panic_type, info, controller
):
"""Initialize the alarm panel."""
self._partition_number = partition_number
self._code = code
self._panic_type = panic_type
_LOGGER.debug("Setting up alarm: %s", alarm_name)
super().__init__(alarm_name, info, controller)
async def async_added_to_hass(self):
2017-03-02 09:20:57 +00:00
"""Register callbacks."""
2019-07-31 19:25:30 +00:00
async_dispatcher_connect(self.hass, SIGNAL_KEYPAD_UPDATE, self._update_callback)
async_dispatcher_connect(
2019-07-31 19:25:30 +00:00
self.hass, SIGNAL_PARTITION_UPDATE, self._update_callback
)
@callback
def _update_callback(self, partition):
"""Update Home Assistant state, if needed."""
if partition is None or int(partition) == self._partition_number:
self.async_write_ha_state()
@property
def code_format(self):
Add keypress & output control services to Envisalink component (#3932) * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Moved the Alarm_Keypress service into Envisalink component out of the generic * Update envisalink.py * Update services.yaml
2016-11-18 06:13:22 +00:00
"""Regex for code format or None if no code is required."""
if self._code:
return None
return FORMAT_NUMBER
@property
def state(self):
"""Return the state of the device."""
Add keypress & output control services to Envisalink component (#3932) * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Moved the Alarm_Keypress service into Envisalink component out of the generic * Update envisalink.py * Update services.yaml
2016-11-18 06:13:22 +00:00
state = STATE_UNKNOWN
2019-07-31 19:25:30 +00:00
if self._info["status"]["alarm"]:
Add keypress & output control services to Envisalink component (#3932) * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Moved the Alarm_Keypress service into Envisalink component out of the generic * Update envisalink.py * Update services.yaml
2016-11-18 06:13:22 +00:00
state = STATE_ALARM_TRIGGERED
elif self._info["status"]["armed_zero_entry_delay"]:
state = STATE_ALARM_ARMED_NIGHT
2019-07-31 19:25:30 +00:00
elif self._info["status"]["armed_away"]:
Add keypress & output control services to Envisalink component (#3932) * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Moved the Alarm_Keypress service into Envisalink component out of the generic * Update envisalink.py * Update services.yaml
2016-11-18 06:13:22 +00:00
state = STATE_ALARM_ARMED_AWAY
2019-07-31 19:25:30 +00:00
elif self._info["status"]["armed_stay"]:
Add keypress & output control services to Envisalink component (#3932) * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Moved the Alarm_Keypress service into Envisalink component out of the generic * Update envisalink.py * Update services.yaml
2016-11-18 06:13:22 +00:00
state = STATE_ALARM_ARMED_HOME
2019-07-31 19:25:30 +00:00
elif self._info["status"]["exit_delay"]:
Add keypress & output control services to Envisalink component (#3932) * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Moved the Alarm_Keypress service into Envisalink component out of the generic * Update envisalink.py * Update services.yaml
2016-11-18 06:13:22 +00:00
state = STATE_ALARM_PENDING
2019-07-31 19:25:30 +00:00
elif self._info["status"]["entry_delay"]:
Add keypress & output control services to Envisalink component (#3932) * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Moved the Alarm_Keypress service into Envisalink component out of the generic * Update envisalink.py * Update services.yaml
2016-11-18 06:13:22 +00:00
state = STATE_ALARM_PENDING
2019-07-31 19:25:30 +00:00
elif self._info["status"]["alpha"]:
Add keypress & output control services to Envisalink component (#3932) * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Moved the Alarm_Keypress service into Envisalink component out of the generic * Update envisalink.py * Update services.yaml
2016-11-18 06:13:22 +00:00
state = STATE_ALARM_DISARMED
return state
@property
def supported_features(self) -> int:
"""Return the list of supported features."""
return (
SUPPORT_ALARM_ARM_HOME
| SUPPORT_ALARM_ARM_AWAY
| SUPPORT_ALARM_ARM_NIGHT
| SUPPORT_ALARM_TRIGGER
)
async def async_alarm_disarm(self, code=None):
"""Send disarm command."""
Add keypress & output control services to Envisalink component (#3932) * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Moved the Alarm_Keypress service into Envisalink component out of the generic * Update envisalink.py * Update services.yaml
2016-11-18 06:13:22 +00:00
if code:
2019-07-31 19:25:30 +00:00
self.hass.data[DATA_EVL].disarm_partition(str(code), self._partition_number)
Add keypress & output control services to Envisalink component (#3932) * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Moved the Alarm_Keypress service into Envisalink component out of the generic * Update envisalink.py * Update services.yaml
2016-11-18 06:13:22 +00:00
else:
self.hass.data[DATA_EVL].disarm_partition(
2019-07-31 19:25:30 +00:00
str(self._code), self._partition_number
)
async def async_alarm_arm_home(self, code=None):
"""Send arm home command."""
Add keypress & output control services to Envisalink component (#3932) * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Moved the Alarm_Keypress service into Envisalink component out of the generic * Update envisalink.py * Update services.yaml
2016-11-18 06:13:22 +00:00
if code:
self.hass.data[DATA_EVL].arm_stay_partition(
2019-07-31 19:25:30 +00:00
str(code), self._partition_number
)
Add keypress & output control services to Envisalink component (#3932) * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Moved the Alarm_Keypress service into Envisalink component out of the generic * Update envisalink.py * Update services.yaml
2016-11-18 06:13:22 +00:00
else:
self.hass.data[DATA_EVL].arm_stay_partition(
2019-07-31 19:25:30 +00:00
str(self._code), self._partition_number
)
async def async_alarm_arm_away(self, code=None):
"""Send arm away command."""
Add keypress & output control services to Envisalink component (#3932) * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Moved the Alarm_Keypress service into Envisalink component out of the generic * Update envisalink.py * Update services.yaml
2016-11-18 06:13:22 +00:00
if code:
self.hass.data[DATA_EVL].arm_away_partition(
2019-07-31 19:25:30 +00:00
str(code), self._partition_number
)
Add keypress & output control services to Envisalink component (#3932) * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Moved the Alarm_Keypress service into Envisalink component out of the generic * Update envisalink.py * Update services.yaml
2016-11-18 06:13:22 +00:00
else:
self.hass.data[DATA_EVL].arm_away_partition(
2019-07-31 19:25:30 +00:00
str(self._code), self._partition_number
)
async def async_alarm_trigger(self, code=None):
"""Alarm trigger command. Will be used to trigger a panic alarm."""
self.hass.data[DATA_EVL].panic_alarm(self._panic_type)
Add keypress & output control services to Envisalink component (#3932) * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Moved the Alarm_Keypress service into Envisalink component out of the generic * Update envisalink.py * Update services.yaml
2016-11-18 06:13:22 +00:00
async def async_alarm_arm_night(self, code=None):
"""Send arm night command."""
self.hass.data[DATA_EVL].arm_night_partition(
str(code) if code else str(self._code), self._partition_number
)
@callback
def async_alarm_keypress(self, keypress=None):
Add keypress & output control services to Envisalink component (#3932) * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Add keypress & output control services to Envisalink component Add services to allow sending custom keypresses and activating programmable outputs on an alarm control panel. Implemented for the Envisalink alarm, and moving to new version of pyenvisalink to support this. Replicated the service handler mapping code from Cover component into Alarm Control Panel to allow handling alternative schemas if required by new services. * Update requirements_all.txt * Updated services.yaml * Removed requirement to enter code in HA UI Incorporated changes suggested by @sriram https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9 acb72f8e29123650c Including pending state for exit/entry delay Clarified services to use the code passed to them as a first priority, otherwise use the code from configuration Swapped back to using NotImplementedError for the service definitions * - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm) - Add tests for alarm_keypress to manual alarm - Style corrections (too many returns, comment & whitespace issues) * Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way * Moved the Alarm_Keypress service into Envisalink component out of the generic * Update envisalink.py * Update services.yaml
2016-11-18 06:13:22 +00:00
"""Send custom keypress."""
if keypress:
self.hass.data[DATA_EVL].keypresses_to_partition(
2019-07-31 19:25:30 +00:00
self._partition_number, keypress
)