mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
add_devices -> add_entities (#16171)
* add_devices -> add_entities * Lint * PyLint * Revert external method in scsgate
This commit is contained in:
parent
37fd438717
commit
994b829cb4
@ -20,7 +20,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
ICON = 'mdi:security'
|
ICON = 'mdi:security'
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up an alarm control panel for an Abode device."""
|
"""Set up an alarm control panel for an Abode device."""
|
||||||
data = hass.data[ABODE_DOMAIN]
|
data = hass.data[ABODE_DOMAIN]
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
|
|
||||||
data.devices.extend(alarm_devices)
|
data.devices.extend(alarm_devices)
|
||||||
|
|
||||||
add_devices(alarm_devices)
|
add_entities(alarm_devices)
|
||||||
|
|
||||||
|
|
||||||
class AbodeAlarm(AbodeDevice, AlarmControlPanel):
|
class AbodeAlarm(AbodeDevice, AlarmControlPanel):
|
||||||
|
@ -26,10 +26,10 @@ ALARM_TOGGLE_CHIME_SCHEMA = vol.Schema({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up for AlarmDecoder alarm panels."""
|
"""Set up for AlarmDecoder alarm panels."""
|
||||||
device = AlarmDecoderAlarmPanel()
|
device = AlarmDecoderAlarmPanel()
|
||||||
add_devices([device])
|
add_entities([device])
|
||||||
|
|
||||||
def alarm_toggle_chime_handler(service):
|
def alarm_toggle_chime_handler(service):
|
||||||
"""Register toggle chime handler."""
|
"""Register toggle chime handler."""
|
||||||
|
@ -33,7 +33,8 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
def async_setup_platform(hass, config, async_add_entities,
|
||||||
|
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 +43,7 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
|||||||
|
|
||||||
alarmdotcom = AlarmDotCom(hass, name, code, username, password)
|
alarmdotcom = AlarmDotCom(hass, name, code, username, password)
|
||||||
yield from alarmdotcom.async_login()
|
yield from alarmdotcom.async_login()
|
||||||
async_add_devices([alarmdotcom])
|
async_add_entities([alarmdotcom])
|
||||||
|
|
||||||
|
|
||||||
class AlarmDotCom(alarm.AlarmControlPanel):
|
class AlarmDotCom(alarm.AlarmControlPanel):
|
||||||
|
@ -38,7 +38,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the Arlo Alarm Control Panels."""
|
"""Set up the Arlo Alarm Control Panels."""
|
||||||
arlo = hass.data[DATA_ARLO]
|
arlo = hass.data[DATA_ARLO]
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
for base_station in arlo.base_stations:
|
for base_station in arlo.base_stations:
|
||||||
base_stations.append(ArloBaseStation(base_station, home_mode_name,
|
base_stations.append(ArloBaseStation(base_station, home_mode_name,
|
||||||
away_mode_name))
|
away_mode_name))
|
||||||
add_devices(base_stations, True)
|
add_entities(base_stations, True)
|
||||||
|
|
||||||
|
|
||||||
class ArloBaseStation(AlarmControlPanel):
|
class ArloBaseStation(AlarmControlPanel):
|
||||||
|
@ -16,7 +16,7 @@ DEPENDENCIES = ['canary']
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the Canary alarms."""
|
"""Set up the Canary alarms."""
|
||||||
data = hass.data[DATA_CANARY]
|
data = hass.data[DATA_CANARY]
|
||||||
devices = []
|
devices = []
|
||||||
@ -24,7 +24,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
for location in data.locations:
|
for location in data.locations:
|
||||||
devices.append(CanaryAlarm(data, location.location_id))
|
devices.append(CanaryAlarm(data, location.location_id))
|
||||||
|
|
||||||
add_devices(devices, True)
|
add_entities(devices, True)
|
||||||
|
|
||||||
|
|
||||||
class CanaryAlarm(AlarmControlPanel):
|
class CanaryAlarm(AlarmControlPanel):
|
||||||
|
@ -35,7 +35,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the Concord232 alarm control panel platform."""
|
"""Set up the Concord232 alarm control panel platform."""
|
||||||
name = config.get(CONF_NAME)
|
name = config.get(CONF_NAME)
|
||||||
host = config.get(CONF_HOST)
|
host = config.get(CONF_HOST)
|
||||||
@ -44,7 +44,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
url = 'http://{}:{}'.format(host, port)
|
url = 'http://{}:{}'.format(host, port)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
add_devices([Concord232Alarm(hass, url, name)])
|
add_entities([Concord232Alarm(hass, url, name)])
|
||||||
except requests.exceptions.ConnectionError as ex:
|
except requests.exceptions.ConnectionError as ex:
|
||||||
_LOGGER.error("Unable to connect to Concord232: %s", str(ex))
|
_LOGGER.error("Unable to connect to Concord232: %s", str(ex))
|
||||||
return
|
return
|
||||||
|
@ -13,9 +13,9 @@ from homeassistant.const import (
|
|||||||
CONF_PENDING_TIME, CONF_TRIGGER_TIME)
|
CONF_PENDING_TIME, CONF_TRIGGER_TIME)
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the Demo alarm control panel platform."""
|
"""Set up the Demo alarm control panel platform."""
|
||||||
add_devices([
|
add_entities([
|
||||||
manual.ManualAlarm(hass, 'Alarm', '1234', None, False, {
|
manual.ManualAlarm(hass, 'Alarm', '1234', None, False, {
|
||||||
STATE_ALARM_ARMED_AWAY: {
|
STATE_ALARM_ARMED_AWAY: {
|
||||||
CONF_DELAY_TIME: datetime.timedelta(seconds=0),
|
CONF_DELAY_TIME: datetime.timedelta(seconds=0),
|
||||||
|
@ -34,7 +34,7 @@ STATES = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the Egardia platform."""
|
"""Set up the Egardia platform."""
|
||||||
if discovery_info is None:
|
if discovery_info is None:
|
||||||
return
|
return
|
||||||
@ -45,7 +45,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
discovery_info.get(CONF_REPORT_SERVER_CODES),
|
discovery_info.get(CONF_REPORT_SERVER_CODES),
|
||||||
discovery_info[CONF_REPORT_SERVER_PORT])
|
discovery_info[CONF_REPORT_SERVER_PORT])
|
||||||
# add egardia alarm device
|
# add egardia alarm device
|
||||||
add_devices([device], True)
|
add_entities([device], True)
|
||||||
|
|
||||||
|
|
||||||
class EgardiaAlarm(alarm.AlarmControlPanel):
|
class EgardiaAlarm(alarm.AlarmControlPanel):
|
||||||
|
@ -33,7 +33,8 @@ ALARM_KEYPRESS_SCHEMA = vol.Schema({
|
|||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
def async_setup_platform(hass, config, async_add_entities,
|
||||||
|
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]
|
||||||
@ -53,7 +54,7 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
|||||||
)
|
)
|
||||||
devices.append(device)
|
devices.append(device)
|
||||||
|
|
||||||
async_add_devices(devices)
|
async_add_entities(devices)
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def alarm_keypress_handler(service):
|
def alarm_keypress_handler(service):
|
||||||
|
@ -24,12 +24,12 @@ HMIP_ZONE_HOME = 'INTERNAL'
|
|||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(
|
async def async_setup_platform(
|
||||||
hass, config, async_add_devices, discovery_info=None):
|
hass, config, async_add_entities, discovery_info=None):
|
||||||
"""Set up the HomematicIP Cloud alarm control devices."""
|
"""Set up the HomematicIP Cloud alarm control devices."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass, config_entry, async_add_devices):
|
async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||||
"""Set up the HomematicIP alarm control panel from a config entry."""
|
"""Set up the HomematicIP alarm control panel from a config entry."""
|
||||||
from homematicip.aio.group import AsyncSecurityZoneGroup
|
from homematicip.aio.group import AsyncSecurityZoneGroup
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ async def async_setup_entry(hass, config_entry, async_add_devices):
|
|||||||
devices.append(HomematicipSecurityZone(home, group))
|
devices.append(HomematicipSecurityZone(home, group))
|
||||||
|
|
||||||
if devices:
|
if devices:
|
||||||
async_add_devices(devices)
|
async_add_entities(devices)
|
||||||
|
|
||||||
|
|
||||||
class HomematicipSecurityZone(HomematicipGenericDevice, AlarmControlPanel):
|
class HomematicipSecurityZone(HomematicipGenericDevice, AlarmControlPanel):
|
||||||
|
@ -40,7 +40,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up an iAlarm control panel."""
|
"""Set up an iAlarm control panel."""
|
||||||
name = config.get(CONF_NAME)
|
name = config.get(CONF_NAME)
|
||||||
username = config.get(CONF_USERNAME)
|
username = config.get(CONF_USERNAME)
|
||||||
@ -49,7 +49,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
|
|
||||||
url = 'http://{}'.format(host)
|
url = 'http://{}'.format(host)
|
||||||
ialarm = IAlarmPanel(name, username, password, url)
|
ialarm = IAlarmPanel(name, username, password, url)
|
||||||
add_devices([ialarm], True)
|
add_entities([ialarm], True)
|
||||||
|
|
||||||
|
|
||||||
class IAlarmPanel(alarm.AlarmControlPanel):
|
class IAlarmPanel(alarm.AlarmControlPanel):
|
||||||
|
@ -59,7 +59,7 @@ PUSH_ALARM_STATE_SERVICE_SCHEMA = vol.Schema({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up a control panel managed through IFTTT."""
|
"""Set up a control panel managed through IFTTT."""
|
||||||
if DATA_IFTTT_ALARM not in hass.data:
|
if DATA_IFTTT_ALARM not in hass.data:
|
||||||
hass.data[DATA_IFTTT_ALARM] = []
|
hass.data[DATA_IFTTT_ALARM] = []
|
||||||
@ -75,7 +75,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
alarmpanel = IFTTTAlarmPanel(name, code, event_away, event_home,
|
alarmpanel = IFTTTAlarmPanel(name, code, event_away, event_home,
|
||||||
event_night, event_disarm, optimistic)
|
event_night, event_disarm, optimistic)
|
||||||
hass.data[DATA_IFTTT_ALARM].append(alarmpanel)
|
hass.data[DATA_IFTTT_ALARM].append(alarmpanel)
|
||||||
add_devices([alarmpanel])
|
add_entities([alarmpanel])
|
||||||
|
|
||||||
async def push_state_update(service):
|
async def push_state_update(service):
|
||||||
"""Set the service state as device state attribute."""
|
"""Set the service state as device state attribute."""
|
||||||
|
@ -103,9 +103,9 @@ PLATFORM_SCHEMA = vol.Schema(vol.All({
|
|||||||
}, _state_validator))
|
}, _state_validator))
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the manual alarm platform."""
|
"""Set up the manual alarm platform."""
|
||||||
add_devices([ManualAlarm(
|
add_entities([ManualAlarm(
|
||||||
hass,
|
hass,
|
||||||
config[CONF_NAME],
|
config[CONF_NAME],
|
||||||
config.get(CONF_CODE),
|
config.get(CONF_CODE),
|
||||||
|
@ -123,9 +123,9 @@ PLATFORM_SCHEMA = vol.Schema(vol.All(mqtt.MQTT_BASE_PLATFORM_SCHEMA.extend({
|
|||||||
}), _state_validator))
|
}), _state_validator))
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the manual MQTT alarm platform."""
|
"""Set up the manual MQTT alarm platform."""
|
||||||
add_devices([ManualMQTTAlarm(
|
add_entities([ManualMQTTAlarm(
|
||||||
hass,
|
hass,
|
||||||
config[CONF_NAME],
|
config[CONF_NAME],
|
||||||
config.get(CONF_CODE),
|
config.get(CONF_CODE),
|
||||||
|
@ -47,12 +47,13 @@ PLATFORM_SCHEMA = mqtt.MQTT_BASE_PLATFORM_SCHEMA.extend({
|
|||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
def async_setup_platform(hass, config, async_add_entities,
|
||||||
|
discovery_info=None):
|
||||||
"""Set up the MQTT Alarm Control Panel platform."""
|
"""Set up the MQTT Alarm Control Panel platform."""
|
||||||
if discovery_info is not None:
|
if discovery_info is not None:
|
||||||
config = PLATFORM_SCHEMA(discovery_info)
|
config = PLATFORM_SCHEMA(discovery_info)
|
||||||
|
|
||||||
async_add_devices([MqttAlarm(
|
async_add_entities([MqttAlarm(
|
||||||
config.get(CONF_NAME),
|
config.get(CONF_NAME),
|
||||||
config.get(CONF_STATE_TOPIC),
|
config.get(CONF_STATE_TOPIC),
|
||||||
config.get(CONF_COMMAND_TOPIC),
|
config.get(CONF_COMMAND_TOPIC),
|
||||||
|
@ -31,7 +31,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the NX584 platform."""
|
"""Set up the NX584 platform."""
|
||||||
name = config.get(CONF_NAME)
|
name = config.get(CONF_NAME)
|
||||||
host = config.get(CONF_HOST)
|
host = config.get(CONF_HOST)
|
||||||
@ -40,7 +40,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
url = 'http://{}:{}'.format(host, port)
|
url = 'http://{}:{}'.format(host, port)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
add_devices([NX584Alarm(hass, url, name)])
|
add_entities([NX584Alarm(hass, url, name)])
|
||||||
except requests.exceptions.ConnectionError as ex:
|
except requests.exceptions.ConnectionError as ex:
|
||||||
_LOGGER.error("Unable to connect to NX584: %s", str(ex))
|
_LOGGER.error("Unable to connect to NX584: %s", str(ex))
|
||||||
return False
|
return False
|
||||||
|
@ -19,14 +19,15 @@ DEPENDENCIES = ['satel_integra']
|
|||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
def async_setup_platform(hass, config, async_add_entities,
|
||||||
|
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
|
||||||
|
|
||||||
device = SatelIntegraAlarmPanel(
|
device = SatelIntegraAlarmPanel(
|
||||||
"Alarm Panel", discovery_info.get(CONF_ARM_HOME_MODE))
|
"Alarm Panel", discovery_info.get(CONF_ARM_HOME_MODE))
|
||||||
async_add_devices([device])
|
async_add_entities([device])
|
||||||
|
|
||||||
|
|
||||||
class SatelIntegraAlarmPanel(alarm.AlarmControlPanel):
|
class SatelIntegraAlarmPanel(alarm.AlarmControlPanel):
|
||||||
|
@ -34,7 +34,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the SimpliSafe platform."""
|
"""Set up the SimpliSafe platform."""
|
||||||
from simplipy.api import SimpliSafeApiInterface, SimpliSafeAPIException
|
from simplipy.api import SimpliSafeApiInterface, SimpliSafeAPIException
|
||||||
name = config.get(CONF_NAME)
|
name = config.get(CONF_NAME)
|
||||||
@ -53,7 +53,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
for system in simplisafe.get_systems():
|
for system in simplisafe.get_systems():
|
||||||
systems.append(SimpliSafeAlarm(system, name, code))
|
systems.append(SimpliSafeAlarm(system, name, code))
|
||||||
|
|
||||||
add_devices(systems)
|
add_entities(systems)
|
||||||
|
|
||||||
|
|
||||||
class SimpliSafeAlarm(AlarmControlPanel):
|
class SimpliSafeAlarm(AlarmControlPanel):
|
||||||
|
@ -29,7 +29,8 @@ def _get_alarm_state(spc_mode):
|
|||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
def async_setup_platform(hass, config, async_add_entities,
|
||||||
|
discovery_info=None):
|
||||||
"""Set up the SPC alarm control panel platform."""
|
"""Set up the SPC alarm control panel platform."""
|
||||||
if (discovery_info is None or
|
if (discovery_info is None or
|
||||||
discovery_info[ATTR_DISCOVER_AREAS] is None):
|
discovery_info[ATTR_DISCOVER_AREAS] is None):
|
||||||
@ -39,7 +40,7 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
|||||||
devices = [SpcAlarm(api, area)
|
devices = [SpcAlarm(api, area)
|
||||||
for area in discovery_info[ATTR_DISCOVER_AREAS]]
|
for area in discovery_info[ATTR_DISCOVER_AREAS]]
|
||||||
|
|
||||||
async_add_devices(devices)
|
async_add_entities(devices)
|
||||||
|
|
||||||
|
|
||||||
class SpcAlarm(alarm.AlarmControlPanel):
|
class SpcAlarm(alarm.AlarmControlPanel):
|
||||||
|
@ -31,14 +31,14 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up a TotalConnect control panel."""
|
"""Set up a TotalConnect control panel."""
|
||||||
name = config.get(CONF_NAME)
|
name = config.get(CONF_NAME)
|
||||||
username = config.get(CONF_USERNAME)
|
username = config.get(CONF_USERNAME)
|
||||||
password = config.get(CONF_PASSWORD)
|
password = config.get(CONF_PASSWORD)
|
||||||
|
|
||||||
total_connect = TotalConnect(name, username, password)
|
total_connect = TotalConnect(name, username, password)
|
||||||
add_devices([total_connect], True)
|
add_entities([total_connect], True)
|
||||||
|
|
||||||
|
|
||||||
class TotalConnect(alarm.AlarmControlPanel):
|
class TotalConnect(alarm.AlarmControlPanel):
|
||||||
|
@ -17,13 +17,13 @@ from homeassistant.const import (
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the Verisure platform."""
|
"""Set up the Verisure platform."""
|
||||||
alarms = []
|
alarms = []
|
||||||
if int(hub.config.get(CONF_ALARM, 1)):
|
if int(hub.config.get(CONF_ALARM, 1)):
|
||||||
hub.update_overview()
|
hub.update_overview()
|
||||||
alarms.append(VerisureAlarm())
|
alarms.append(VerisureAlarm())
|
||||||
add_devices(alarms)
|
add_entities(alarms)
|
||||||
|
|
||||||
|
|
||||||
def set_arm_state(state, code=None):
|
def set_arm_state(state, code=None):
|
||||||
|
@ -20,7 +20,7 @@ DEPENDENCIES = ['wink']
|
|||||||
STATE_ALARM_PRIVACY = 'Private'
|
STATE_ALARM_PRIVACY = 'Private'
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the Wink platform."""
|
"""Set up the Wink platform."""
|
||||||
import pywink
|
import pywink
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
except AttributeError:
|
except AttributeError:
|
||||||
_id = camera.object_id() + camera.name()
|
_id = camera.object_id() + camera.name()
|
||||||
if _id not in hass.data[DOMAIN]['unique_ids']:
|
if _id not in hass.data[DOMAIN]['unique_ids']:
|
||||||
add_devices([WinkCameraDevice(camera, hass)])
|
add_entities([WinkCameraDevice(camera, hass)])
|
||||||
|
|
||||||
|
|
||||||
class WinkCameraDevice(WinkDevice, alarm.AlarmControlPanel):
|
class WinkCameraDevice(WinkDevice, alarm.AlarmControlPanel):
|
||||||
|
@ -16,7 +16,7 @@ DEPENDENCIES = ['abode']
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up a sensor for an Abode device."""
|
"""Set up a sensor for an Abode device."""
|
||||||
import abodepy.helpers.constants as CONST
|
import abodepy.helpers.constants as CONST
|
||||||
import abodepy.helpers.timeline as TIMELINE
|
import abodepy.helpers.timeline as TIMELINE
|
||||||
@ -44,7 +44,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
|
|
||||||
data.devices.extend(devices)
|
data.devices.extend(devices)
|
||||||
|
|
||||||
add_devices(devices)
|
add_entities(devices)
|
||||||
|
|
||||||
|
|
||||||
class AbodeBinarySensor(AbodeDevice, BinarySensorDevice):
|
class AbodeBinarySensor(AbodeDevice, BinarySensorDevice):
|
||||||
|
@ -27,7 +27,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the Binary Sensor platform for ADS."""
|
"""Set up the Binary Sensor platform for ADS."""
|
||||||
ads_hub = hass.data.get(DATA_ADS)
|
ads_hub = hass.data.get(DATA_ADS)
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
device_class = config.get(CONF_DEVICE_CLASS)
|
device_class = config.get(CONF_DEVICE_CLASS)
|
||||||
|
|
||||||
ads_sensor = AdsBinarySensor(ads_hub, name, ads_var, device_class)
|
ads_sensor = AdsBinarySensor(ads_hub, name, ads_var, device_class)
|
||||||
add_devices([ads_sensor])
|
add_entities([ads_sensor])
|
||||||
|
|
||||||
|
|
||||||
class AdsBinarySensor(BinarySensorDevice):
|
class AdsBinarySensor(BinarySensorDevice):
|
||||||
|
@ -28,7 +28,7 @@ ATTR_RF_LOOP4 = 'rf_loop4'
|
|||||||
ATTR_RF_LOOP1 = 'rf_loop1'
|
ATTR_RF_LOOP1 = 'rf_loop1'
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the AlarmDecoder binary sensor devices."""
|
"""Set up the AlarmDecoder binary sensor devices."""
|
||||||
configured_zones = discovery_info[CONF_ZONES]
|
configured_zones = discovery_info[CONF_ZONES]
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
zone_num, zone_name, zone_type, zone_rfid, relay_addr, relay_chan)
|
zone_num, zone_name, zone_type, zone_rfid, relay_addr, relay_chan)
|
||||||
devices.append(device)
|
devices.append(device)
|
||||||
|
|
||||||
add_devices(devices)
|
add_entities(devices)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -14,7 +14,8 @@ DEPENDENCIES = ['android_ip_webcam']
|
|||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
def async_setup_platform(hass, config, async_add_entities,
|
||||||
|
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
|
||||||
@ -23,7 +24,7 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
|||||||
name = discovery_info[CONF_NAME]
|
name = discovery_info[CONF_NAME]
|
||||||
ipcam = hass.data[DATA_IP_WEBCAM][host]
|
ipcam = hass.data[DATA_IP_WEBCAM][host]
|
||||||
|
|
||||||
async_add_devices(
|
async_add_entities(
|
||||||
[IPWebcamBinarySensor(name, host, ipcam, 'motion_active')], True)
|
[IPWebcamBinarySensor(name, host, ipcam, 'motion_active')], True)
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,9 +20,9 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up an APCUPSd Online Status binary sensor."""
|
"""Set up an APCUPSd Online Status binary sensor."""
|
||||||
add_devices([OnlineStatus(config, apcupsd.DATA)], True)
|
add_entities([OnlineStatus(config, apcupsd.DATA)], True)
|
||||||
|
|
||||||
|
|
||||||
class OnlineStatus(BinarySensorDevice):
|
class OnlineStatus(BinarySensorDevice):
|
||||||
|
@ -29,7 +29,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the aREST binary sensor."""
|
"""Set up the aREST binary sensor."""
|
||||||
resource = config.get(CONF_RESOURCE)
|
resource = config.get(CONF_RESOURCE)
|
||||||
pin = config.get(CONF_PIN)
|
pin = config.get(CONF_PIN)
|
||||||
@ -47,7 +47,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
|
|
||||||
arest = ArestData(resource, pin)
|
arest = ArestData(resource, pin)
|
||||||
|
|
||||||
add_devices([ArestBinarySensor(
|
add_entities([ArestBinarySensor(
|
||||||
arest, resource, config.get(CONF_NAME, response[CONF_NAME]),
|
arest, resource, config.get(CONF_NAME, response[CONF_NAME]),
|
||||||
device_class, pin)], True)
|
device_class, pin)], True)
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ SENSOR_TYPES = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the August binary sensors."""
|
"""Set up the August binary sensors."""
|
||||||
data = hass.data[DATA_AUGUST]
|
data = hass.data[DATA_AUGUST]
|
||||||
devices = []
|
devices = []
|
||||||
@ -62,7 +62,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
for sensor_type in SENSOR_TYPES:
|
for sensor_type in SENSOR_TYPES:
|
||||||
devices.append(AugustBinarySensor(data, sensor_type, doorbell))
|
devices.append(AugustBinarySensor(data, sensor_type, doorbell))
|
||||||
|
|
||||||
add_devices(devices, True)
|
add_entities(devices, True)
|
||||||
|
|
||||||
|
|
||||||
class AugustBinarySensor(BinarySensorDevice):
|
class AugustBinarySensor(BinarySensorDevice):
|
||||||
|
@ -39,7 +39,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the aurora sensor."""
|
"""Set up the aurora sensor."""
|
||||||
if None in (hass.config.latitude, hass.config.longitude):
|
if None in (hass.config.latitude, hass.config.longitude):
|
||||||
_LOGGER.error("Lat. or long. not set in Home Assistant config")
|
_LOGGER.error("Lat. or long. not set in Home Assistant config")
|
||||||
@ -57,7 +57,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
"Connection to aurora forecast service failed: %s", error)
|
"Connection to aurora forecast service failed: %s", error)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
add_devices([AuroraSensor(aurora_data, name)], True)
|
add_entities([AuroraSensor(aurora_data, name)], True)
|
||||||
|
|
||||||
|
|
||||||
class AuroraSensor(BinarySensorDevice):
|
class AuroraSensor(BinarySensorDevice):
|
||||||
|
@ -18,9 +18,9 @@ DEPENDENCIES = ['axis']
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the Axis binary devices."""
|
"""Set up the Axis binary devices."""
|
||||||
add_devices([AxisBinarySensor(hass, discovery_info)], True)
|
add_entities([AxisBinarySensor(hass, discovery_info)], True)
|
||||||
|
|
||||||
|
|
||||||
class AxisBinarySensor(AxisDeviceEvent, BinarySensorDevice):
|
class AxisBinarySensor(AxisDeviceEvent, BinarySensorDevice):
|
||||||
|
@ -75,7 +75,8 @@ def update_probability(prior, prob_true, prob_false):
|
|||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
def async_setup_platform(hass, config, async_add_entities,
|
||||||
|
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)
|
||||||
@ -83,7 +84,7 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
|||||||
probability_threshold = config.get(CONF_PROBABILITY_THRESHOLD)
|
probability_threshold = config.get(CONF_PROBABILITY_THRESHOLD)
|
||||||
device_class = config.get(CONF_DEVICE_CLASS)
|
device_class = config.get(CONF_DEVICE_CLASS)
|
||||||
|
|
||||||
async_add_devices([
|
async_add_entities([
|
||||||
BayesianBinarySensor(
|
BayesianBinarySensor(
|
||||||
name, prior, observations, probability_threshold, device_class)
|
name, prior, observations, probability_threshold, device_class)
|
||||||
], True)
|
], True)
|
||||||
|
@ -41,7 +41,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the Beaglebone Black GPIO devices."""
|
"""Set up the Beaglebone Black GPIO devices."""
|
||||||
pins = config.get(CONF_PINS)
|
pins = config.get(CONF_PINS)
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
|
|
||||||
for pin, params in pins.items():
|
for pin, params in pins.items():
|
||||||
binary_sensors.append(BBBGPIOBinarySensor(pin, params))
|
binary_sensors.append(BBBGPIOBinarySensor(pin, params))
|
||||||
add_devices(binary_sensors)
|
add_entities(binary_sensors)
|
||||||
|
|
||||||
|
|
||||||
class BBBGPIOBinarySensor(BinarySensorDevice):
|
class BBBGPIOBinarySensor(BinarySensorDevice):
|
||||||
|
@ -10,7 +10,7 @@ from homeassistant.components.binary_sensor import BinarySensorDevice
|
|||||||
DEPENDENCIES = ['blink']
|
DEPENDENCIES = ['blink']
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the blink binary sensors."""
|
"""Set up the blink binary sensors."""
|
||||||
if discovery_info is None:
|
if discovery_info is None:
|
||||||
return
|
return
|
||||||
@ -20,7 +20,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
for name in data.cameras:
|
for name in data.cameras:
|
||||||
devs.append(BlinkCameraMotionSensor(name, data))
|
devs.append(BlinkCameraMotionSensor(name, data))
|
||||||
devs.append(BlinkSystemSensor(data))
|
devs.append(BlinkSystemSensor(data))
|
||||||
add_devices(devs, True)
|
add_entities(devs, True)
|
||||||
|
|
||||||
|
|
||||||
class BlinkCameraMotionSensor(BinarySensorDevice):
|
class BlinkCameraMotionSensor(BinarySensorDevice):
|
||||||
|
@ -28,7 +28,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the available BloomSky weather binary sensors."""
|
"""Set up the available BloomSky weather binary sensors."""
|
||||||
bloomsky = hass.components.bloomsky
|
bloomsky = hass.components.bloomsky
|
||||||
# Default needed in case of discovery
|
# Default needed in case of discovery
|
||||||
@ -36,7 +36,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
|
|
||||||
for device in bloomsky.BLOOMSKY.devices.values():
|
for device in bloomsky.BLOOMSKY.devices.values():
|
||||||
for variable in sensors:
|
for variable in sensors:
|
||||||
add_devices(
|
add_entities(
|
||||||
[BloomSkySensor(bloomsky.BLOOMSKY, device, variable)], True)
|
[BloomSkySensor(bloomsky.BLOOMSKY, device, variable)], True)
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ SENSOR_TYPES_ELEC = {
|
|||||||
SENSOR_TYPES_ELEC.update(SENSOR_TYPES)
|
SENSOR_TYPES_ELEC.update(SENSOR_TYPES)
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the BMW sensors."""
|
"""Set up the BMW sensors."""
|
||||||
accounts = hass.data[BMW_DOMAIN]
|
accounts = hass.data[BMW_DOMAIN]
|
||||||
_LOGGER.debug('Found BMW accounts: %s',
|
_LOGGER.debug('Found BMW accounts: %s',
|
||||||
@ -51,7 +51,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
device = BMWConnectedDriveSensor(account, vehicle, key,
|
device = BMWConnectedDriveSensor(account, vehicle, key,
|
||||||
value[0], value[1])
|
value[0], value[1])
|
||||||
devices.append(device)
|
devices.append(device)
|
||||||
add_devices(devices, True)
|
add_entities(devices, True)
|
||||||
|
|
||||||
|
|
||||||
class BMWConnectedDriveSensor(BinarySensorDevice):
|
class BMWConnectedDriveSensor(BinarySensorDevice):
|
||||||
|
@ -40,7 +40,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the Command line Binary Sensor."""
|
"""Set up the Command line Binary Sensor."""
|
||||||
name = config.get(CONF_NAME)
|
name = config.get(CONF_NAME)
|
||||||
command = config.get(CONF_COMMAND)
|
command = config.get(CONF_COMMAND)
|
||||||
@ -53,7 +53,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
value_template.hass = hass
|
value_template.hass = hass
|
||||||
data = CommandSensorData(hass, command, command_timeout)
|
data = CommandSensorData(hass, command, command_timeout)
|
||||||
|
|
||||||
add_devices([CommandBinarySensor(
|
add_entities([CommandBinarySensor(
|
||||||
hass, data, name, device_class, payload_on, payload_off,
|
hass, data, name, device_class, payload_on, payload_off,
|
||||||
value_template)], True)
|
value_template)], True)
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the Concord232 binary sensor platform."""
|
"""Set up the Concord232 binary sensor platform."""
|
||||||
from concord232 import client as concord232_client
|
from concord232 import client as concord232_client
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
add_devices(sensors, True)
|
add_entities(sensors, True)
|
||||||
|
|
||||||
|
|
||||||
def get_opening_type(zone):
|
def get_opening_type(zone):
|
||||||
|
@ -15,13 +15,13 @@ from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
|||||||
DEPENDENCIES = ['deconz']
|
DEPENDENCIES = ['deconz']
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(hass, config, async_add_devices,
|
async def async_setup_platform(hass, config, async_add_entities,
|
||||||
discovery_info=None):
|
discovery_info=None):
|
||||||
"""Old way of setting up deCONZ binary sensors."""
|
"""Old way of setting up deCONZ binary sensors."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass, config_entry, async_add_devices):
|
async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||||
"""Set up the deCONZ binary sensor."""
|
"""Set up the deCONZ binary sensor."""
|
||||||
@callback
|
@callback
|
||||||
def async_add_sensor(sensors):
|
def async_add_sensor(sensors):
|
||||||
@ -33,7 +33,7 @@ async def async_setup_entry(hass, config_entry, async_add_devices):
|
|||||||
if sensor.type in DECONZ_BINARY_SENSOR and \
|
if sensor.type in DECONZ_BINARY_SENSOR and \
|
||||||
not (not allow_clip_sensor and sensor.type.startswith('CLIP')):
|
not (not allow_clip_sensor and sensor.type.startswith('CLIP')):
|
||||||
entities.append(DeconzBinarySensor(sensor))
|
entities.append(DeconzBinarySensor(sensor))
|
||||||
async_add_devices(entities, True)
|
async_add_entities(entities, True)
|
||||||
|
|
||||||
hass.data[DATA_DECONZ_UNSUB].append(
|
hass.data[DATA_DECONZ_UNSUB].append(
|
||||||
async_dispatcher_connect(hass, 'deconz_new_sensor', async_add_sensor))
|
async_dispatcher_connect(hass, 'deconz_new_sensor', async_add_sensor))
|
||||||
|
@ -7,9 +7,9 @@ https://home-assistant.io/components/demo/
|
|||||||
from homeassistant.components.binary_sensor import BinarySensorDevice
|
from homeassistant.components.binary_sensor import BinarySensorDevice
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the Demo binary sensor platform."""
|
"""Set up the Demo binary sensor platform."""
|
||||||
add_devices([
|
add_entities([
|
||||||
DemoBinarySensor('Basement Floor Wet', False, 'moisture'),
|
DemoBinarySensor('Basement Floor Wet', False, 'moisture'),
|
||||||
DemoBinarySensor('Movement Backyard', True, 'motion'),
|
DemoBinarySensor('Movement Backyard', True, 'motion'),
|
||||||
])
|
])
|
||||||
|
@ -28,7 +28,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the Digital Ocean droplet sensor."""
|
"""Set up the Digital Ocean droplet sensor."""
|
||||||
digital = hass.data.get(DATA_DIGITAL_OCEAN)
|
digital = hass.data.get(DATA_DIGITAL_OCEAN)
|
||||||
if not digital:
|
if not digital:
|
||||||
@ -44,7 +44,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
return False
|
return False
|
||||||
dev.append(DigitalOceanBinarySensor(digital, droplet_id))
|
dev.append(DigitalOceanBinarySensor(digital, droplet_id))
|
||||||
|
|
||||||
add_devices(dev, True)
|
add_entities(dev, True)
|
||||||
|
|
||||||
|
|
||||||
class DigitalOceanBinarySensor(BinarySensorDevice):
|
class DigitalOceanBinarySensor(BinarySensorDevice):
|
||||||
|
@ -12,7 +12,7 @@ DEPENDENCIES = ['ecobee']
|
|||||||
ECOBEE_CONFIG_FILE = 'ecobee.conf'
|
ECOBEE_CONFIG_FILE = 'ecobee.conf'
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the Ecobee sensors."""
|
"""Set up the Ecobee sensors."""
|
||||||
if discovery_info is None:
|
if discovery_info is None:
|
||||||
return
|
return
|
||||||
@ -26,7 +26,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
|
|
||||||
dev.append(EcobeeBinarySensor(sensor['name'], index))
|
dev.append(EcobeeBinarySensor(sensor['name'], index))
|
||||||
|
|
||||||
add_devices(dev, True)
|
add_entities(dev, True)
|
||||||
|
|
||||||
|
|
||||||
class EcobeeBinarySensor(BinarySensorDevice):
|
class EcobeeBinarySensor(BinarySensorDevice):
|
||||||
|
@ -19,7 +19,8 @@ EGARDIA_TYPE_TO_DEVICE_CLASS = {'IR Sensor': 'motion',
|
|||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
def async_setup_platform(hass, config, async_add_entities,
|
||||||
|
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):
|
||||||
@ -27,7 +28,7 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
|||||||
|
|
||||||
disc_info = discovery_info[ATTR_DISCOVER_DEVICES]
|
disc_info = discovery_info[ATTR_DISCOVER_DEVICES]
|
||||||
# multiple devices here!
|
# multiple devices here!
|
||||||
async_add_devices(
|
async_add_entities(
|
||||||
(
|
(
|
||||||
EgardiaBinarySensor(
|
EgardiaBinarySensor(
|
||||||
sensor_id=disc_info[sensor]['id'],
|
sensor_id=disc_info[sensor]['id'],
|
||||||
|
@ -15,7 +15,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
DEPENDENCIES = ['eight_sleep']
|
DEPENDENCIES = ['eight_sleep']
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(hass, config, async_add_devices,
|
async def async_setup_platform(hass, config, async_add_entities,
|
||||||
discovery_info=None):
|
discovery_info=None):
|
||||||
"""Set up the eight sleep binary sensor."""
|
"""Set up the eight sleep binary sensor."""
|
||||||
if discovery_info is None:
|
if discovery_info is None:
|
||||||
@ -30,7 +30,7 @@ async def async_setup_platform(hass, config, async_add_devices,
|
|||||||
for sensor in sensors:
|
for sensor in sensors:
|
||||||
all_sensors.append(EightHeatSensor(name, eight, sensor))
|
all_sensors.append(EightHeatSensor(name, eight, sensor))
|
||||||
|
|
||||||
async_add_devices(all_sensors, True)
|
async_add_entities(all_sensors, True)
|
||||||
|
|
||||||
|
|
||||||
class EightHeatSensor(EightSleepHeatEntity, BinarySensorDevice):
|
class EightHeatSensor(EightSleepHeatEntity, BinarySensorDevice):
|
||||||
|
@ -27,13 +27,13 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the Binary Sensor platform for EnOcean."""
|
"""Set up the Binary Sensor platform for EnOcean."""
|
||||||
dev_id = config.get(CONF_ID)
|
dev_id = config.get(CONF_ID)
|
||||||
devname = config.get(CONF_NAME)
|
devname = config.get(CONF_NAME)
|
||||||
device_class = config.get(CONF_DEVICE_CLASS)
|
device_class = config.get(CONF_DEVICE_CLASS)
|
||||||
|
|
||||||
add_devices([EnOceanBinarySensor(dev_id, devname, device_class)])
|
add_entities([EnOceanBinarySensor(dev_id, devname, device_class)])
|
||||||
|
|
||||||
|
|
||||||
class EnOceanBinarySensor(enocean.EnOceanDevice, BinarySensorDevice):
|
class EnOceanBinarySensor(enocean.EnOceanDevice, BinarySensorDevice):
|
||||||
|
@ -23,7 +23,8 @@ DEPENDENCIES = ['envisalink']
|
|||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
def async_setup_platform(hass, config, async_add_entities,
|
||||||
|
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']
|
||||||
|
|
||||||
@ -40,7 +41,7 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
|||||||
)
|
)
|
||||||
devices.append(device)
|
devices.append(device)
|
||||||
|
|
||||||
async_add_devices(devices)
|
async_add_entities(devices)
|
||||||
|
|
||||||
|
|
||||||
class EnvisalinkBinarySensor(EnvisalinkDevice, BinarySensorDevice):
|
class EnvisalinkBinarySensor(EnvisalinkDevice, BinarySensorDevice):
|
||||||
|
@ -47,7 +47,8 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
def async_setup_platform(hass, config, async_add_entities,
|
||||||
|
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]
|
||||||
|
|
||||||
@ -55,7 +56,7 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
|||||||
return
|
return
|
||||||
|
|
||||||
entity = FFmpegMotion(hass, manager, config)
|
entity = FFmpegMotion(hass, manager, config)
|
||||||
async_add_devices([entity])
|
async_add_entities([entity])
|
||||||
|
|
||||||
|
|
||||||
class FFmpegBinarySensor(FFmpegBase, BinarySensorDevice):
|
class FFmpegBinarySensor(FFmpegBase, BinarySensorDevice):
|
||||||
|
@ -44,7 +44,8 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
def async_setup_platform(hass, config, async_add_entities,
|
||||||
|
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]
|
||||||
|
|
||||||
@ -52,7 +53,7 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
|||||||
return
|
return
|
||||||
|
|
||||||
entity = FFmpegNoise(hass, manager, config)
|
entity = FFmpegNoise(hass, manager, config)
|
||||||
async_add_devices([entity])
|
async_add_entities([entity])
|
||||||
|
|
||||||
|
|
||||||
class FFmpegNoise(FFmpegBinarySensor):
|
class FFmpegNoise(FFmpegBinarySensor):
|
||||||
|
@ -23,7 +23,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the GC100 devices."""
|
"""Set up the GC100 devices."""
|
||||||
binary_sensors = []
|
binary_sensors = []
|
||||||
ports = config.get(CONF_PORTS)
|
ports = config.get(CONF_PORTS)
|
||||||
@ -31,7 +31,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
for port_addr, port_name in port.items():
|
for port_addr, port_name in port.items():
|
||||||
binary_sensors.append(GC100BinarySensor(
|
binary_sensors.append(GC100BinarySensor(
|
||||||
port_name, port_addr, hass.data[DATA_GC100]))
|
port_name, port_addr, hass.data[DATA_GC100]))
|
||||||
add_devices(binary_sensors, True)
|
add_entities(binary_sensors, True)
|
||||||
|
|
||||||
|
|
||||||
class GC100BinarySensor(BinarySensorDevice):
|
class GC100BinarySensor(BinarySensorDevice):
|
||||||
|
@ -13,13 +13,13 @@ DEVICETYPE_DEVICE_CLASS = {'motionsensor': 'motion',
|
|||||||
'contactsensor': 'opening'}
|
'contactsensor': 'opening'}
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up Hive sensor devices."""
|
"""Set up Hive sensor devices."""
|
||||||
if discovery_info is None:
|
if discovery_info is None:
|
||||||
return
|
return
|
||||||
session = hass.data.get(DATA_HIVE)
|
session = hass.data.get(DATA_HIVE)
|
||||||
|
|
||||||
add_devices([HiveBinarySensorEntity(session, discovery_info)])
|
add_entities([HiveBinarySensorEntity(session, discovery_info)])
|
||||||
|
|
||||||
|
|
||||||
class HiveBinarySensorEntity(BinarySensorDevice):
|
class HiveBinarySensorEntity(BinarySensorDevice):
|
||||||
|
@ -30,7 +30,7 @@ SENSOR_TYPES_CLASS = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the HomeMatic binary sensor platform."""
|
"""Set up the HomeMatic binary sensor platform."""
|
||||||
if discovery_info is None:
|
if discovery_info is None:
|
||||||
return
|
return
|
||||||
@ -40,7 +40,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
new_device = HMBinarySensor(conf)
|
new_device = HMBinarySensor(conf)
|
||||||
devices.append(new_device)
|
devices.append(new_device)
|
||||||
|
|
||||||
add_devices(devices)
|
add_entities(devices)
|
||||||
|
|
||||||
|
|
||||||
class HMBinarySensor(HMDevice, BinarySensorDevice):
|
class HMBinarySensor(HMDevice, BinarySensorDevice):
|
||||||
|
@ -19,12 +19,12 @@ STATE_SMOKE_OFF = 'IDLE_OFF'
|
|||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(
|
async def async_setup_platform(
|
||||||
hass, config, async_add_devices, discovery_info=None):
|
hass, config, async_add_entities, discovery_info=None):
|
||||||
"""Set up the HomematicIP Cloud binary sensor devices."""
|
"""Set up the HomematicIP Cloud binary sensor devices."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass, config_entry, async_add_devices):
|
async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||||
"""Set up the HomematicIP Cloud binary sensor from a config entry."""
|
"""Set up the HomematicIP Cloud binary sensor from a config entry."""
|
||||||
from homematicip.aio.device import (
|
from homematicip.aio.device import (
|
||||||
AsyncShutterContact, AsyncMotionDetectorIndoor, AsyncSmokeDetector)
|
AsyncShutterContact, AsyncMotionDetectorIndoor, AsyncSmokeDetector)
|
||||||
@ -40,7 +40,7 @@ async def async_setup_entry(hass, config_entry, async_add_devices):
|
|||||||
devices.append(HomematicipSmokeDetector(home, device))
|
devices.append(HomematicipSmokeDetector(home, device))
|
||||||
|
|
||||||
if devices:
|
if devices:
|
||||||
async_add_devices(devices)
|
async_add_entities(devices)
|
||||||
|
|
||||||
|
|
||||||
class HomematicipShutterContact(HomematicipGenericDevice, BinarySensorDevice):
|
class HomematicipShutterContact(HomematicipGenericDevice, BinarySensorDevice):
|
||||||
|
@ -26,7 +26,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up a sensor for a Hydrawise device."""
|
"""Set up a sensor for a Hydrawise device."""
|
||||||
hydrawise = hass.data[DATA_HYDRAWISE].data
|
hydrawise = hass.data[DATA_HYDRAWISE].data
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
hydrawise.controller_status.get('running', False)
|
hydrawise.controller_status.get('running', False)
|
||||||
sensors.append(HydrawiseBinarySensor(zone_data, sensor_type))
|
sensors.append(HydrawiseBinarySensor(zone_data, sensor_type))
|
||||||
|
|
||||||
add_devices(sensors, True)
|
add_entities(sensors, True)
|
||||||
|
|
||||||
|
|
||||||
class HydrawiseBinarySensor(HydrawiseEntity, BinarySensorDevice):
|
class HydrawiseBinarySensor(HydrawiseEntity, BinarySensorDevice):
|
||||||
|
@ -30,7 +30,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the IHC binary sensor platform."""
|
"""Set up the IHC binary sensor platform."""
|
||||||
ihc_controller = hass.data[IHC_DATA][IHC_CONTROLLER]
|
ihc_controller = hass.data[IHC_DATA][IHC_CONTROLLER]
|
||||||
info = hass.data[IHC_DATA][IHC_INFO]
|
info = hass.data[IHC_DATA][IHC_INFO]
|
||||||
@ -56,7 +56,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
sensor_type, inverting)
|
sensor_type, inverting)
|
||||||
devices.append(sensor)
|
devices.append(sensor)
|
||||||
|
|
||||||
add_devices(devices)
|
add_entities(devices)
|
||||||
|
|
||||||
|
|
||||||
class IHCBinarySensor(IHCDevice, BinarySensorDevice):
|
class IHCBinarySensor(IHCDevice, BinarySensorDevice):
|
||||||
|
@ -23,7 +23,8 @@ SENSOR_TYPES = {'openClosedSensor': 'opening',
|
|||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
def async_setup_platform(hass, config, async_add_entities,
|
||||||
|
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')
|
||||||
|
|
||||||
@ -37,7 +38,7 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
|||||||
|
|
||||||
new_entity = InsteonBinarySensor(device, state_key)
|
new_entity = InsteonBinarySensor(device, state_key)
|
||||||
|
|
||||||
async_add_devices([new_entity])
|
async_add_entities([new_entity])
|
||||||
|
|
||||||
|
|
||||||
class InsteonBinarySensor(InsteonEntity, BinarySensorDevice):
|
class InsteonBinarySensor(InsteonEntity, BinarySensorDevice):
|
||||||
|
@ -35,7 +35,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the ISS sensor."""
|
"""Set up the ISS sensor."""
|
||||||
if None in (hass.config.latitude, hass.config.longitude):
|
if None in (hass.config.latitude, hass.config.longitude):
|
||||||
_LOGGER.error("Latitude or longitude not set in Home Assistant config")
|
_LOGGER.error("Latitude or longitude not set in Home Assistant config")
|
||||||
@ -51,7 +51,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
name = config.get(CONF_NAME)
|
name = config.get(CONF_NAME)
|
||||||
show_on_map = config.get(CONF_SHOW_ON_MAP)
|
show_on_map = config.get(CONF_SHOW_ON_MAP)
|
||||||
|
|
||||||
add_devices([IssBinarySensor(iss_data, name, show_on_map)], True)
|
add_entities([IssBinarySensor(iss_data, name, show_on_map)], True)
|
||||||
|
|
||||||
|
|
||||||
class IssBinarySensor(BinarySensorDevice):
|
class IssBinarySensor(BinarySensorDevice):
|
||||||
|
@ -29,7 +29,7 @@ ISY_DEVICE_TYPES = {
|
|||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config: ConfigType,
|
def setup_platform(hass, config: ConfigType,
|
||||||
add_devices: Callable[[list], None], discovery_info=None):
|
add_entities: Callable[[list], None], discovery_info=None):
|
||||||
"""Set up the ISY994 binary sensor platform."""
|
"""Set up the ISY994 binary sensor platform."""
|
||||||
devices = []
|
devices = []
|
||||||
devices_by_nid = {}
|
devices_by_nid = {}
|
||||||
@ -75,7 +75,7 @@ def setup_platform(hass, config: ConfigType,
|
|||||||
for name, status, _ in hass.data[ISY994_PROGRAMS][DOMAIN]:
|
for name, status, _ in hass.data[ISY994_PROGRAMS][DOMAIN]:
|
||||||
devices.append(ISYBinarySensorProgram(name, status))
|
devices.append(ISYBinarySensorProgram(name, status))
|
||||||
|
|
||||||
add_devices(devices)
|
add_entities(devices)
|
||||||
|
|
||||||
|
|
||||||
def _detect_device_type(node) -> str:
|
def _detect_device_type(node) -> str:
|
||||||
|
@ -54,27 +54,27 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(hass, config, async_add_devices,
|
async def async_setup_platform(hass, config, async_add_entities,
|
||||||
discovery_info=None):
|
discovery_info=None):
|
||||||
"""Set up binary sensor(s) for KNX platform."""
|
"""Set up binary sensor(s) for KNX platform."""
|
||||||
if discovery_info is not None:
|
if discovery_info is not None:
|
||||||
async_add_devices_discovery(hass, discovery_info, async_add_devices)
|
async_add_entities_discovery(hass, discovery_info, async_add_entities)
|
||||||
else:
|
else:
|
||||||
async_add_devices_config(hass, config, async_add_devices)
|
async_add_entities_config(hass, config, async_add_entities)
|
||||||
|
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_add_devices_discovery(hass, discovery_info, async_add_devices):
|
def async_add_entities_discovery(hass, discovery_info, async_add_entities):
|
||||||
"""Set up binary sensors for KNX platform configured via xknx.yaml."""
|
"""Set up binary sensors for KNX platform configured via xknx.yaml."""
|
||||||
entities = []
|
entities = []
|
||||||
for device_name in discovery_info[ATTR_DISCOVER_DEVICES]:
|
for device_name in discovery_info[ATTR_DISCOVER_DEVICES]:
|
||||||
device = hass.data[DATA_KNX].xknx.devices[device_name]
|
device = hass.data[DATA_KNX].xknx.devices[device_name]
|
||||||
entities.append(KNXBinarySensor(hass, device))
|
entities.append(KNXBinarySensor(hass, device))
|
||||||
async_add_devices(entities)
|
async_add_entities(entities)
|
||||||
|
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_add_devices_config(hass, config, async_add_devices):
|
def async_add_entities_config(hass, config, async_add_entities):
|
||||||
"""Set up binary senor for KNX platform configured within platform."""
|
"""Set up binary senor for KNX platform configured within platform."""
|
||||||
name = config.get(CONF_NAME)
|
name = config.get(CONF_NAME)
|
||||||
import xknx
|
import xknx
|
||||||
@ -97,7 +97,7 @@ def async_add_devices_config(hass, config, async_add_devices):
|
|||||||
entity.automations.append(KNXAutomation(
|
entity.automations.append(KNXAutomation(
|
||||||
hass=hass, device=binary_sensor, hook=hook,
|
hass=hass, device=binary_sensor, hook=hook,
|
||||||
action=action, counter=counter))
|
action=action, counter=counter))
|
||||||
async_add_devices([entity])
|
async_add_entities([entity])
|
||||||
|
|
||||||
|
|
||||||
class KNXBinarySensor(BinarySensorDevice):
|
class KNXBinarySensor(BinarySensorDevice):
|
||||||
|
@ -20,7 +20,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
DEPENDENCIES = ['konnected']
|
DEPENDENCIES = ['konnected']
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(hass, config, async_add_devices,
|
async def async_setup_platform(hass, config, async_add_entities,
|
||||||
discovery_info=None):
|
discovery_info=None):
|
||||||
"""Set up binary sensors attached to a Konnected device."""
|
"""Set up binary sensors attached to a Konnected device."""
|
||||||
if discovery_info is None:
|
if discovery_info is None:
|
||||||
@ -31,7 +31,7 @@ async def async_setup_platform(hass, config, async_add_devices,
|
|||||||
sensors = [KonnectedBinarySensor(device_id, pin_num, pin_data)
|
sensors = [KonnectedBinarySensor(device_id, pin_num, pin_data)
|
||||||
for pin_num, pin_data in
|
for pin_num, pin_data in
|
||||||
data[CONF_DEVICES][device_id][CONF_BINARY_SENSORS].items()]
|
data[CONF_DEVICES][device_id][CONF_BINARY_SENSORS].items()]
|
||||||
async_add_devices(sensors)
|
async_add_entities(sensors)
|
||||||
|
|
||||||
|
|
||||||
class KonnectedBinarySensor(BinarySensorDevice):
|
class KonnectedBinarySensor(BinarySensorDevice):
|
||||||
|
@ -27,7 +27,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the Linode droplet sensor."""
|
"""Set up the Linode droplet sensor."""
|
||||||
linode = hass.data.get(DATA_LINODE)
|
linode = hass.data.get(DATA_LINODE)
|
||||||
nodes = config.get(CONF_NODES)
|
nodes = config.get(CONF_NODES)
|
||||||
@ -40,7 +40,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
return
|
return
|
||||||
dev.append(LinodeBinarySensor(linode, node_id))
|
dev.append(LinodeBinarySensor(linode, node_id))
|
||||||
|
|
||||||
add_devices(dev, True)
|
add_entities(dev, True)
|
||||||
|
|
||||||
|
|
||||||
class LinodeBinarySensor(BinarySensorDevice):
|
class LinodeBinarySensor(BinarySensorDevice):
|
||||||
|
@ -13,7 +13,7 @@ from homeassistant.const import STATE_UNKNOWN
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Iterate through all MAX! Devices and add window shutters."""
|
"""Iterate through all MAX! Devices and add window shutters."""
|
||||||
devices = []
|
devices = []
|
||||||
for handler in hass.data[DATA_KEY].values():
|
for handler in hass.data[DATA_KEY].values():
|
||||||
@ -28,7 +28,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
MaxCubeShutter(handler, name, device.rf_address))
|
MaxCubeShutter(handler, name, device.rf_address))
|
||||||
|
|
||||||
if devices:
|
if devices:
|
||||||
add_devices(devices)
|
add_entities(devices)
|
||||||
|
|
||||||
|
|
||||||
class MaxCubeShutter(BinarySensorDevice):
|
class MaxCubeShutter(BinarySensorDevice):
|
||||||
|
@ -28,7 +28,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the Modbus binary sensors."""
|
"""Set up the Modbus binary sensors."""
|
||||||
sensors = []
|
sensors = []
|
||||||
for coil in config.get(CONF_COILS):
|
for coil in config.get(CONF_COILS):
|
||||||
@ -36,7 +36,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
coil.get(CONF_NAME),
|
coil.get(CONF_NAME),
|
||||||
coil.get(CONF_SLAVE),
|
coil.get(CONF_SLAVE),
|
||||||
coil.get(CONF_COIL)))
|
coil.get(CONF_COIL)))
|
||||||
add_devices(sensors)
|
add_entities(sensors)
|
||||||
|
|
||||||
|
|
||||||
class ModbusCoilSensor(BinarySensorDevice):
|
class ModbusCoilSensor(BinarySensorDevice):
|
||||||
|
@ -45,7 +45,8 @@ PLATFORM_SCHEMA = mqtt.MQTT_RO_PLATFORM_SCHEMA.extend({
|
|||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
def async_setup_platform(hass, config, async_add_entities,
|
||||||
|
discovery_info=None):
|
||||||
"""Set up the MQTT binary sensor."""
|
"""Set up the MQTT binary sensor."""
|
||||||
if discovery_info is not None:
|
if discovery_info is not None:
|
||||||
config = PLATFORM_SCHEMA(discovery_info)
|
config = PLATFORM_SCHEMA(discovery_info)
|
||||||
@ -54,7 +55,7 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
|||||||
if value_template is not None:
|
if value_template is not None:
|
||||||
value_template.hass = hass
|
value_template.hass = hass
|
||||||
|
|
||||||
async_add_devices([MqttBinarySensor(
|
async_add_entities([MqttBinarySensor(
|
||||||
config.get(CONF_NAME),
|
config.get(CONF_NAME),
|
||||||
config.get(CONF_STATE_TOPIC),
|
config.get(CONF_STATE_TOPIC),
|
||||||
config.get(CONF_AVAILABILITY_TOPIC),
|
config.get(CONF_AVAILABILITY_TOPIC),
|
||||||
|
@ -23,7 +23,8 @@ SENSORS = [
|
|||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
def async_setup_platform(hass, config, async_add_entities,
|
||||||
|
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
|
||||||
@ -34,7 +35,7 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
|||||||
for car in hub.cars:
|
for car in hub.cars:
|
||||||
sensors.append(EVBinarySensor(hub, sconfig, car.vid))
|
sensors.append(EVBinarySensor(hub, sconfig, car.vid))
|
||||||
|
|
||||||
async_add_devices(sensors)
|
async_add_entities(sensors)
|
||||||
|
|
||||||
|
|
||||||
class EVBinarySensor(BinarySensorDevice):
|
class EVBinarySensor(BinarySensorDevice):
|
||||||
|
@ -22,11 +22,11 @@ SENSORS = {
|
|||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(
|
async def async_setup_platform(
|
||||||
hass, config, async_add_devices, discovery_info=None):
|
hass, config, async_add_entities, discovery_info=None):
|
||||||
"""Set up the mysensors platform for binary sensors."""
|
"""Set up the mysensors platform for binary sensors."""
|
||||||
mysensors.setup_mysensors_platform(
|
mysensors.setup_mysensors_platform(
|
||||||
hass, DOMAIN, discovery_info, MySensorsBinarySensor,
|
hass, DOMAIN, discovery_info, MySensorsBinarySensor,
|
||||||
async_add_devices=async_add_devices)
|
async_add_entities=async_add_entities)
|
||||||
|
|
||||||
|
|
||||||
class MySensorsBinarySensor(
|
class MySensorsBinarySensor(
|
||||||
|
@ -17,9 +17,10 @@ DEPENDENCIES = ['http']
|
|||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
def async_setup_platform(hass, config, async_add_entities,
|
||||||
|
discovery_info=None):
|
||||||
"""Set up myStrom Binary Sensor."""
|
"""Set up myStrom Binary Sensor."""
|
||||||
hass.http.register_view(MyStromView(async_add_devices))
|
hass.http.register_view(MyStromView(async_add_entities))
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -31,10 +32,10 @@ class MyStromView(HomeAssistantView):
|
|||||||
name = 'api:mystrom'
|
name = 'api:mystrom'
|
||||||
supported_actions = ['single', 'double', 'long', 'touch']
|
supported_actions = ['single', 'double', 'long', 'touch']
|
||||||
|
|
||||||
def __init__(self, add_devices):
|
def __init__(self, add_entities):
|
||||||
"""Initialize the myStrom URL endpoint."""
|
"""Initialize the myStrom URL endpoint."""
|
||||||
self.buttons = {}
|
self.buttons = {}
|
||||||
self.add_devices = add_devices
|
self.add_entities = add_entities
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
@ -62,7 +63,7 @@ class MyStromView(HomeAssistantView):
|
|||||||
button_id, button_action)
|
button_id, button_action)
|
||||||
self.buttons[entity_id] = MyStromBinarySensor(
|
self.buttons[entity_id] = MyStromBinarySensor(
|
||||||
'{}_{}'.format(button_id, button_action))
|
'{}_{}'.format(button_id, button_action))
|
||||||
hass.async_add_job(self.add_devices, [self.buttons[entity_id]])
|
self.add_entities([self.buttons[entity_id]])
|
||||||
else:
|
else:
|
||||||
new_state = True if self.buttons[entity_id].state == 'off' \
|
new_state = True if self.buttons[entity_id].state == 'off' \
|
||||||
else False
|
else False
|
||||||
|
@ -54,14 +54,14 @@ _VALID_BINARY_SENSOR_TYPES = {**BINARY_TYPES, **CLIMATE_BINARY_TYPES,
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the Nest binary sensors.
|
"""Set up the Nest binary sensors.
|
||||||
|
|
||||||
No longer used.
|
No longer used.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass, entry, async_add_devices):
|
async def async_setup_entry(hass, entry, async_add_entities):
|
||||||
"""Set up a Nest binary sensor based on a config entry."""
|
"""Set up a Nest binary sensor based on a config entry."""
|
||||||
nest = hass.data[DATA_NEST]
|
nest = hass.data[DATA_NEST]
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ async def async_setup_entry(hass, entry, async_add_devices):
|
|||||||
|
|
||||||
return sensors
|
return sensors
|
||||||
|
|
||||||
async_add_devices(await hass.async_add_job(get_binary_sensors), True)
|
async_add_entities(await hass.async_add_job(get_binary_sensors), True)
|
||||||
|
|
||||||
|
|
||||||
class NestBinarySensor(NestSensorDevice, BinarySensorDevice):
|
class NestBinarySensor(NestSensorDevice, BinarySensorDevice):
|
||||||
|
@ -57,7 +57,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the access to Netatmo binary sensor."""
|
"""Set up the access to Netatmo binary sensor."""
|
||||||
netatmo = hass.components.netatmo
|
netatmo = hass.components.netatmo
|
||||||
home = config.get(CONF_HOME)
|
home = config.get(CONF_HOME)
|
||||||
@ -89,7 +89,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
camera_name not in config[CONF_CAMERAS]:
|
camera_name not in config[CONF_CAMERAS]:
|
||||||
continue
|
continue
|
||||||
for variable in welcome_sensors:
|
for variable in welcome_sensors:
|
||||||
add_devices([NetatmoBinarySensor(
|
add_entities([NetatmoBinarySensor(
|
||||||
data, camera_name, module_name, home, timeout,
|
data, camera_name, module_name, home, timeout,
|
||||||
camera_type, variable)], True)
|
camera_type, variable)], True)
|
||||||
if camera_type == 'NOC':
|
if camera_type == 'NOC':
|
||||||
@ -98,14 +98,14 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
camera_name not in config[CONF_CAMERAS]:
|
camera_name not in config[CONF_CAMERAS]:
|
||||||
continue
|
continue
|
||||||
for variable in presence_sensors:
|
for variable in presence_sensors:
|
||||||
add_devices([NetatmoBinarySensor(
|
add_entities([NetatmoBinarySensor(
|
||||||
data, camera_name, module_name, home, timeout,
|
data, camera_name, module_name, home, timeout,
|
||||||
camera_type, variable)], True)
|
camera_type, variable)], True)
|
||||||
|
|
||||||
for module_name in data.get_module_names(camera_name):
|
for module_name in data.get_module_names(camera_name):
|
||||||
for variable in tag_sensors:
|
for variable in tag_sensors:
|
||||||
camera_type = None
|
camera_type = None
|
||||||
add_devices([NetatmoBinarySensor(
|
add_entities([NetatmoBinarySensor(
|
||||||
data, camera_name, module_name, home, timeout,
|
data, camera_name, module_name, home, timeout,
|
||||||
camera_type, variable)], True)
|
camera_type, variable)], True)
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the NX584 binary sensor platform."""
|
"""Set up the NX584 binary sensor platform."""
|
||||||
from nx584 import client as nx584_client
|
from nx584 import client as nx584_client
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
for zone in zones
|
for zone in zones
|
||||||
if zone['number'] not in exclude}
|
if zone['number'] not in exclude}
|
||||||
if zone_sensors:
|
if zone_sensors:
|
||||||
add_devices(zone_sensors.values())
|
add_entities(zone_sensors.values())
|
||||||
watcher = NX584Watcher(client, zone_sensors)
|
watcher = NX584Watcher(client, zone_sensors)
|
||||||
watcher.start()
|
watcher.start()
|
||||||
else:
|
else:
|
||||||
|
@ -33,7 +33,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the available OctoPrint binary sensors."""
|
"""Set up the available OctoPrint binary sensors."""
|
||||||
octoprint_api = hass.data[DOMAIN]["api"]
|
octoprint_api = hass.data[DOMAIN]["api"]
|
||||||
name = config.get(CONF_NAME)
|
name = config.get(CONF_NAME)
|
||||||
@ -47,7 +47,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
name, SENSOR_TYPES[octo_type][3], SENSOR_TYPES[octo_type][0],
|
name, SENSOR_TYPES[octo_type][3], SENSOR_TYPES[octo_type][0],
|
||||||
SENSOR_TYPES[octo_type][1], 'flags')
|
SENSOR_TYPES[octo_type][1], 'flags')
|
||||||
devices.append(new_sensor)
|
devices.append(new_sensor)
|
||||||
add_devices(devices, True)
|
add_entities(devices, True)
|
||||||
|
|
||||||
|
|
||||||
class OctoPrintBinarySensor(BinarySensorDevice):
|
class OctoPrintBinarySensor(BinarySensorDevice):
|
||||||
|
@ -25,7 +25,7 @@ ATTR_PROTECTION_WINDOW_ENDING_UV = 'end_uv'
|
|||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(
|
async def async_setup_platform(
|
||||||
hass, config, async_add_devices, discovery_info=None):
|
hass, config, async_add_entities, discovery_info=None):
|
||||||
"""Set up the OpenUV binary sensor platform."""
|
"""Set up the OpenUV binary sensor platform."""
|
||||||
if discovery_info is None:
|
if discovery_info is None:
|
||||||
return
|
return
|
||||||
@ -38,7 +38,7 @@ async def async_setup_platform(
|
|||||||
binary_sensors.append(
|
binary_sensors.append(
|
||||||
OpenUvBinarySensor(openuv, sensor_type, name, icon))
|
OpenUvBinarySensor(openuv, sensor_type, name, icon))
|
||||||
|
|
||||||
async_add_devices(binary_sensors, True)
|
async_add_entities(binary_sensors, True)
|
||||||
|
|
||||||
|
|
||||||
class OpenUvBinarySensor(OpenUvEntity, BinarySensorDevice):
|
class OpenUvBinarySensor(OpenUvEntity, BinarySensorDevice):
|
||||||
|
@ -44,11 +44,11 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up Pilight Binary Sensor."""
|
"""Set up Pilight Binary Sensor."""
|
||||||
disarm = config.get(CONF_DISARM_AFTER_TRIGGER)
|
disarm = config.get(CONF_DISARM_AFTER_TRIGGER)
|
||||||
if disarm:
|
if disarm:
|
||||||
add_devices([PilightTriggerSensor(
|
add_entities([PilightTriggerSensor(
|
||||||
hass=hass,
|
hass=hass,
|
||||||
name=config.get(CONF_NAME),
|
name=config.get(CONF_NAME),
|
||||||
variable=config.get(CONF_VARIABLE),
|
variable=config.get(CONF_VARIABLE),
|
||||||
@ -58,7 +58,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
rst_dly_sec=config.get(CONF_RESET_DELAY_SEC),
|
rst_dly_sec=config.get(CONF_RESET_DELAY_SEC),
|
||||||
)])
|
)])
|
||||||
else:
|
else:
|
||||||
add_devices([PilightBinarySensor(
|
add_entities([PilightBinarySensor(
|
||||||
hass=hass,
|
hass=hass,
|
||||||
name=config.get(CONF_NAME),
|
name=config.get(CONF_NAME),
|
||||||
variable=config.get(CONF_VARIABLE),
|
variable=config.get(CONF_VARIABLE),
|
||||||
|
@ -48,13 +48,13 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the Ping Binary sensor."""
|
"""Set up the Ping Binary sensor."""
|
||||||
name = config.get(CONF_NAME)
|
name = config.get(CONF_NAME)
|
||||||
host = config.get(CONF_HOST)
|
host = config.get(CONF_HOST)
|
||||||
count = config.get(CONF_PING_COUNT)
|
count = config.get(CONF_PING_COUNT)
|
||||||
|
|
||||||
add_devices([PingBinarySensor(name, PingData(host, count))], True)
|
add_entities([PingBinarySensor(name, PingData(host, count))], True)
|
||||||
|
|
||||||
|
|
||||||
class PingBinarySensor(BinarySensorDevice):
|
class PingBinarySensor(BinarySensorDevice):
|
||||||
|
@ -15,7 +15,7 @@ DEPENDENCIES = [QWIKSWITCH]
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(hass, _, add_devices, discovery_info=None):
|
async def async_setup_platform(hass, _, add_entities, discovery_info=None):
|
||||||
"""Add binary sensor from the main Qwikswitch component."""
|
"""Add binary sensor from the main Qwikswitch component."""
|
||||||
if discovery_info is None:
|
if discovery_info is None:
|
||||||
return
|
return
|
||||||
@ -24,7 +24,7 @@ async def async_setup_platform(hass, _, add_devices, discovery_info=None):
|
|||||||
_LOGGER.debug("Setup qwikswitch.binary_sensor %s, %s",
|
_LOGGER.debug("Setup qwikswitch.binary_sensor %s, %s",
|
||||||
qsusb, discovery_info)
|
qsusb, discovery_info)
|
||||||
devs = [QSBinarySensor(sensor) for sensor in discovery_info[QWIKSWITCH]]
|
devs = [QSBinarySensor(sensor) for sensor in discovery_info[QWIKSWITCH]]
|
||||||
add_devices(devs)
|
add_entities(devs)
|
||||||
|
|
||||||
|
|
||||||
class QSBinarySensor(QSEntity, BinarySensorDevice):
|
class QSBinarySensor(QSEntity, BinarySensorDevice):
|
||||||
|
@ -24,13 +24,13 @@ DEPENDENCIES = ['rachio']
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the Rachio binary sensors."""
|
"""Set up the Rachio binary sensors."""
|
||||||
devices = []
|
devices = []
|
||||||
for controller in hass.data[DOMAIN_RACHIO].controllers:
|
for controller in hass.data[DOMAIN_RACHIO].controllers:
|
||||||
devices.append(RachioControllerOnlineBinarySensor(hass, controller))
|
devices.append(RachioControllerOnlineBinarySensor(hass, controller))
|
||||||
|
|
||||||
add_devices(devices)
|
add_entities(devices)
|
||||||
_LOGGER.info("%d Rachio binary sensor(s) added", len(devices))
|
_LOGGER.info("%d Rachio binary sensor(s) added", len(devices))
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up a sensor for a raincloud device."""
|
"""Set up a sensor for a raincloud device."""
|
||||||
raincloud = hass.data[DATA_RAINCLOUD].data
|
raincloud = hass.data[DATA_RAINCLOUD].data
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
for zone in raincloud.controller.faucet.zones:
|
for zone in raincloud.controller.faucet.zones:
|
||||||
sensors.append(RainCloudBinarySensor(zone, sensor_type))
|
sensors.append(RainCloudBinarySensor(zone, sensor_type))
|
||||||
|
|
||||||
add_devices(sensors, True)
|
add_entities(sensors, True)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(
|
async def async_setup_platform(
|
||||||
hass, config, async_add_devices, discovery_info=None):
|
hass, config, async_add_entities, discovery_info=None):
|
||||||
"""Set up the RainMachine Switch platform."""
|
"""Set up the RainMachine Switch platform."""
|
||||||
if discovery_info is None:
|
if discovery_info is None:
|
||||||
return
|
return
|
||||||
@ -34,7 +34,7 @@ async def async_setup_platform(
|
|||||||
binary_sensors.append(
|
binary_sensors.append(
|
||||||
RainMachineBinarySensor(rainmachine, sensor_type, name, icon))
|
RainMachineBinarySensor(rainmachine, sensor_type, name, icon))
|
||||||
|
|
||||||
async_add_devices(binary_sensors, True)
|
async_add_entities(binary_sensors, True)
|
||||||
|
|
||||||
|
|
||||||
class RainMachineBinarySensor(RainMachineEntity, BinarySensorDevice):
|
class RainMachineBinarySensor(RainMachineEntity, BinarySensorDevice):
|
||||||
|
@ -24,12 +24,12 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(
|
async def async_setup_platform(
|
||||||
hass, config, async_add_devices, discovery_info=None):
|
hass, config, async_add_entities, discovery_info=None):
|
||||||
"""Set up the Random binary sensor."""
|
"""Set up the Random binary sensor."""
|
||||||
name = config.get(CONF_NAME)
|
name = config.get(CONF_NAME)
|
||||||
device_class = config.get(CONF_DEVICE_CLASS)
|
device_class = config.get(CONF_DEVICE_CLASS)
|
||||||
|
|
||||||
async_add_devices([RandomSensor(name, device_class)], True)
|
async_add_entities([RandomSensor(name, device_class)], True)
|
||||||
|
|
||||||
|
|
||||||
class RandomSensor(BinarySensorDevice):
|
class RandomSensor(BinarySensorDevice):
|
||||||
|
@ -42,7 +42,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the raspihats binary_sensor devices."""
|
"""Set up the raspihats binary_sensor devices."""
|
||||||
I2CHatBinarySensor.I2C_HATS_MANAGER = hass.data[I2C_HATS_MANAGER]
|
I2CHatBinarySensor.I2C_HATS_MANAGER = hass.data[I2C_HATS_MANAGER]
|
||||||
binary_sensors = []
|
binary_sensors = []
|
||||||
@ -65,7 +65,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
except I2CHatsException as ex:
|
except I2CHatsException as ex:
|
||||||
_LOGGER.error("Failed to register %s I2CHat@%s %s",
|
_LOGGER.error("Failed to register %s I2CHat@%s %s",
|
||||||
board, hex(address), str(ex))
|
board, hex(address), str(ex))
|
||||||
add_devices(binary_sensors)
|
add_entities(binary_sensors)
|
||||||
|
|
||||||
|
|
||||||
class I2CHatBinarySensor(BinarySensorDevice):
|
class I2CHatBinarySensor(BinarySensorDevice):
|
||||||
|
@ -41,7 +41,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the REST binary sensor."""
|
"""Set up the REST binary sensor."""
|
||||||
name = config.get(CONF_NAME)
|
name = config.get(CONF_NAME)
|
||||||
resource = config.get(CONF_RESOURCE)
|
resource = config.get(CONF_RESOURCE)
|
||||||
@ -71,7 +71,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
_LOGGER.error("Unable to fetch REST data from %s", resource)
|
_LOGGER.error("Unable to fetch REST data from %s", resource)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
add_devices([RestBinarySensor(
|
add_entities([RestBinarySensor(
|
||||||
hass, rest, name, device_class, value_template)], True)
|
hass, rest, name, device_class, value_template)], True)
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
}, extra=vol.ALLOW_EXTRA)
|
}, extra=vol.ALLOW_EXTRA)
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the Binary Sensor platform to RFXtrx."""
|
"""Set up the Binary Sensor platform to RFXtrx."""
|
||||||
import RFXtrx as rfxtrxmod
|
import RFXtrx as rfxtrxmod
|
||||||
sensors = []
|
sensors = []
|
||||||
@ -71,7 +71,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
sensors.append(device)
|
sensors.append(device)
|
||||||
rfxtrx.RFX_DEVICES[device_id] = device
|
rfxtrx.RFX_DEVICES[device_id] = device
|
||||||
|
|
||||||
add_devices(sensors)
|
add_entities(sensors)
|
||||||
|
|
||||||
def binary_sensor_update(event):
|
def binary_sensor_update(event):
|
||||||
"""Call for control updates from the RFXtrx gateway."""
|
"""Call for control updates from the RFXtrx gateway."""
|
||||||
@ -101,7 +101,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
sensor = RfxtrxBinarySensor(event, pkt_id)
|
sensor = RfxtrxBinarySensor(event, pkt_id)
|
||||||
sensor.hass = hass
|
sensor.hass = hass
|
||||||
rfxtrx.RFX_DEVICES[device_id] = sensor
|
rfxtrx.RFX_DEVICES[device_id] = sensor
|
||||||
add_devices([sensor])
|
add_entities([sensor])
|
||||||
_LOGGER.info(
|
_LOGGER.info(
|
||||||
"Added binary sensor %s (Device ID: %s Class: %s Sub: %s)",
|
"Added binary sensor %s (Device ID: %s Class: %s Sub: %s)",
|
||||||
pkt_id, slugify(event.device.id_string.lower()),
|
pkt_id, slugify(event.device.id_string.lower()),
|
||||||
|
@ -39,7 +39,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up a sensor for a Ring device."""
|
"""Set up a sensor for a Ring device."""
|
||||||
ring = hass.data[DATA_RING]
|
ring = hass.data[DATA_RING]
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
sensors.append(RingBinarySensor(hass,
|
sensors.append(RingBinarySensor(hass,
|
||||||
device,
|
device,
|
||||||
sensor_type))
|
sensor_type))
|
||||||
add_devices(sensors, True)
|
add_entities(sensors, True)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the Raspberry PI GPIO devices."""
|
"""Set up the Raspberry PI GPIO devices."""
|
||||||
pull_mode = config.get(CONF_PULL_MODE)
|
pull_mode = config.get(CONF_PULL_MODE)
|
||||||
bouncetime = config.get(CONF_BOUNCETIME)
|
bouncetime = config.get(CONF_BOUNCETIME)
|
||||||
@ -50,7 +50,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
for port_num, port_name in ports.items():
|
for port_num, port_name in ports.items():
|
||||||
binary_sensors.append(RPiGPIOBinarySensor(
|
binary_sensors.append(RPiGPIOBinarySensor(
|
||||||
port_name, port_num, pull_mode, bouncetime, invert_logic))
|
port_name, port_num, pull_mode, bouncetime, invert_logic))
|
||||||
add_devices(binary_sensors, True)
|
add_entities(binary_sensors, True)
|
||||||
|
|
||||||
|
|
||||||
class RPiGPIOBinarySensor(BinarySensorDevice):
|
class RPiGPIOBinarySensor(BinarySensorDevice):
|
||||||
|
@ -39,7 +39,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the PiFace Digital Input devices."""
|
"""Set up the PiFace Digital Input devices."""
|
||||||
binary_sensors = []
|
binary_sensors = []
|
||||||
ports = config.get(CONF_PORTS)
|
ports = config.get(CONF_PORTS)
|
||||||
@ -50,7 +50,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
|
|
||||||
binary_sensors.append(RPiPFIOBinarySensor(
|
binary_sensors.append(RPiPFIOBinarySensor(
|
||||||
hass, port, name, settle_time, invert_logic))
|
hass, port, name, settle_time, invert_logic))
|
||||||
add_devices(binary_sensors, True)
|
add_entities(binary_sensors, True)
|
||||||
|
|
||||||
rpi_pfio.activate_listener(hass)
|
rpi_pfio.activate_listener(hass)
|
||||||
|
|
||||||
|
@ -21,7 +21,8 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
def async_setup_platform(hass, config, async_add_entities,
|
||||||
|
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
|
||||||
@ -36,7 +37,7 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
|||||||
device = SatelIntegraBinarySensor(zone_num, zone_name, zone_type)
|
device = SatelIntegraBinarySensor(zone_num, zone_name, zone_type)
|
||||||
devices.append(device)
|
devices.append(device)
|
||||||
|
|
||||||
async_add_devices(devices)
|
async_add_entities(devices)
|
||||||
|
|
||||||
|
|
||||||
class SatelIntegraBinarySensor(BinarySensorDevice):
|
class SatelIntegraBinarySensor(BinarySensorDevice):
|
||||||
|
@ -37,7 +37,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the platform for a Skybell device."""
|
"""Set up the platform for a Skybell device."""
|
||||||
skybell = hass.data.get(SKYBELL_DOMAIN)
|
skybell = hass.data.get(SKYBELL_DOMAIN)
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
for device in skybell.get_devices():
|
for device in skybell.get_devices():
|
||||||
sensors.append(SkybellBinarySensor(device, sensor_type))
|
sensors.append(SkybellBinarySensor(device, sensor_type))
|
||||||
|
|
||||||
add_devices(sensors, True)
|
add_entities(sensors, True)
|
||||||
|
|
||||||
|
|
||||||
class SkybellBinarySensor(SkybellDevice, BinarySensorDevice):
|
class SkybellBinarySensor(SkybellDevice, BinarySensorDevice):
|
||||||
|
@ -10,7 +10,7 @@ from homeassistant.components.binary_sensor import BinarySensorDevice
|
|||||||
DEPENDENCIES = ['sleepiq']
|
DEPENDENCIES = ['sleepiq']
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the SleepIQ sensors."""
|
"""Set up the SleepIQ sensors."""
|
||||||
if discovery_info is None:
|
if discovery_info is None:
|
||||||
return
|
return
|
||||||
@ -22,7 +22,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
for bed_id, _ in data.beds.items():
|
for bed_id, _ in data.beds.items():
|
||||||
for side in sleepiq.SIDES:
|
for side in sleepiq.SIDES:
|
||||||
dev.append(IsInBedBinarySensor(data, bed_id, side))
|
dev.append(IsInBedBinarySensor(data, bed_id, side))
|
||||||
add_devices(dev)
|
add_entities(dev)
|
||||||
|
|
||||||
|
|
||||||
class IsInBedBinarySensor(sleepiq.SleepIQSensor, BinarySensorDevice):
|
class IsInBedBinarySensor(sleepiq.SleepIQSensor, BinarySensorDevice):
|
||||||
|
@ -45,13 +45,14 @@ def _create_sensor(hass, zone):
|
|||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
def async_setup_platform(hass, config, async_add_entities,
|
||||||
|
discovery_info=None):
|
||||||
"""Set up the SPC binary sensor."""
|
"""Set up the SPC binary sensor."""
|
||||||
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):
|
||||||
return
|
return
|
||||||
|
|
||||||
async_add_devices(
|
async_add_entities(
|
||||||
_create_sensor(hass, zone)
|
_create_sensor(hass, zone)
|
||||||
for zone in discovery_info[ATTR_DISCOVER_DEVICES]
|
for zone in discovery_info[ATTR_DISCOVER_DEVICES]
|
||||||
if _get_device_class(zone['type']))
|
if _get_device_class(zone['type']))
|
||||||
|
@ -21,14 +21,14 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
SCAN_INTERVAL = timedelta(seconds=120)
|
SCAN_INTERVAL = timedelta(seconds=120)
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up Tahoma controller devices."""
|
"""Set up Tahoma controller devices."""
|
||||||
_LOGGER.debug("Setup Tahoma Binary sensor platform")
|
_LOGGER.debug("Setup Tahoma Binary sensor platform")
|
||||||
controller = hass.data[TAHOMA_DOMAIN]['controller']
|
controller = hass.data[TAHOMA_DOMAIN]['controller']
|
||||||
devices = []
|
devices = []
|
||||||
for device in hass.data[TAHOMA_DOMAIN]['devices']['smoke']:
|
for device in hass.data[TAHOMA_DOMAIN]['devices']['smoke']:
|
||||||
devices.append(TahomaBinarySensor(device, controller))
|
devices.append(TahomaBinarySensor(device, controller))
|
||||||
add_devices(devices, True)
|
add_entities(devices, True)
|
||||||
|
|
||||||
|
|
||||||
class TahomaBinarySensor(TahomaDevice, BinarySensorDevice):
|
class TahomaBinarySensor(TahomaDevice, BinarySensorDevice):
|
||||||
|
@ -30,14 +30,14 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the Taps Aff binary sensor."""
|
"""Set up the Taps Aff binary sensor."""
|
||||||
name = config.get(CONF_NAME)
|
name = config.get(CONF_NAME)
|
||||||
location = config.get(CONF_LOCATION)
|
location = config.get(CONF_LOCATION)
|
||||||
|
|
||||||
taps_aff_data = TapsAffData(location)
|
taps_aff_data = TapsAffData(location)
|
||||||
|
|
||||||
add_devices([TapsAffSensor(taps_aff_data, name)], True)
|
add_entities([TapsAffSensor(taps_aff_data, name)], True)
|
||||||
|
|
||||||
|
|
||||||
class TapsAffSensor(BinarySensorDevice):
|
class TapsAffSensor(BinarySensorDevice):
|
||||||
|
@ -15,9 +15,9 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({})
|
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the TCP binary sensor."""
|
"""Set up the TCP binary sensor."""
|
||||||
add_devices([TcpBinarySensor(hass, config)])
|
add_entities([TcpBinarySensor(hass, config)])
|
||||||
|
|
||||||
|
|
||||||
class TcpBinarySensor(BinarySensorDevice, TcpSensor):
|
class TcpBinarySensor(BinarySensorDevice, TcpSensor):
|
||||||
|
@ -15,11 +15,11 @@ from homeassistant.components.binary_sensor import BinarySensorDevice
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up Tellstick sensors."""
|
"""Set up Tellstick sensors."""
|
||||||
if discovery_info is None:
|
if discovery_info is None:
|
||||||
return
|
return
|
||||||
add_devices(
|
add_entities(
|
||||||
TelldusLiveSensor(hass, binary_sensor)
|
TelldusLiveSensor(hass, binary_sensor)
|
||||||
for binary_sensor in discovery_info
|
for binary_sensor in discovery_info
|
||||||
)
|
)
|
||||||
|
@ -47,7 +47,8 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
def async_setup_platform(hass, config, async_add_entities,
|
||||||
|
discovery_info=None):
|
||||||
"""Set up template binary sensors."""
|
"""Set up template binary sensors."""
|
||||||
sensors = []
|
sensors = []
|
||||||
|
|
||||||
@ -82,7 +83,7 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
|||||||
_LOGGER.error("No sensors added")
|
_LOGGER.error("No sensors added")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
async_add_devices(sensors)
|
async_add_entities(sensors)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,13 +15,13 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
DEPENDENCIES = ['tesla']
|
DEPENDENCIES = ['tesla']
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the Tesla binary sensor."""
|
"""Set up the Tesla binary sensor."""
|
||||||
devices = [
|
devices = [
|
||||||
TeslaBinarySensor(
|
TeslaBinarySensor(
|
||||||
device, hass.data[TESLA_DOMAIN]['controller'], 'connectivity')
|
device, hass.data[TESLA_DOMAIN]['controller'], 'connectivity')
|
||||||
for device in hass.data[TESLA_DOMAIN]['devices']['binary_sensor']]
|
for device in hass.data[TESLA_DOMAIN]['devices']['binary_sensor']]
|
||||||
add_devices(devices, True)
|
add_entities(devices, True)
|
||||||
|
|
||||||
|
|
||||||
class TeslaBinarySensor(TeslaDevice, BinarySensorDevice):
|
class TeslaBinarySensor(TeslaDevice, BinarySensorDevice):
|
||||||
|
@ -55,7 +55,8 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
def async_setup_platform(hass, config, async_add_entities,
|
||||||
|
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)
|
||||||
@ -64,7 +65,7 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
|||||||
hysteresis = config.get(CONF_HYSTERESIS)
|
hysteresis = config.get(CONF_HYSTERESIS)
|
||||||
device_class = config.get(CONF_DEVICE_CLASS)
|
device_class = config.get(CONF_DEVICE_CLASS)
|
||||||
|
|
||||||
async_add_devices([ThresholdSensor(
|
async_add_entities([ThresholdSensor(
|
||||||
hass, entity_id, name, lower, upper, hysteresis, device_class)], True)
|
hass, entity_id, name, lower, upper, hysteresis, device_class)], True)
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the trend sensors."""
|
"""Set up the trend sensors."""
|
||||||
sensors = []
|
sensors = []
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
if not sensors:
|
if not sensors:
|
||||||
_LOGGER.error("No sensors added")
|
_LOGGER.error("No sensors added")
|
||||||
return False
|
return False
|
||||||
add_devices(sensors)
|
add_entities(sensors)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the UpCloud server binary sensor."""
|
"""Set up the UpCloud server binary sensor."""
|
||||||
upcloud = hass.data[DATA_UPCLOUD]
|
upcloud = hass.data[DATA_UPCLOUD]
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
|
|
||||||
devices = [UpCloudBinarySensor(upcloud, uuid) for uuid in servers]
|
devices = [UpCloudBinarySensor(upcloud, uuid) for uuid in servers]
|
||||||
|
|
||||||
add_devices(devices, True)
|
add_entities(devices, True)
|
||||||
|
|
||||||
|
|
||||||
class UpCloudBinarySensor(UpCloudServerEntity, BinarySensorDevice):
|
class UpCloudBinarySensor(UpCloudServerEntity, BinarySensorDevice):
|
||||||
|
@ -26,7 +26,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the Uptime Robot binary_sensors."""
|
"""Set up the Uptime Robot binary_sensors."""
|
||||||
from pyuptimerobot import UptimeRobot
|
from pyuptimerobot import UptimeRobot
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
api_key, up_robot, monitor['id'], monitor['friendly_name'],
|
api_key, up_robot, monitor['id'], monitor['friendly_name'],
|
||||||
monitor['url']))
|
monitor['url']))
|
||||||
|
|
||||||
add_devices(devices, True)
|
add_entities(devices, True)
|
||||||
|
|
||||||
|
|
||||||
class UptimeRobotBinarySensor(BinarySensorDevice):
|
class UptimeRobotBinarySensor(BinarySensorDevice):
|
||||||
|
@ -15,7 +15,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
DEPENDENCIES = ['velbus']
|
DEPENDENCIES = ['velbus']
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(hass, config, async_add_devices,
|
async def async_setup_platform(hass, config, async_add_entities,
|
||||||
discovery_info=None):
|
discovery_info=None):
|
||||||
"""Set up Velbus binary sensors."""
|
"""Set up Velbus binary sensors."""
|
||||||
if discovery_info is None:
|
if discovery_info is None:
|
||||||
@ -25,7 +25,7 @@ async def async_setup_platform(hass, config, async_add_devices,
|
|||||||
module = hass.data[VELBUS_DOMAIN].get_module(sensor[0])
|
module = hass.data[VELBUS_DOMAIN].get_module(sensor[0])
|
||||||
channel = sensor[1]
|
channel = sensor[1]
|
||||||
sensors.append(VelbusBinarySensor(module, channel))
|
sensors.append(VelbusBinarySensor(module, channel))
|
||||||
async_add_devices(sensors)
|
async_add_entities(sensors)
|
||||||
|
|
||||||
|
|
||||||
class VelbusBinarySensor(VelbusEntity, BinarySensorDevice):
|
class VelbusBinarySensor(VelbusEntity, BinarySensorDevice):
|
||||||
|
@ -16,9 +16,9 @@ DEPENDENCIES = ['vera']
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Perform the setup for Vera controller devices."""
|
"""Perform the setup for Vera controller devices."""
|
||||||
add_devices(
|
add_entities(
|
||||||
[VeraBinarySensor(device, hass.data[VERA_CONTROLLER])
|
[VeraBinarySensor(device, hass.data[VERA_CONTROLLER])
|
||||||
for device in hass.data[VERA_DEVICES]['binary_sensor']], True)
|
for device in hass.data[VERA_DEVICES]['binary_sensor']], True)
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user