mirror of
https://github.com/home-assistant/core
synced 2024-09-06 10:29:55 +02:00
Async syntax 1, alarm_control_panel & automation & binary_sensor (#17015)
This commit is contained in:
parent
750c96709e
commit
38e371c5d9
@ -4,7 +4,6 @@ Component to interface with an alarm control panel.
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/alarm_control_panel/
|
https://home-assistant.io/components/alarm_control_panel/
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
@ -31,13 +30,12 @@ ALARM_SERVICE_SCHEMA = vol.Schema({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_setup(hass, config):
|
||||||
def async_setup(hass, config):
|
|
||||||
"""Track states and offer events for sensors."""
|
"""Track states and offer events for sensors."""
|
||||||
component = hass.data[DOMAIN] = EntityComponent(
|
component = hass.data[DOMAIN] = EntityComponent(
|
||||||
logging.getLogger(__name__), DOMAIN, hass, SCAN_INTERVAL)
|
logging.getLogger(__name__), DOMAIN, hass, SCAN_INTERVAL)
|
||||||
|
|
||||||
yield from component.async_setup(config)
|
await component.async_setup(config)
|
||||||
|
|
||||||
component.async_register_entity_service(
|
component.async_register_entity_service(
|
||||||
SERVICE_ALARM_DISARM, ALARM_SERVICE_SCHEMA,
|
SERVICE_ALARM_DISARM, ALARM_SERVICE_SCHEMA,
|
||||||
|
@ -4,7 +4,6 @@ Support for AlarmDecoder-based alarm control panels (Honeywell/DSC).
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/alarm_control_panel.alarmdecoder/
|
https://home-assistant.io/components/alarm_control_panel.alarmdecoder/
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
@ -59,8 +58,7 @@ class AlarmDecoderAlarmPanel(alarm.AlarmControlPanel):
|
|||||||
self._ready = None
|
self._ready = None
|
||||||
self._zone_bypassed = None
|
self._zone_bypassed = None
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_added_to_hass(self):
|
||||||
def async_added_to_hass(self):
|
|
||||||
"""Register callbacks."""
|
"""Register callbacks."""
|
||||||
self.hass.helpers.dispatcher.async_dispatcher_connect(
|
self.hass.helpers.dispatcher.async_dispatcher_connect(
|
||||||
SIGNAL_PANEL_MESSAGE, self._message_callback)
|
SIGNAL_PANEL_MESSAGE, self._message_callback)
|
||||||
|
@ -4,7 +4,6 @@ Interfaces with Alarm.com alarm control panels.
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/alarm_control_panel.alarmdotcom/
|
https://home-assistant.io/components/alarm_control_panel.alarmdotcom/
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
|
|
||||||
@ -32,9 +31,8 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_setup_platform(hass, config, async_add_entities,
|
||||||
def async_setup_platform(hass, config, async_add_entities,
|
discovery_info=None):
|
||||||
discovery_info=None):
|
|
||||||
"""Set up a Alarm.com control panel."""
|
"""Set up a Alarm.com control panel."""
|
||||||
name = config.get(CONF_NAME)
|
name = config.get(CONF_NAME)
|
||||||
code = config.get(CONF_CODE)
|
code = config.get(CONF_CODE)
|
||||||
@ -42,7 +40,7 @@ def async_setup_platform(hass, config, async_add_entities,
|
|||||||
password = config.get(CONF_PASSWORD)
|
password = config.get(CONF_PASSWORD)
|
||||||
|
|
||||||
alarmdotcom = AlarmDotCom(hass, name, code, username, password)
|
alarmdotcom = AlarmDotCom(hass, name, code, username, password)
|
||||||
yield from alarmdotcom.async_login()
|
await alarmdotcom.async_login()
|
||||||
async_add_entities([alarmdotcom])
|
async_add_entities([alarmdotcom])
|
||||||
|
|
||||||
|
|
||||||
@ -63,15 +61,13 @@ class AlarmDotCom(alarm.AlarmControlPanel):
|
|||||||
self._alarm = Alarmdotcom(
|
self._alarm = Alarmdotcom(
|
||||||
username, password, self._websession, hass.loop)
|
username, password, self._websession, hass.loop)
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_login(self):
|
||||||
def async_login(self):
|
|
||||||
"""Login to Alarm.com."""
|
"""Login to Alarm.com."""
|
||||||
yield from self._alarm.async_login()
|
await self._alarm.async_login()
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_update(self):
|
||||||
def async_update(self):
|
|
||||||
"""Fetch the latest state."""
|
"""Fetch the latest state."""
|
||||||
yield from self._alarm.async_update()
|
await self._alarm.async_update()
|
||||||
return self._alarm.state
|
return self._alarm.state
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -106,23 +102,20 @@ class AlarmDotCom(alarm.AlarmControlPanel):
|
|||||||
'sensor_status': self._alarm.sensor_status
|
'sensor_status': self._alarm.sensor_status
|
||||||
}
|
}
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_alarm_disarm(self, code=None):
|
||||||
def async_alarm_disarm(self, code=None):
|
|
||||||
"""Send disarm command."""
|
"""Send disarm command."""
|
||||||
if self._validate_code(code):
|
if self._validate_code(code):
|
||||||
yield from self._alarm.async_alarm_disarm()
|
await self._alarm.async_alarm_disarm()
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_alarm_arm_home(self, code=None):
|
||||||
def async_alarm_arm_home(self, code=None):
|
|
||||||
"""Send arm hom command."""
|
"""Send arm hom command."""
|
||||||
if self._validate_code(code):
|
if self._validate_code(code):
|
||||||
yield from self._alarm.async_alarm_arm_home()
|
await self._alarm.async_alarm_arm_home()
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_alarm_arm_away(self, code=None):
|
||||||
def async_alarm_arm_away(self, code=None):
|
|
||||||
"""Send arm away command."""
|
"""Send arm away command."""
|
||||||
if self._validate_code(code):
|
if self._validate_code(code):
|
||||||
yield from self._alarm.async_alarm_arm_away()
|
await self._alarm.async_alarm_arm_away()
|
||||||
|
|
||||||
def _validate_code(self, code):
|
def _validate_code(self, code):
|
||||||
"""Validate given code."""
|
"""Validate given code."""
|
||||||
|
@ -4,7 +4,6 @@ Interfaces with Egardia/Woonveilig alarm control panel.
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/alarm_control_panel.egardia/
|
https://home-assistant.io/components/alarm_control_panel.egardia/
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
@ -61,8 +60,7 @@ class EgardiaAlarm(alarm.AlarmControlPanel):
|
|||||||
self._rs_codes = rs_codes
|
self._rs_codes = rs_codes
|
||||||
self._rs_port = rs_port
|
self._rs_port = rs_port
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_added_to_hass(self):
|
||||||
def async_added_to_hass(self):
|
|
||||||
"""Add Egardiaserver callback if enabled."""
|
"""Add Egardiaserver callback if enabled."""
|
||||||
if self._rs_enabled:
|
if self._rs_enabled:
|
||||||
_LOGGER.debug("Registering callback to Egardiaserver")
|
_LOGGER.debug("Registering callback to Egardiaserver")
|
||||||
|
@ -4,7 +4,6 @@ Support for Envisalink-based alarm control panels (Honeywell/DSC).
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/alarm_control_panel.envisalink/
|
https://home-assistant.io/components/alarm_control_panel.envisalink/
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
@ -32,9 +31,8 @@ ALARM_KEYPRESS_SCHEMA = vol.Schema({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_setup_platform(hass, config, async_add_entities,
|
||||||
def async_setup_platform(hass, config, async_add_entities,
|
discovery_info=None):
|
||||||
discovery_info=None):
|
|
||||||
"""Perform the setup for Envisalink alarm panels."""
|
"""Perform the setup for Envisalink alarm panels."""
|
||||||
configured_partitions = discovery_info['partitions']
|
configured_partitions = discovery_info['partitions']
|
||||||
code = discovery_info[CONF_CODE]
|
code = discovery_info[CONF_CODE]
|
||||||
@ -88,8 +86,7 @@ class EnvisalinkAlarm(EnvisalinkDevice, alarm.AlarmControlPanel):
|
|||||||
_LOGGER.debug("Setting up alarm: %s", alarm_name)
|
_LOGGER.debug("Setting up alarm: %s", alarm_name)
|
||||||
super().__init__(alarm_name, info, controller)
|
super().__init__(alarm_name, info, controller)
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_added_to_hass(self):
|
||||||
def async_added_to_hass(self):
|
|
||||||
"""Register callbacks."""
|
"""Register callbacks."""
|
||||||
async_dispatcher_connect(
|
async_dispatcher_connect(
|
||||||
self.hass, SIGNAL_KEYPAD_UPDATE, self._update_callback)
|
self.hass, SIGNAL_KEYPAD_UPDATE, self._update_callback)
|
||||||
@ -128,8 +125,7 @@ class EnvisalinkAlarm(EnvisalinkDevice, alarm.AlarmControlPanel):
|
|||||||
state = STATE_ALARM_DISARMED
|
state = STATE_ALARM_DISARMED
|
||||||
return state
|
return state
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_alarm_disarm(self, code=None):
|
||||||
def async_alarm_disarm(self, code=None):
|
|
||||||
"""Send disarm command."""
|
"""Send disarm command."""
|
||||||
if code:
|
if code:
|
||||||
self.hass.data[DATA_EVL].disarm_partition(
|
self.hass.data[DATA_EVL].disarm_partition(
|
||||||
@ -138,8 +134,7 @@ class EnvisalinkAlarm(EnvisalinkDevice, alarm.AlarmControlPanel):
|
|||||||
self.hass.data[DATA_EVL].disarm_partition(
|
self.hass.data[DATA_EVL].disarm_partition(
|
||||||
str(self._code), self._partition_number)
|
str(self._code), self._partition_number)
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_alarm_arm_home(self, code=None):
|
||||||
def async_alarm_arm_home(self, code=None):
|
|
||||||
"""Send arm home command."""
|
"""Send arm home command."""
|
||||||
if code:
|
if code:
|
||||||
self.hass.data[DATA_EVL].arm_stay_partition(
|
self.hass.data[DATA_EVL].arm_stay_partition(
|
||||||
@ -148,8 +143,7 @@ class EnvisalinkAlarm(EnvisalinkDevice, alarm.AlarmControlPanel):
|
|||||||
self.hass.data[DATA_EVL].arm_stay_partition(
|
self.hass.data[DATA_EVL].arm_stay_partition(
|
||||||
str(self._code), self._partition_number)
|
str(self._code), self._partition_number)
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_alarm_arm_away(self, code=None):
|
||||||
def async_alarm_arm_away(self, code=None):
|
|
||||||
"""Send arm away command."""
|
"""Send arm away command."""
|
||||||
if code:
|
if code:
|
||||||
self.hass.data[DATA_EVL].arm_away_partition(
|
self.hass.data[DATA_EVL].arm_away_partition(
|
||||||
@ -158,8 +152,7 @@ class EnvisalinkAlarm(EnvisalinkDevice, alarm.AlarmControlPanel):
|
|||||||
self.hass.data[DATA_EVL].arm_away_partition(
|
self.hass.data[DATA_EVL].arm_away_partition(
|
||||||
str(self._code), self._partition_number)
|
str(self._code), self._partition_number)
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_alarm_trigger(self, code=None):
|
||||||
def async_alarm_trigger(self, code=None):
|
|
||||||
"""Alarm trigger command. Will be used to trigger a panic alarm."""
|
"""Alarm trigger command. Will be used to trigger a panic alarm."""
|
||||||
self.hass.data[DATA_EVL].panic_alarm(self._panic_type)
|
self.hass.data[DATA_EVL].panic_alarm(self._panic_type)
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ Support for manual alarms controllable via MQTT.
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/alarm_control_panel.manual_mqtt/
|
https://home-assistant.io/components/alarm_control_panel.manual_mqtt/
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
import copy
|
import copy
|
||||||
import datetime
|
import datetime
|
||||||
import logging
|
import logging
|
||||||
@ -363,8 +362,8 @@ class ManualMQTTAlarm(alarm.AlarmControlPanel):
|
|||||||
return mqtt.async_subscribe(
|
return mqtt.async_subscribe(
|
||||||
self.hass, self._command_topic, message_received, self._qos)
|
self.hass, self._command_topic, message_received, self._qos)
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def _async_state_changed_listener(self, entity_id, old_state,
|
||||||
def _async_state_changed_listener(self, entity_id, old_state, new_state):
|
new_state):
|
||||||
"""Publish state change to MQTT."""
|
"""Publish state change to MQTT."""
|
||||||
mqtt.async_publish(
|
mqtt.async_publish(
|
||||||
self.hass, self._state_topic, new_state.state, self._qos, True)
|
self.hass, self._state_topic, new_state.state, self._qos, True)
|
||||||
|
@ -4,7 +4,6 @@ This platform enables the possibility to control a MQTT alarm.
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/alarm_control_panel.mqtt/
|
https://home-assistant.io/components/alarm_control_panel.mqtt/
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
|
|
||||||
@ -111,11 +110,10 @@ class MqttAlarm(MqttAvailability, MqttDiscoveryUpdate,
|
|||||||
self._code = code
|
self._code = code
|
||||||
self._discovery_hash = discovery_hash
|
self._discovery_hash = discovery_hash
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_added_to_hass(self):
|
||||||
def async_added_to_hass(self):
|
|
||||||
"""Subscribe mqtt events."""
|
"""Subscribe mqtt events."""
|
||||||
yield from MqttAvailability.async_added_to_hass(self)
|
await MqttAvailability.async_added_to_hass(self)
|
||||||
yield from MqttDiscoveryUpdate.async_added_to_hass(self)
|
await MqttDiscoveryUpdate.async_added_to_hass(self)
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def message_received(topic, payload, qos):
|
def message_received(topic, payload, qos):
|
||||||
@ -128,7 +126,7 @@ class MqttAlarm(MqttAvailability, MqttDiscoveryUpdate,
|
|||||||
self._state = payload
|
self._state = payload
|
||||||
self.async_schedule_update_ha_state()
|
self.async_schedule_update_ha_state()
|
||||||
|
|
||||||
yield from mqtt.async_subscribe(
|
await mqtt.async_subscribe(
|
||||||
self.hass, self._state_topic, message_received, self._qos)
|
self.hass, self._state_topic, message_received, self._qos)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -155,8 +153,7 @@ class MqttAlarm(MqttAvailability, MqttDiscoveryUpdate,
|
|||||||
return 'Number'
|
return 'Number'
|
||||||
return 'Any'
|
return 'Any'
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_alarm_disarm(self, code=None):
|
||||||
def async_alarm_disarm(self, code=None):
|
|
||||||
"""Send disarm command.
|
"""Send disarm command.
|
||||||
|
|
||||||
This method is a coroutine.
|
This method is a coroutine.
|
||||||
@ -167,8 +164,7 @@ class MqttAlarm(MqttAvailability, MqttDiscoveryUpdate,
|
|||||||
self.hass, self._command_topic, self._payload_disarm, self._qos,
|
self.hass, self._command_topic, self._payload_disarm, self._qos,
|
||||||
self._retain)
|
self._retain)
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_alarm_arm_home(self, code=None):
|
||||||
def async_alarm_arm_home(self, code=None):
|
|
||||||
"""Send arm home command.
|
"""Send arm home command.
|
||||||
|
|
||||||
This method is a coroutine.
|
This method is a coroutine.
|
||||||
@ -179,8 +175,7 @@ class MqttAlarm(MqttAvailability, MqttDiscoveryUpdate,
|
|||||||
self.hass, self._command_topic, self._payload_arm_home, self._qos,
|
self.hass, self._command_topic, self._payload_arm_home, self._qos,
|
||||||
self._retain)
|
self._retain)
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_alarm_arm_away(self, code=None):
|
||||||
def async_alarm_arm_away(self, code=None):
|
|
||||||
"""Send arm away command.
|
"""Send arm away command.
|
||||||
|
|
||||||
This method is a coroutine.
|
This method is a coroutine.
|
||||||
|
@ -4,7 +4,6 @@ Support for Satel Integra alarm, using ETHM module: https://www.satel.pl/en/ .
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/alarm_control_panel.satel_integra/
|
https://home-assistant.io/components/alarm_control_panel.satel_integra/
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import homeassistant.components.alarm_control_panel as alarm
|
import homeassistant.components.alarm_control_panel as alarm
|
||||||
@ -18,9 +17,8 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
DEPENDENCIES = ['satel_integra']
|
DEPENDENCIES = ['satel_integra']
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_setup_platform(hass, config, async_add_entities,
|
||||||
def async_setup_platform(hass, config, async_add_entities,
|
discovery_info=None):
|
||||||
discovery_info=None):
|
|
||||||
"""Set up for Satel Integra alarm panels."""
|
"""Set up for Satel Integra alarm panels."""
|
||||||
if not discovery_info:
|
if not discovery_info:
|
||||||
return
|
return
|
||||||
@ -39,8 +37,7 @@ class SatelIntegraAlarmPanel(alarm.AlarmControlPanel):
|
|||||||
self._state = None
|
self._state = None
|
||||||
self._arm_home_mode = arm_home_mode
|
self._arm_home_mode = arm_home_mode
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_added_to_hass(self):
|
||||||
def async_added_to_hass(self):
|
|
||||||
"""Register callbacks."""
|
"""Register callbacks."""
|
||||||
async_dispatcher_connect(
|
async_dispatcher_connect(
|
||||||
self.hass, SIGNAL_PANEL_MESSAGE, self._message_callback)
|
self.hass, SIGNAL_PANEL_MESSAGE, self._message_callback)
|
||||||
@ -74,21 +71,18 @@ class SatelIntegraAlarmPanel(alarm.AlarmControlPanel):
|
|||||||
"""Return the state of the device."""
|
"""Return the state of the device."""
|
||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_alarm_disarm(self, code=None):
|
||||||
def async_alarm_disarm(self, code=None):
|
|
||||||
"""Send disarm command."""
|
"""Send disarm command."""
|
||||||
if code:
|
if code:
|
||||||
yield from self.hass.data[DATA_SATEL].disarm(code)
|
await self.hass.data[DATA_SATEL].disarm(code)
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_alarm_arm_away(self, code=None):
|
||||||
def async_alarm_arm_away(self, code=None):
|
|
||||||
"""Send arm away command."""
|
"""Send arm away command."""
|
||||||
if code:
|
if code:
|
||||||
yield from self.hass.data[DATA_SATEL].arm(code)
|
await self.hass.data[DATA_SATEL].arm(code)
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_alarm_arm_home(self, code=None):
|
||||||
def async_alarm_arm_home(self, code=None):
|
|
||||||
"""Send arm home command."""
|
"""Send arm home command."""
|
||||||
if code:
|
if code:
|
||||||
yield from self.hass.data[DATA_SATEL].arm(
|
await self.hass.data[DATA_SATEL].arm(
|
||||||
code, self._arm_home_mode)
|
code, self._arm_home_mode)
|
||||||
|
@ -4,7 +4,6 @@ Interfaces with Wink Cameras.
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/alarm_control_panel.wink/
|
https://home-assistant.io/components/alarm_control_panel.wink/
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import homeassistant.components.alarm_control_panel as alarm
|
import homeassistant.components.alarm_control_panel as alarm
|
||||||
@ -38,8 +37,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||||||
class WinkCameraDevice(WinkDevice, alarm.AlarmControlPanel):
|
class WinkCameraDevice(WinkDevice, alarm.AlarmControlPanel):
|
||||||
"""Representation a Wink camera alarm."""
|
"""Representation a Wink camera alarm."""
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_added_to_hass(self):
|
||||||
def async_added_to_hass(self):
|
|
||||||
"""Call when entity is added to hass."""
|
"""Call when entity is added to hass."""
|
||||||
self.hass.data[DOMAIN]['entities']['alarm_control_panel'].append(self)
|
self.hass.data[DOMAIN]['entities']['alarm_control_panel'].append(self)
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ Offer event listening automation rules.
|
|||||||
For more details about this automation rule, please refer to the documentation
|
For more details about this automation rule, please refer to the documentation
|
||||||
at https://home-assistant.io/docs/automation/trigger/#event-trigger
|
at https://home-assistant.io/docs/automation/trigger/#event-trigger
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
@ -25,8 +24,7 @@ TRIGGER_SCHEMA = vol.Schema({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_trigger(hass, config, action):
|
||||||
def async_trigger(hass, config, action):
|
|
||||||
"""Listen for events based on configuration."""
|
"""Listen for events based on configuration."""
|
||||||
event_type = config.get(CONF_EVENT_TYPE)
|
event_type = config.get(CONF_EVENT_TYPE)
|
||||||
event_data_schema = vol.Schema(
|
event_data_schema = vol.Schema(
|
||||||
|
@ -4,7 +4,6 @@ Offer Home Assistant core automation rules.
|
|||||||
For more details about this automation rule, please refer to the documentation
|
For more details about this automation rule, please refer to the documentation
|
||||||
at https://home-assistant.io/components/automation/#homeassistant-trigger
|
at https://home-assistant.io/components/automation/#homeassistant-trigger
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
@ -23,8 +22,7 @@ TRIGGER_SCHEMA = vol.Schema({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_trigger(hass, config, action):
|
||||||
def async_trigger(hass, config, action):
|
|
||||||
"""Listen for events based on configuration."""
|
"""Listen for events based on configuration."""
|
||||||
event = config.get(CONF_EVENT)
|
event = config.get(CONF_EVENT)
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ Trigger an automation when a LiteJet switch is released.
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/automation.litejet/
|
https://home-assistant.io/components/automation.litejet/
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
@ -33,8 +32,7 @@ TRIGGER_SCHEMA = vol.Schema({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_trigger(hass, config, action):
|
||||||
def async_trigger(hass, config, action):
|
|
||||||
"""Listen for events based on configuration."""
|
"""Listen for events based on configuration."""
|
||||||
number = config.get(CONF_NUMBER)
|
number = config.get(CONF_NUMBER)
|
||||||
held_more_than = config.get(CONF_HELD_MORE_THAN)
|
held_more_than = config.get(CONF_HELD_MORE_THAN)
|
||||||
|
@ -4,7 +4,6 @@ Offer MQTT listening automation rules.
|
|||||||
For more details about this automation rule, please refer to the documentation
|
For more details about this automation rule, please refer to the documentation
|
||||||
at https://home-assistant.io/docs/automation/trigger/#mqtt-trigger
|
at https://home-assistant.io/docs/automation/trigger/#mqtt-trigger
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
@ -25,8 +24,7 @@ TRIGGER_SCHEMA = vol.Schema({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_trigger(hass, config, action):
|
||||||
def async_trigger(hass, config, action):
|
|
||||||
"""Listen for state changes based on configuration."""
|
"""Listen for state changes based on configuration."""
|
||||||
topic = config.get(CONF_TOPIC)
|
topic = config.get(CONF_TOPIC)
|
||||||
payload = config.get(CONF_PAYLOAD)
|
payload = config.get(CONF_PAYLOAD)
|
||||||
@ -51,6 +49,6 @@ def async_trigger(hass, config, action):
|
|||||||
'trigger': data
|
'trigger': data
|
||||||
})
|
})
|
||||||
|
|
||||||
remove = yield from mqtt.async_subscribe(
|
remove = await mqtt.async_subscribe(
|
||||||
hass, topic, mqtt_automation_listener)
|
hass, topic, mqtt_automation_listener)
|
||||||
return remove
|
return remove
|
||||||
|
@ -4,7 +4,6 @@ Offer numeric state listening automation rules.
|
|||||||
For more details about this automation rule, please refer to the documentation
|
For more details about this automation rule, please refer to the documentation
|
||||||
at https://home-assistant.io/docs/automation/trigger/#numeric-state-trigger
|
at https://home-assistant.io/docs/automation/trigger/#numeric-state-trigger
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
@ -29,8 +28,7 @@ TRIGGER_SCHEMA = vol.All(vol.Schema({
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_trigger(hass, config, action):
|
||||||
def async_trigger(hass, config, action):
|
|
||||||
"""Listen for state changes based on configuration."""
|
"""Listen for state changes based on configuration."""
|
||||||
entity_id = config.get(CONF_ENTITY_ID)
|
entity_id = config.get(CONF_ENTITY_ID)
|
||||||
below = config.get(CONF_BELOW)
|
below = config.get(CONF_BELOW)
|
||||||
|
@ -4,7 +4,6 @@ Offer state listening automation rules.
|
|||||||
For more details about this automation rule, please refer to the documentation
|
For more details about this automation rule, please refer to the documentation
|
||||||
at https://home-assistant.io/docs/automation/trigger/#state-trigger
|
at https://home-assistant.io/docs/automation/trigger/#state-trigger
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
@ -27,8 +26,7 @@ TRIGGER_SCHEMA = vol.All(vol.Schema({
|
|||||||
}), cv.key_dependency(CONF_FOR, CONF_TO))
|
}), cv.key_dependency(CONF_FOR, CONF_TO))
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_trigger(hass, config, action):
|
||||||
def async_trigger(hass, config, action):
|
|
||||||
"""Listen for state changes based on configuration."""
|
"""Listen for state changes based on configuration."""
|
||||||
entity_id = config.get(CONF_ENTITY_ID)
|
entity_id = config.get(CONF_ENTITY_ID)
|
||||||
from_state = config.get(CONF_FROM, MATCH_ALL)
|
from_state = config.get(CONF_FROM, MATCH_ALL)
|
||||||
|
@ -4,7 +4,6 @@ Offer sun based automation rules.
|
|||||||
For more details about this automation rule, please refer to the documentation
|
For more details about this automation rule, please refer to the documentation
|
||||||
at https://home-assistant.io/docs/automation/trigger/#sun-trigger
|
at https://home-assistant.io/docs/automation/trigger/#sun-trigger
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
@ -25,8 +24,7 @@ TRIGGER_SCHEMA = vol.Schema({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_trigger(hass, config, action):
|
||||||
def async_trigger(hass, config, action):
|
|
||||||
"""Listen for events based on configuration."""
|
"""Listen for events based on configuration."""
|
||||||
event = config.get(CONF_EVENT)
|
event = config.get(CONF_EVENT)
|
||||||
offset = config.get(CONF_OFFSET)
|
offset = config.get(CONF_OFFSET)
|
||||||
|
@ -4,7 +4,6 @@ Offer template automation rules.
|
|||||||
For more details about this automation rule, please refer to the documentation
|
For more details about this automation rule, please refer to the documentation
|
||||||
at https://home-assistant.io/docs/automation/trigger/#template-trigger
|
at https://home-assistant.io/docs/automation/trigger/#template-trigger
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
@ -23,8 +22,7 @@ TRIGGER_SCHEMA = IF_ACTION_SCHEMA = vol.Schema({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_trigger(hass, config, action):
|
||||||
def async_trigger(hass, config, action):
|
|
||||||
"""Listen for state changes based on configuration."""
|
"""Listen for state changes based on configuration."""
|
||||||
value_template = config.get(CONF_VALUE_TEMPLATE)
|
value_template = config.get(CONF_VALUE_TEMPLATE)
|
||||||
value_template.hass = hass
|
value_template.hass = hass
|
||||||
|
@ -4,7 +4,6 @@ Offer time listening automation rules.
|
|||||||
For more details about this automation rule, please refer to the documentation
|
For more details about this automation rule, please refer to the documentation
|
||||||
at https://home-assistant.io/docs/automation/trigger/#time-trigger
|
at https://home-assistant.io/docs/automation/trigger/#time-trigger
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
@ -29,8 +28,7 @@ TRIGGER_SCHEMA = vol.All(vol.Schema({
|
|||||||
}), cv.has_at_least_one_key(CONF_HOURS, CONF_MINUTES, CONF_SECONDS, CONF_AT))
|
}), cv.has_at_least_one_key(CONF_HOURS, CONF_MINUTES, CONF_SECONDS, CONF_AT))
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_trigger(hass, config, action):
|
||||||
def async_trigger(hass, config, action):
|
|
||||||
"""Listen for state changes based on configuration."""
|
"""Listen for state changes based on configuration."""
|
||||||
if CONF_AT in config:
|
if CONF_AT in config:
|
||||||
at_time = config.get(CONF_AT)
|
at_time = config.get(CONF_AT)
|
||||||
|
@ -4,7 +4,6 @@ Offer zone automation rules.
|
|||||||
For more details about this automation rule, please refer to the documentation
|
For more details about this automation rule, please refer to the documentation
|
||||||
at https://home-assistant.io/docs/automation/trigger/#zone-trigger
|
at https://home-assistant.io/docs/automation/trigger/#zone-trigger
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
@ -27,8 +26,7 @@ TRIGGER_SCHEMA = vol.Schema({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_trigger(hass, config, action):
|
||||||
def async_trigger(hass, config, action):
|
|
||||||
"""Listen for state changes based on configuration."""
|
"""Listen for state changes based on configuration."""
|
||||||
entity_id = config.get(CONF_ENTITY_ID)
|
entity_id = config.get(CONF_ENTITY_ID)
|
||||||
zone_entity_id = config.get(CONF_ZONE)
|
zone_entity_id = config.get(CONF_ZONE)
|
||||||
|
@ -4,7 +4,6 @@ Support for ADS binary sensors.
|
|||||||
For more details about this platform, please refer to the documentation.
|
For more details about this platform, please refer to the documentation.
|
||||||
https://home-assistant.io/components/binary_sensor.ads/
|
https://home-assistant.io/components/binary_sensor.ads/
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
@ -50,8 +49,7 @@ class AdsBinarySensor(BinarySensorDevice):
|
|||||||
self._ads_hub = ads_hub
|
self._ads_hub = ads_hub
|
||||||
self.ads_var = ads_var
|
self.ads_var = ads_var
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_added_to_hass(self):
|
||||||
def async_added_to_hass(self):
|
|
||||||
"""Register device notification."""
|
"""Register device notification."""
|
||||||
def update(name, value):
|
def update(name, value):
|
||||||
"""Handle device notifications."""
|
"""Handle device notifications."""
|
||||||
|
@ -4,7 +4,6 @@ Support for AlarmDecoder zone states- represented as binary sensors.
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/binary_sensor.alarmdecoder/
|
https://home-assistant.io/components/binary_sensor.alarmdecoder/
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import BinarySensorDevice
|
from homeassistant.components.binary_sensor import BinarySensorDevice
|
||||||
@ -64,8 +63,7 @@ class AlarmDecoderBinarySensor(BinarySensorDevice):
|
|||||||
self._relay_addr = relay_addr
|
self._relay_addr = relay_addr
|
||||||
self._relay_chan = relay_chan
|
self._relay_chan = relay_chan
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_added_to_hass(self):
|
||||||
def async_added_to_hass(self):
|
|
||||||
"""Register callbacks."""
|
"""Register callbacks."""
|
||||||
self.hass.helpers.dispatcher.async_dispatcher_connect(
|
self.hass.helpers.dispatcher.async_dispatcher_connect(
|
||||||
SIGNAL_ZONE_FAULT, self._fault_callback)
|
SIGNAL_ZONE_FAULT, self._fault_callback)
|
||||||
|
@ -4,8 +4,6 @@ Support for IP Webcam binary sensors.
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/binary_sensor.android_ip_webcam/
|
https://home-assistant.io/components/binary_sensor.android_ip_webcam/
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import BinarySensorDevice
|
from homeassistant.components.binary_sensor import BinarySensorDevice
|
||||||
from homeassistant.components.android_ip_webcam import (
|
from homeassistant.components.android_ip_webcam import (
|
||||||
KEY_MAP, DATA_IP_WEBCAM, AndroidIPCamEntity, CONF_HOST, CONF_NAME)
|
KEY_MAP, DATA_IP_WEBCAM, AndroidIPCamEntity, CONF_HOST, CONF_NAME)
|
||||||
@ -13,9 +11,8 @@ from homeassistant.components.android_ip_webcam import (
|
|||||||
DEPENDENCIES = ['android_ip_webcam']
|
DEPENDENCIES = ['android_ip_webcam']
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_setup_platform(hass, config, async_add_entities,
|
||||||
def async_setup_platform(hass, config, async_add_entities,
|
discovery_info=None):
|
||||||
discovery_info=None):
|
|
||||||
"""Set up the IP Webcam binary sensors."""
|
"""Set up the IP Webcam binary sensors."""
|
||||||
if discovery_info is None:
|
if discovery_info is None:
|
||||||
return
|
return
|
||||||
@ -51,8 +48,7 @@ class IPWebcamBinarySensor(AndroidIPCamEntity, BinarySensorDevice):
|
|||||||
"""Return true if the binary sensor is on."""
|
"""Return true if the binary sensor is on."""
|
||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_update(self):
|
||||||
def async_update(self):
|
|
||||||
"""Retrieve latest state."""
|
"""Retrieve latest state."""
|
||||||
state, _ = self._ipcam.export_sensor(self._sensor)
|
state, _ = self._ipcam.export_sensor(self._sensor)
|
||||||
self._state = state == 1.0
|
self._state = state == 1.0
|
||||||
|
@ -4,7 +4,6 @@ Use Bayesian Inference to trigger a binary sensor.
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/binary_sensor.bayesian/
|
https://home-assistant.io/components/binary_sensor.bayesian/
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
@ -74,9 +73,8 @@ def update_probability(prior, prob_true, prob_false):
|
|||||||
return probability
|
return probability
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_setup_platform(hass, config, async_add_entities,
|
||||||
def async_setup_platform(hass, config, async_add_entities,
|
discovery_info=None):
|
||||||
discovery_info=None):
|
|
||||||
"""Set up the Bayesian Binary sensor."""
|
"""Set up the Bayesian Binary sensor."""
|
||||||
name = config.get(CONF_NAME)
|
name = config.get(CONF_NAME)
|
||||||
observations = config.get(CONF_OBSERVATIONS)
|
observations = config.get(CONF_OBSERVATIONS)
|
||||||
@ -119,8 +117,7 @@ class BayesianBinarySensor(BinarySensorDevice):
|
|||||||
'state': self._process_state
|
'state': self._process_state
|
||||||
}
|
}
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_added_to_hass(self):
|
||||||
def async_added_to_hass(self):
|
|
||||||
"""Call when entity about to be added."""
|
"""Call when entity about to be added."""
|
||||||
@callback
|
@callback
|
||||||
def async_threshold_sensor_state_listener(entity, old_state,
|
def async_threshold_sensor_state_listener(entity, old_state,
|
||||||
@ -214,7 +211,6 @@ class BayesianBinarySensor(BinarySensorDevice):
|
|||||||
ATTR_PROBABILITY_THRESHOLD: self._probability_threshold,
|
ATTR_PROBABILITY_THRESHOLD: self._probability_threshold,
|
||||||
}
|
}
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_update(self):
|
||||||
def async_update(self):
|
|
||||||
"""Get the latest data and update the states."""
|
"""Get the latest data and update the states."""
|
||||||
self._deviation = bool(self.probability >= self._probability_threshold)
|
self._deviation = bool(self.probability >= self._probability_threshold)
|
||||||
|
@ -4,7 +4,6 @@ Reads vehicle status from BMW connected drive portal.
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/binary_sensor.bmw_connected_drive/
|
https://home-assistant.io/components/binary_sensor.bmw_connected_drive/
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import BinarySensorDevice
|
from homeassistant.components.binary_sensor import BinarySensorDevice
|
||||||
@ -193,8 +192,7 @@ class BMWConnectedDriveSensor(BinarySensorDevice):
|
|||||||
"""Schedule a state update."""
|
"""Schedule a state update."""
|
||||||
self.schedule_update_ha_state(True)
|
self.schedule_update_ha_state(True)
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_added_to_hass(self):
|
||||||
def async_added_to_hass(self):
|
|
||||||
"""Add callback after being added to hass.
|
"""Add callback after being added to hass.
|
||||||
|
|
||||||
Show latest data after startup.
|
Show latest data after startup.
|
||||||
|
@ -4,7 +4,6 @@ Interfaces with Egardia/Woonveilig alarm control panel.
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/binary_sensor.egardia/
|
https://home-assistant.io/components/binary_sensor.egardia/
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import BinarySensorDevice
|
from homeassistant.components.binary_sensor import BinarySensorDevice
|
||||||
@ -18,9 +17,8 @@ EGARDIA_TYPE_TO_DEVICE_CLASS = {'IR Sensor': 'motion',
|
|||||||
'IR': 'motion'}
|
'IR': 'motion'}
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_setup_platform(hass, config, async_add_entities,
|
||||||
def async_setup_platform(hass, config, async_add_entities,
|
discovery_info=None):
|
||||||
discovery_info=None):
|
|
||||||
"""Initialize the platform."""
|
"""Initialize the platform."""
|
||||||
if (discovery_info is None or
|
if (discovery_info is None or
|
||||||
discovery_info[ATTR_DISCOVER_DEVICES] is None):
|
discovery_info[ATTR_DISCOVER_DEVICES] is None):
|
||||||
|
@ -4,7 +4,6 @@ Support for Envisalink zone states- represented as binary sensors.
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/binary_sensor.envisalink/
|
https://home-assistant.io/components/binary_sensor.envisalink/
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
@ -22,9 +21,8 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
DEPENDENCIES = ['envisalink']
|
DEPENDENCIES = ['envisalink']
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_setup_platform(hass, config, async_add_entities,
|
||||||
def async_setup_platform(hass, config, async_add_entities,
|
discovery_info=None):
|
||||||
discovery_info=None):
|
|
||||||
"""Set up the Envisalink binary sensor devices."""
|
"""Set up the Envisalink binary sensor devices."""
|
||||||
configured_zones = discovery_info['zones']
|
configured_zones = discovery_info['zones']
|
||||||
|
|
||||||
@ -56,8 +54,7 @@ class EnvisalinkBinarySensor(EnvisalinkDevice, BinarySensorDevice):
|
|||||||
_LOGGER.debug('Setting up zone: %s', zone_name)
|
_LOGGER.debug('Setting up zone: %s', zone_name)
|
||||||
super().__init__(zone_name, info, controller)
|
super().__init__(zone_name, info, controller)
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_added_to_hass(self):
|
||||||
def async_added_to_hass(self):
|
|
||||||
"""Register callbacks."""
|
"""Register callbacks."""
|
||||||
async_dispatcher_connect(
|
async_dispatcher_connect(
|
||||||
self.hass, SIGNAL_ZONE_UPDATE, self._update_callback)
|
self.hass, SIGNAL_ZONE_UPDATE, self._update_callback)
|
||||||
|
@ -4,7 +4,6 @@ Provides a binary sensor which is a collection of ffmpeg tools.
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/binary_sensor.ffmpeg_motion/
|
https://home-assistant.io/components/binary_sensor.ffmpeg_motion/
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
@ -46,9 +45,8 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_setup_platform(hass, config, async_add_entities,
|
||||||
def async_setup_platform(hass, config, async_add_entities,
|
discovery_info=None):
|
||||||
discovery_info=None):
|
|
||||||
"""Set up the FFmpeg binary motion sensor."""
|
"""Set up the FFmpeg binary motion sensor."""
|
||||||
manager = hass.data[DATA_FFMPEG]
|
manager = hass.data[DATA_FFMPEG]
|
||||||
|
|
||||||
@ -98,8 +96,7 @@ class FFmpegMotion(FFmpegBinarySensor):
|
|||||||
self.ffmpeg = SensorMotion(
|
self.ffmpeg = SensorMotion(
|
||||||
manager.binary, hass.loop, self._async_callback)
|
manager.binary, hass.loop, self._async_callback)
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def _async_start_ffmpeg(self, entity_ids):
|
||||||
def _async_start_ffmpeg(self, entity_ids):
|
|
||||||
"""Start a FFmpeg instance.
|
"""Start a FFmpeg instance.
|
||||||
|
|
||||||
This method is a coroutine.
|
This method is a coroutine.
|
||||||
@ -116,7 +113,7 @@ class FFmpegMotion(FFmpegBinarySensor):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# run
|
# run
|
||||||
yield from self.ffmpeg.open_sensor(
|
await self.ffmpeg.open_sensor(
|
||||||
input_source=self._config.get(CONF_INPUT),
|
input_source=self._config.get(CONF_INPUT),
|
||||||
extra_cmd=self._config.get(CONF_EXTRA_ARGUMENTS),
|
extra_cmd=self._config.get(CONF_EXTRA_ARGUMENTS),
|
||||||
)
|
)
|
||||||
|
@ -4,7 +4,6 @@ Provides a binary sensor which is a collection of ffmpeg tools.
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/binary_sensor.ffmpeg_noise/
|
https://home-assistant.io/components/binary_sensor.ffmpeg_noise/
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
@ -43,9 +42,8 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_setup_platform(hass, config, async_add_entities,
|
||||||
def async_setup_platform(hass, config, async_add_entities,
|
discovery_info=None):
|
||||||
discovery_info=None):
|
|
||||||
"""Set up the FFmpeg noise binary sensor."""
|
"""Set up the FFmpeg noise binary sensor."""
|
||||||
manager = hass.data[DATA_FFMPEG]
|
manager = hass.data[DATA_FFMPEG]
|
||||||
|
|
||||||
@ -67,8 +65,7 @@ class FFmpegNoise(FFmpegBinarySensor):
|
|||||||
self.ffmpeg = SensorNoise(
|
self.ffmpeg = SensorNoise(
|
||||||
manager.binary, hass.loop, self._async_callback)
|
manager.binary, hass.loop, self._async_callback)
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def _async_start_ffmpeg(self, entity_ids):
|
||||||
def _async_start_ffmpeg(self, entity_ids):
|
|
||||||
"""Start a FFmpeg instance.
|
"""Start a FFmpeg instance.
|
||||||
|
|
||||||
This method is a coroutine.
|
This method is a coroutine.
|
||||||
@ -82,7 +79,7 @@ class FFmpegNoise(FFmpegBinarySensor):
|
|||||||
peak=self._config.get(CONF_PEAK),
|
peak=self._config.get(CONF_PEAK),
|
||||||
)
|
)
|
||||||
|
|
||||||
yield from self.ffmpeg.open_sensor(
|
await self.ffmpeg.open_sensor(
|
||||||
input_source=self._config.get(CONF_INPUT),
|
input_source=self._config.get(CONF_INPUT),
|
||||||
output_dest=self._config.get(CONF_OUTPUT),
|
output_dest=self._config.get(CONF_OUTPUT),
|
||||||
extra_cmd=self._config.get(CONF_EXTRA_ARGUMENTS),
|
extra_cmd=self._config.get(CONF_EXTRA_ARGUMENTS),
|
||||||
|
@ -4,7 +4,6 @@ Support for INSTEON dimmers via PowerLinc Modem.
|
|||||||
For more details about this component, please refer to the documentation at
|
For more details about this component, please refer to the documentation at
|
||||||
https://home-assistant.io/components/binary_sensor.insteon/
|
https://home-assistant.io/components/binary_sensor.insteon/
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import BinarySensorDevice
|
from homeassistant.components.binary_sensor import BinarySensorDevice
|
||||||
@ -22,9 +21,8 @@ SENSOR_TYPES = {'openClosedSensor': 'opening',
|
|||||||
'batterySensor': 'battery'}
|
'batterySensor': 'battery'}
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_setup_platform(hass, config, async_add_entities,
|
||||||
def async_setup_platform(hass, config, async_add_entities,
|
discovery_info=None):
|
||||||
discovery_info=None):
|
|
||||||
"""Set up the INSTEON device class for the hass platform."""
|
"""Set up the INSTEON device class for the hass platform."""
|
||||||
insteon_modem = hass.data['insteon'].get('modem')
|
insteon_modem = hass.data['insteon'].get('modem')
|
||||||
|
|
||||||
|
@ -4,8 +4,6 @@ Support for ISY994 binary sensors.
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/binary_sensor.isy994/
|
https://home-assistant.io/components/binary_sensor.isy994/
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from typing import Callable
|
from typing import Callable
|
||||||
@ -121,10 +119,9 @@ class ISYBinarySensorDevice(ISYDevice, BinarySensorDevice):
|
|||||||
self._computed_state = bool(self._node.status._val)
|
self._computed_state = bool(self._node.status._val)
|
||||||
self._status_was_unknown = False
|
self._status_was_unknown = False
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_added_to_hass(self) -> None:
|
||||||
def async_added_to_hass(self) -> None:
|
|
||||||
"""Subscribe to the node and subnode event emitters."""
|
"""Subscribe to the node and subnode event emitters."""
|
||||||
yield from super().async_added_to_hass()
|
await super().async_added_to_hass()
|
||||||
|
|
||||||
self._node.controlEvents.subscribe(self._positive_node_control_handler)
|
self._node.controlEvents.subscribe(self._positive_node_control_handler)
|
||||||
|
|
||||||
@ -261,10 +258,9 @@ class ISYBinarySensorHeartbeat(ISYDevice, BinarySensorDevice):
|
|||||||
self._parent_device = parent_device
|
self._parent_device = parent_device
|
||||||
self._heartbeat_timer = None
|
self._heartbeat_timer = None
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_added_to_hass(self) -> None:
|
||||||
def async_added_to_hass(self) -> None:
|
|
||||||
"""Subscribe to the node and subnode event emitters."""
|
"""Subscribe to the node and subnode event emitters."""
|
||||||
yield from super().async_added_to_hass()
|
await super().async_added_to_hass()
|
||||||
|
|
||||||
self._node.controlEvents.subscribe(
|
self._node.controlEvents.subscribe(
|
||||||
self._heartbeat_node_control_handler)
|
self._heartbeat_node_control_handler)
|
||||||
|
@ -4,7 +4,6 @@ Support for MQTT binary sensors.
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/binary_sensor.mqtt/
|
https://home-assistant.io/components/binary_sensor.mqtt/
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
@ -115,11 +114,10 @@ class MqttBinarySensor(MqttAvailability, MqttDiscoveryUpdate,
|
|||||||
self._unique_id = unique_id
|
self._unique_id = unique_id
|
||||||
self._discovery_hash = discovery_hash
|
self._discovery_hash = discovery_hash
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_added_to_hass(self):
|
||||||
def async_added_to_hass(self):
|
|
||||||
"""Subscribe mqtt events."""
|
"""Subscribe mqtt events."""
|
||||||
yield from MqttAvailability.async_added_to_hass(self)
|
await MqttAvailability.async_added_to_hass(self)
|
||||||
yield from MqttDiscoveryUpdate.async_added_to_hass(self)
|
await MqttDiscoveryUpdate.async_added_to_hass(self)
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def state_message_received(topic, payload, qos):
|
def state_message_received(topic, payload, qos):
|
||||||
@ -139,7 +137,7 @@ class MqttBinarySensor(MqttAvailability, MqttDiscoveryUpdate,
|
|||||||
|
|
||||||
self.async_schedule_update_ha_state()
|
self.async_schedule_update_ha_state()
|
||||||
|
|
||||||
yield from mqtt.async_subscribe(
|
await mqtt.async_subscribe(
|
||||||
self.hass, self._state_topic, state_message_received, self._qos)
|
self.hass, self._state_topic, state_message_received, self._qos)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/binary_sensor.mychevy/
|
https://home-assistant.io/components/binary_sensor.mychevy/
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.components.mychevy import (
|
from homeassistant.components.mychevy import (
|
||||||
@ -22,9 +20,8 @@ SENSORS = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_setup_platform(hass, config, async_add_entities,
|
||||||
def async_setup_platform(hass, config, async_add_entities,
|
discovery_info=None):
|
||||||
discovery_info=None):
|
|
||||||
"""Set up the MyChevy sensors."""
|
"""Set up the MyChevy sensors."""
|
||||||
if discovery_info is None:
|
if discovery_info is None:
|
||||||
return
|
return
|
||||||
@ -75,8 +72,7 @@ class EVBinarySensor(BinarySensorDevice):
|
|||||||
"""Return the car."""
|
"""Return the car."""
|
||||||
return self._conn.get_car(self._car_vid)
|
return self._conn.get_car(self._car_vid)
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_added_to_hass(self):
|
||||||
def async_added_to_hass(self):
|
|
||||||
"""Register callbacks."""
|
"""Register callbacks."""
|
||||||
self.hass.helpers.dispatcher.async_dispatcher_connect(
|
self.hass.helpers.dispatcher.async_dispatcher_connect(
|
||||||
UPDATE_TOPIC, self.async_update_callback)
|
UPDATE_TOPIC, self.async_update_callback)
|
||||||
|
@ -4,7 +4,6 @@ Support for the myStrom buttons.
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/binary_sensor.mystrom/
|
https://home-assistant.io/components/binary_sensor.mystrom/
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import DOMAIN, BinarySensorDevice
|
from homeassistant.components.binary_sensor import DOMAIN, BinarySensorDevice
|
||||||
@ -16,9 +15,8 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
DEPENDENCIES = ['http']
|
DEPENDENCIES = ['http']
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_setup_platform(hass, config, async_add_entities,
|
||||||
def async_setup_platform(hass, config, async_add_entities,
|
discovery_info=None):
|
||||||
discovery_info=None):
|
|
||||||
"""Set up myStrom Binary Sensor."""
|
"""Set up myStrom Binary Sensor."""
|
||||||
hass.http.register_view(MyStromView(async_add_entities))
|
hass.http.register_view(MyStromView(async_add_entities))
|
||||||
|
|
||||||
@ -37,14 +35,12 @@ class MyStromView(HomeAssistantView):
|
|||||||
self.buttons = {}
|
self.buttons = {}
|
||||||
self.add_entities = add_entities
|
self.add_entities = add_entities
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def get(self, request):
|
||||||
def get(self, request):
|
|
||||||
"""Handle the GET request received from a myStrom button."""
|
"""Handle the GET request received from a myStrom button."""
|
||||||
res = yield from self._handle(request.app['hass'], request.query)
|
res = await self._handle(request.app['hass'], request.query)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def _handle(self, hass, data):
|
||||||
def _handle(self, hass, data):
|
|
||||||
"""Handle requests to the myStrom endpoint."""
|
"""Handle requests to the myStrom endpoint."""
|
||||||
button_action = next((
|
button_action = next((
|
||||||
parameter for parameter in data
|
parameter for parameter in data
|
||||||
|
@ -4,7 +4,6 @@ Support for Satel Integra zone states- represented as binary sensors.
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/binary_sensor.satel_integra/
|
https://home-assistant.io/components/binary_sensor.satel_integra/
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import BinarySensorDevice
|
from homeassistant.components.binary_sensor import BinarySensorDevice
|
||||||
@ -20,9 +19,8 @@ DEPENDENCIES = ['satel_integra']
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_setup_platform(hass, config, async_add_entities,
|
||||||
def async_setup_platform(hass, config, async_add_entities,
|
discovery_info=None):
|
||||||
discovery_info=None):
|
|
||||||
"""Set up the Satel Integra binary sensor devices."""
|
"""Set up the Satel Integra binary sensor devices."""
|
||||||
if not discovery_info:
|
if not discovery_info:
|
||||||
return
|
return
|
||||||
@ -50,8 +48,7 @@ class SatelIntegraBinarySensor(BinarySensorDevice):
|
|||||||
self._zone_type = zone_type
|
self._zone_type = zone_type
|
||||||
self._state = 0
|
self._state = 0
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_added_to_hass(self):
|
||||||
def async_added_to_hass(self):
|
|
||||||
"""Register callbacks."""
|
"""Register callbacks."""
|
||||||
async_dispatcher_connect(
|
async_dispatcher_connect(
|
||||||
self.hass, SIGNAL_ZONES_UPDATED, self._zones_updated)
|
self.hass, SIGNAL_ZONES_UPDATED, self._zones_updated)
|
||||||
|
@ -4,7 +4,6 @@ Support for exposing a templated binary sensor.
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/binary_sensor.template/
|
https://home-assistant.io/components/binary_sensor.template/
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
@ -46,9 +45,8 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_setup_platform(hass, config, async_add_entities,
|
||||||
def async_setup_platform(hass, config, async_add_entities,
|
discovery_info=None):
|
||||||
discovery_info=None):
|
|
||||||
"""Set up template binary sensors."""
|
"""Set up template binary sensors."""
|
||||||
sensors = []
|
sensors = []
|
||||||
|
|
||||||
@ -109,8 +107,7 @@ class BinarySensorTemplate(BinarySensorDevice):
|
|||||||
self._delay_on = delay_on
|
self._delay_on = delay_on
|
||||||
self._delay_off = delay_off
|
self._delay_off = delay_off
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_added_to_hass(self):
|
||||||
def async_added_to_hass(self):
|
|
||||||
"""Register callbacks."""
|
"""Register callbacks."""
|
||||||
@callback
|
@callback
|
||||||
def template_bsensor_state_listener(entity, old_state, new_state):
|
def template_bsensor_state_listener(entity, old_state, new_state):
|
||||||
|
@ -4,7 +4,6 @@ Support for monitoring if a sensor value is below/above a threshold.
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/sensor.threshold/
|
https://home-assistant.io/components/sensor.threshold/
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
@ -54,9 +53,8 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_setup_platform(hass, config, async_add_entities,
|
||||||
def async_setup_platform(hass, config, async_add_entities,
|
discovery_info=None):
|
||||||
discovery_info=None):
|
|
||||||
"""Set up the Threshold sensor."""
|
"""Set up the Threshold sensor."""
|
||||||
entity_id = config.get(CONF_ENTITY_ID)
|
entity_id = config.get(CONF_ENTITY_ID)
|
||||||
name = config.get(CONF_NAME)
|
name = config.get(CONF_NAME)
|
||||||
@ -147,8 +145,7 @@ class ThresholdSensor(BinarySensorDevice):
|
|||||||
ATTR_UPPER: self._threshold_upper,
|
ATTR_UPPER: self._threshold_upper,
|
||||||
}
|
}
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_update(self):
|
||||||
def async_update(self):
|
|
||||||
"""Get the latest data and updates the states."""
|
"""Get the latest data and updates the states."""
|
||||||
def below(threshold):
|
def below(threshold):
|
||||||
"""Determine if the sensor value is below a threshold."""
|
"""Determine if the sensor value is below a threshold."""
|
||||||
|
@ -4,7 +4,6 @@ A sensor that monitors trends in other components.
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/sensor.trend/
|
https://home-assistant.io/components/sensor.trend/
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
from collections import deque
|
from collections import deque
|
||||||
import logging
|
import logging
|
||||||
import math
|
import math
|
||||||
@ -138,8 +137,7 @@ class SensorTrend(BinarySensorDevice):
|
|||||||
"""No polling needed."""
|
"""No polling needed."""
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_added_to_hass(self):
|
||||||
def async_added_to_hass(self):
|
|
||||||
"""Complete device setup after being added to hass."""
|
"""Complete device setup after being added to hass."""
|
||||||
@callback
|
@callback
|
||||||
def trend_sensor_state_listener(entity, old_state, new_state):
|
def trend_sensor_state_listener(entity, old_state, new_state):
|
||||||
@ -160,8 +158,7 @@ class SensorTrend(BinarySensorDevice):
|
|||||||
self.hass, self._entity_id,
|
self.hass, self._entity_id,
|
||||||
trend_sensor_state_listener)
|
trend_sensor_state_listener)
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_update(self):
|
||||||
def async_update(self):
|
|
||||||
"""Get the latest data and update the states."""
|
"""Get the latest data and update the states."""
|
||||||
# Remove outdated samples
|
# Remove outdated samples
|
||||||
if self._sample_duration > 0:
|
if self._sample_duration > 0:
|
||||||
@ -173,7 +170,7 @@ class SensorTrend(BinarySensorDevice):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# Calculate gradient of linear trend
|
# Calculate gradient of linear trend
|
||||||
yield from self.hass.async_add_job(self._calculate_gradient)
|
await self.hass.async_add_job(self._calculate_gradient)
|
||||||
|
|
||||||
# Update state
|
# Update state
|
||||||
self._state = (
|
self._state = (
|
||||||
|
@ -4,7 +4,6 @@ Support for Wink binary sensors.
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
at https://home-assistant.io/components/binary_sensor.wink/
|
at https://home-assistant.io/components/binary_sensor.wink/
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import BinarySensorDevice
|
from homeassistant.components.binary_sensor import BinarySensorDevice
|
||||||
@ -101,8 +100,7 @@ class WinkBinarySensorDevice(WinkDevice, BinarySensorDevice):
|
|||||||
else:
|
else:
|
||||||
self.capability = None
|
self.capability = None
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_added_to_hass(self):
|
||||||
def async_added_to_hass(self):
|
|
||||||
"""Call when entity is added to hass."""
|
"""Call when entity is added to hass."""
|
||||||
self.hass.data[DOMAIN]['entities']['binary_sensor'].append(self)
|
self.hass.data[DOMAIN]['entities']['binary_sensor'].append(self)
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ Sensor to indicate whether the current day is a workday.
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/binary_sensor.workday/
|
https://home-assistant.io/components/binary_sensor.workday/
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
@ -162,8 +161,7 @@ class IsWorkdaySensor(BinarySensorDevice):
|
|||||||
CONF_OFFSET: self._days_offset
|
CONF_OFFSET: self._days_offset
|
||||||
}
|
}
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_update(self):
|
||||||
def async_update(self):
|
|
||||||
"""Get date and look whether it is a holiday."""
|
"""Get date and look whether it is a holiday."""
|
||||||
# Default is no workday
|
# Default is no workday
|
||||||
self._state = False
|
self._state = False
|
||||||
|
Loading…
Reference in New Issue
Block a user