mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Remove alarmdotcom integration (ADR-0004) (#33056)
This commit is contained in:
parent
92d373055f
commit
acf41d03db
@ -24,7 +24,6 @@ omit =
|
|||||||
homeassistant/components/airvisual/sensor.py
|
homeassistant/components/airvisual/sensor.py
|
||||||
homeassistant/components/aladdin_connect/cover.py
|
homeassistant/components/aladdin_connect/cover.py
|
||||||
homeassistant/components/alarmdecoder/*
|
homeassistant/components/alarmdecoder/*
|
||||||
homeassistant/components/alarmdotcom/alarm_control_panel.py
|
|
||||||
homeassistant/components/alpha_vantage/sensor.py
|
homeassistant/components/alpha_vantage/sensor.py
|
||||||
homeassistant/components/amazon_polly/tts.py
|
homeassistant/components/amazon_polly/tts.py
|
||||||
homeassistant/components/ambiclimate/climate.py
|
homeassistant/components/ambiclimate/climate.py
|
||||||
|
@ -1 +0,0 @@
|
|||||||
"""The alarmdotcom component."""
|
|
@ -1,132 +0,0 @@
|
|||||||
"""Interfaces with Alarm.com alarm control panels."""
|
|
||||||
import logging
|
|
||||||
import re
|
|
||||||
|
|
||||||
from pyalarmdotcom import Alarmdotcom
|
|
||||||
import voluptuous as vol
|
|
||||||
|
|
||||||
import homeassistant.components.alarm_control_panel as alarm
|
|
||||||
from homeassistant.components.alarm_control_panel import PLATFORM_SCHEMA
|
|
||||||
from homeassistant.components.alarm_control_panel.const import (
|
|
||||||
SUPPORT_ALARM_ARM_AWAY,
|
|
||||||
SUPPORT_ALARM_ARM_HOME,
|
|
||||||
)
|
|
||||||
from homeassistant.const import (
|
|
||||||
CONF_CODE,
|
|
||||||
CONF_NAME,
|
|
||||||
CONF_PASSWORD,
|
|
||||||
CONF_USERNAME,
|
|
||||||
STATE_ALARM_ARMED_AWAY,
|
|
||||||
STATE_ALARM_ARMED_HOME,
|
|
||||||
STATE_ALARM_DISARMED,
|
|
||||||
)
|
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
|
||||||
import homeassistant.helpers.config_validation as cv
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
DEFAULT_NAME = "Alarm.com"
|
|
||||||
|
|
||||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
|
||||||
{
|
|
||||||
vol.Required(CONF_PASSWORD): cv.string,
|
|
||||||
vol.Required(CONF_USERNAME): cv.string,
|
|
||||||
vol.Optional(CONF_CODE): cv.positive_int,
|
|
||||||
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
|
|
||||||
"""Set up a Alarm.com control panel."""
|
|
||||||
name = config.get(CONF_NAME)
|
|
||||||
code = config.get(CONF_CODE)
|
|
||||||
username = config.get(CONF_USERNAME)
|
|
||||||
password = config.get(CONF_PASSWORD)
|
|
||||||
|
|
||||||
alarmdotcom = AlarmDotCom(hass, name, code, username, password)
|
|
||||||
await alarmdotcom.async_login()
|
|
||||||
async_add_entities([alarmdotcom])
|
|
||||||
|
|
||||||
|
|
||||||
class AlarmDotCom(alarm.AlarmControlPanel):
|
|
||||||
"""Representation of an Alarm.com status."""
|
|
||||||
|
|
||||||
def __init__(self, hass, name, code, username, password):
|
|
||||||
"""Initialize the Alarm.com status."""
|
|
||||||
|
|
||||||
_LOGGER.debug("Setting up Alarm.com...")
|
|
||||||
self._hass = hass
|
|
||||||
self._name = name
|
|
||||||
self._code = str(code) if code else None
|
|
||||||
self._username = username
|
|
||||||
self._password = password
|
|
||||||
self._websession = async_get_clientsession(self._hass)
|
|
||||||
self._state = None
|
|
||||||
self._alarm = Alarmdotcom(username, password, self._websession, hass.loop)
|
|
||||||
|
|
||||||
async def async_login(self):
|
|
||||||
"""Login to Alarm.com."""
|
|
||||||
await self._alarm.async_login()
|
|
||||||
|
|
||||||
async def async_update(self):
|
|
||||||
"""Fetch the latest state."""
|
|
||||||
await self._alarm.async_update()
|
|
||||||
return self._alarm.state
|
|
||||||
|
|
||||||
@property
|
|
||||||
def name(self):
|
|
||||||
"""Return the name of the alarm."""
|
|
||||||
return self._name
|
|
||||||
|
|
||||||
@property
|
|
||||||
def code_format(self):
|
|
||||||
"""Return one or more digits/characters."""
|
|
||||||
if self._code is None:
|
|
||||||
return None
|
|
||||||
if isinstance(self._code, str) and re.search("^\\d+$", self._code):
|
|
||||||
return alarm.FORMAT_NUMBER
|
|
||||||
return alarm.FORMAT_TEXT
|
|
||||||
|
|
||||||
@property
|
|
||||||
def state(self):
|
|
||||||
"""Return the state of the device."""
|
|
||||||
if self._alarm.state.lower() == "disarmed":
|
|
||||||
return STATE_ALARM_DISARMED
|
|
||||||
if self._alarm.state.lower() == "armed stay":
|
|
||||||
return STATE_ALARM_ARMED_HOME
|
|
||||||
if self._alarm.state.lower() == "armed away":
|
|
||||||
return STATE_ALARM_ARMED_AWAY
|
|
||||||
return None
|
|
||||||
|
|
||||||
@property
|
|
||||||
def supported_features(self) -> int:
|
|
||||||
"""Return the list of supported features."""
|
|
||||||
return SUPPORT_ALARM_ARM_HOME | SUPPORT_ALARM_ARM_AWAY
|
|
||||||
|
|
||||||
@property
|
|
||||||
def device_state_attributes(self):
|
|
||||||
"""Return the state attributes."""
|
|
||||||
return {"sensor_status": self._alarm.sensor_status}
|
|
||||||
|
|
||||||
async def async_alarm_disarm(self, code=None):
|
|
||||||
"""Send disarm command."""
|
|
||||||
if self._validate_code(code):
|
|
||||||
await self._alarm.async_alarm_disarm()
|
|
||||||
|
|
||||||
async def async_alarm_arm_home(self, code=None):
|
|
||||||
"""Send arm home command."""
|
|
||||||
if self._validate_code(code):
|
|
||||||
await self._alarm.async_alarm_arm_home()
|
|
||||||
|
|
||||||
async def async_alarm_arm_away(self, code=None):
|
|
||||||
"""Send arm away command."""
|
|
||||||
if self._validate_code(code):
|
|
||||||
await self._alarm.async_alarm_arm_away()
|
|
||||||
|
|
||||||
def _validate_code(self, code):
|
|
||||||
"""Validate given code."""
|
|
||||||
check = self._code is None or code == self._code
|
|
||||||
if not check:
|
|
||||||
_LOGGER.warning("Wrong code entered")
|
|
||||||
return check
|
|
@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"domain": "alarmdotcom",
|
|
||||||
"name": "Alarm.com",
|
|
||||||
"documentation": "https://www.home-assistant.io/integrations/alarmdotcom",
|
|
||||||
"requirements": ["pyalarmdotcom==0.3.2"],
|
|
||||||
"dependencies": [],
|
|
||||||
"codeowners": []
|
|
||||||
}
|
|
@ -1152,9 +1152,6 @@ pyaftership==0.1.2
|
|||||||
# homeassistant.components.airvisual
|
# homeassistant.components.airvisual
|
||||||
pyairvisual==3.0.1
|
pyairvisual==3.0.1
|
||||||
|
|
||||||
# homeassistant.components.alarmdotcom
|
|
||||||
pyalarmdotcom==0.3.2
|
|
||||||
|
|
||||||
# homeassistant.components.almond
|
# homeassistant.components.almond
|
||||||
pyalmond==0.0.2
|
pyalmond==0.0.2
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user