Update demo entities

pull/685/head
Paulus Schoutsen 2015-11-29 17:59:59 -08:00
parent dc2f3861c9
commit 72ebb22eba
3 changed files with 7 additions and 38 deletions

View File

@ -3,36 +3,11 @@ homeassistant.components.alarm_control_panel.demo
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Demo platform that has two fake alarm control panels.
"""
import homeassistant.components.alarm_control_panel.manual as Alarm
from homeassistant.const import (STATE_ALARM_DISARMED,
STATE_ALARM_ARMED_AWAY)
import homeassistant.components.alarm_control_panel.manual as manual
def setup_platform(hass, config, add_devices, discovery_info=None):
""" Sets up the Demo alarm control panels. """
add_devices([
DemoAlarmControlPanel(hass, 'Front door', '1234', 2, 4,
STATE_ALARM_DISARMED),
DemoAlarmControlPanel(hass, 'Safe', '1234', 2, 4,
STATE_ALARM_ARMED_AWAY),
])
# pylint: disable=too-many-arguments
class DemoAlarmControlPanel(Alarm.ManualAlarm):
""" A Demo alarm control panel. """
def __init__(self, hass, name, code, pending_time, trigger_time, state):
super().__init__(hass, name, code, pending_time, trigger_time)
self._state = state
@property
def should_poll(self):
""" No polling needed for a demo panel. """
return False
@property
def state(self):
""" Returns the state of the device. """
return self._state
manual.ManualAlarm(hass, 'Alarm', '1234', 5, 10),
])

View File

@ -9,18 +9,17 @@ from homeassistant.components.binary_sensor import BinarySensorDevice
def setup_platform(hass, config, add_devices, discovery_info=None):
""" Sets up the Demo binary sensors. """
add_devices([
DemoBinarySensor('Window Bathroom', True, None),
DemoBinarySensor('Floor Basement', False, None),
DemoBinarySensor('Basement Floor Wet', False),
DemoBinarySensor('Movement Backyard', True),
])
class DemoBinarySensor(BinarySensorDevice):
""" A Demo binary sensor. """
def __init__(self, name, state, icon=None):
def __init__(self, name, state):
self._name = name
self._state = state
self._icon = icon
@property
def should_poll(self):
@ -32,11 +31,6 @@ class DemoBinarySensor(BinarySensorDevice):
""" Returns the name of the binary sensor. """
return self._name
@property
def icon(self):
""" Returns the icon to use for device if any. """
return self._icon
@property
def is_on(self):
""" True if the binary sensor is on. """

View File

@ -18,7 +18,7 @@ DEPENDENCIES = ['conversation', 'introduction', 'zone']
COMPONENTS_WITH_DEMO_PLATFORM = [
'device_tracker', 'light', 'media_player', 'notify', 'switch', 'sensor',
'thermostat', 'camera', 'binary_sensor', 'alarm_control_panel']
'thermostat', 'camera', 'binary_sensor', 'alarm_control_panel', 'lock']
def setup(hass, config):