Abode services, events, lights, cameras, automations, quick actions. (#9310)
* Updated to latest AbodePy version. Added services and events. Added new device types. Added exclude, light, and polling config options. * Disable the event service if polling is enabled. * Addressed all CR's * Removed duplicated super call. * Name config option now used. Removed deprecated DEFAULT_NAME. * Modified partial to move event to first param.
This commit is contained in:
parent
5851944f80
commit
c44397e257
10 changed files with 588 additions and 96 deletions
|
@ -7,7 +7,7 @@ https://home-assistant.io/components/alarm_control_panel.abode/
|
|||
import logging
|
||||
|
||||
from homeassistant.components.abode import (
|
||||
AbodeDevice, DATA_ABODE, DEFAULT_NAME, CONF_ATTRIBUTION)
|
||||
AbodeDevice, DOMAIN as ABODE_DOMAIN, CONF_ATTRIBUTION)
|
||||
from homeassistant.components.alarm_control_panel import (AlarmControlPanel)
|
||||
from homeassistant.const import (ATTR_ATTRIBUTION, STATE_ALARM_ARMED_AWAY,
|
||||
STATE_ALARM_ARMED_HOME, STATE_ALARM_DISARMED)
|
||||
|
@ -22,18 +22,22 @@ ICON = 'mdi:security'
|
|||
|
||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
"""Set up a sensor for an Abode device."""
|
||||
abode = hass.data[DATA_ABODE]
|
||||
data = hass.data[ABODE_DOMAIN]
|
||||
|
||||
add_devices([AbodeAlarm(abode, abode.get_alarm())])
|
||||
alarm_devices = [AbodeAlarm(data, data.abode.get_alarm(), data.name)]
|
||||
|
||||
data.devices.extend(alarm_devices)
|
||||
|
||||
add_devices(alarm_devices)
|
||||
|
||||
|
||||
class AbodeAlarm(AbodeDevice, AlarmControlPanel):
|
||||
"""An alarm_control_panel implementation for Abode."""
|
||||
|
||||
def __init__(self, controller, device):
|
||||
def __init__(self, data, device, name):
|
||||
"""Initialize the alarm control panel."""
|
||||
AbodeDevice.__init__(self, controller, device)
|
||||
self._name = "{0}".format(DEFAULT_NAME)
|
||||
super().__init__(data, device)
|
||||
self._name = name
|
||||
|
||||
@property
|
||||
def icon(self):
|
||||
|
@ -65,6 +69,11 @@ class AbodeAlarm(AbodeDevice, AlarmControlPanel):
|
|||
"""Send arm away command."""
|
||||
self._device.set_away()
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""Return the name of the alarm."""
|
||||
return self._name or super().name
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue