add_devices -> add_entities (#16171)

* add_devices -> add_entities

* Lint

* PyLint

* Revert external method in scsgate
This commit is contained in:
Paulus Schoutsen 2018-08-24 16:37:30 +02:00 committed by GitHub
parent 37fd438717
commit 994b829cb4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
839 changed files with 2121 additions and 2008 deletions

View file

@ -16,7 +16,7 @@ DEPENDENCIES = ['abode']
_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."""
import abodepy.helpers.constants as CONST
import abodepy.helpers.timeline as TIMELINE
@ -44,7 +44,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
data.devices.extend(devices)
add_devices(devices)
add_entities(devices)
class AbodeBinarySensor(AbodeDevice, BinarySensorDevice):

View file

@ -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."""
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)
ads_sensor = AdsBinarySensor(ads_hub, name, ads_var, device_class)
add_devices([ads_sensor])
add_entities([ads_sensor])
class AdsBinarySensor(BinarySensorDevice):

View file

@ -28,7 +28,7 @@ ATTR_RF_LOOP4 = 'rf_loop4'
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."""
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)
devices.append(device)
add_devices(devices)
add_entities(devices)
return True

View file

@ -14,7 +14,8 @@ DEPENDENCIES = ['android_ip_webcam']
@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."""
if discovery_info is None:
return
@ -23,7 +24,7 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
name = discovery_info[CONF_NAME]
ipcam = hass.data[DATA_IP_WEBCAM][host]
async_add_devices(
async_add_entities(
[IPWebcamBinarySensor(name, host, ipcam, 'motion_active')], True)

View file

@ -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."""
add_devices([OnlineStatus(config, apcupsd.DATA)], True)
add_entities([OnlineStatus(config, apcupsd.DATA)], True)
class OnlineStatus(BinarySensorDevice):

View file

@ -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."""
resource = config.get(CONF_RESOURCE)
pin = config.get(CONF_PIN)
@ -47,7 +47,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
arest = ArestData(resource, pin)
add_devices([ArestBinarySensor(
add_entities([ArestBinarySensor(
arest, resource, config.get(CONF_NAME, response[CONF_NAME]),
device_class, pin)], True)

View file

@ -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."""
data = hass.data[DATA_AUGUST]
devices = []
@ -62,7 +62,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
for sensor_type in SENSOR_TYPES:
devices.append(AugustBinarySensor(data, sensor_type, doorbell))
add_devices(devices, True)
add_entities(devices, True)
class AugustBinarySensor(BinarySensorDevice):

View file

@ -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."""
if None in (hass.config.latitude, hass.config.longitude):
_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)
return False
add_devices([AuroraSensor(aurora_data, name)], True)
add_entities([AuroraSensor(aurora_data, name)], True)
class AuroraSensor(BinarySensorDevice):

View file

@ -18,9 +18,9 @@ DEPENDENCIES = ['axis']
_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."""
add_devices([AxisBinarySensor(hass, discovery_info)], True)
add_entities([AxisBinarySensor(hass, discovery_info)], True)
class AxisBinarySensor(AxisDeviceEvent, BinarySensorDevice):

View file

@ -75,7 +75,8 @@ def update_probability(prior, prob_true, prob_false):
@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."""
name = config.get(CONF_NAME)
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)
device_class = config.get(CONF_DEVICE_CLASS)
async_add_devices([
async_add_entities([
BayesianBinarySensor(
name, prior, observations, probability_threshold, device_class)
], True)

View file

@ -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."""
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():
binary_sensors.append(BBBGPIOBinarySensor(pin, params))
add_devices(binary_sensors)
add_entities(binary_sensors)
class BBBGPIOBinarySensor(BinarySensorDevice):

View file

@ -10,7 +10,7 @@ from homeassistant.components.binary_sensor import BinarySensorDevice
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."""
if discovery_info is None:
return
@ -20,7 +20,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
for name in data.cameras:
devs.append(BlinkCameraMotionSensor(name, data))
devs.append(BlinkSystemSensor(data))
add_devices(devs, True)
add_entities(devs, True)
class BlinkCameraMotionSensor(BinarySensorDevice):

View file

@ -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."""
bloomsky = hass.components.bloomsky
# 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 variable in sensors:
add_devices(
add_entities(
[BloomSkySensor(bloomsky.BLOOMSKY, device, variable)], True)

View file

@ -31,7 +31,7 @@ SENSOR_TYPES_ELEC = {
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."""
accounts = hass.data[BMW_DOMAIN]
_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,
value[0], value[1])
devices.append(device)
add_devices(devices, True)
add_entities(devices, True)
class BMWConnectedDriveSensor(BinarySensorDevice):

View file

@ -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."""
name = config.get(CONF_NAME)
command = config.get(CONF_COMMAND)
@ -53,7 +53,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
value_template.hass = hass
data = CommandSensorData(hass, command, command_timeout)
add_devices([CommandBinarySensor(
add_entities([CommandBinarySensor(
hass, data, name, device_class, payload_on, payload_off,
value_template)], True)

View file

@ -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."""
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):

View file

@ -15,13 +15,13 @@ from homeassistant.helpers.dispatcher import async_dispatcher_connect
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):
"""Old way of setting up deCONZ binary sensors."""
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."""
@callback
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 \
not (not allow_clip_sensor and sensor.type.startswith('CLIP')):
entities.append(DeconzBinarySensor(sensor))
async_add_devices(entities, True)
async_add_entities(entities, True)
hass.data[DATA_DECONZ_UNSUB].append(
async_dispatcher_connect(hass, 'deconz_new_sensor', async_add_sensor))

View file

@ -7,9 +7,9 @@ https://home-assistant.io/components/demo/
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."""
add_devices([
add_entities([
DemoBinarySensor('Basement Floor Wet', False, 'moisture'),
DemoBinarySensor('Movement Backyard', True, 'motion'),
])

View file

@ -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."""
digital = hass.data.get(DATA_DIGITAL_OCEAN)
if not digital:
@ -44,7 +44,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
return False
dev.append(DigitalOceanBinarySensor(digital, droplet_id))
add_devices(dev, True)
add_entities(dev, True)
class DigitalOceanBinarySensor(BinarySensorDevice):

View file

@ -12,7 +12,7 @@ DEPENDENCIES = ['ecobee']
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."""
if discovery_info is None:
return
@ -26,7 +26,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
dev.append(EcobeeBinarySensor(sensor['name'], index))
add_devices(dev, True)
add_entities(dev, True)
class EcobeeBinarySensor(BinarySensorDevice):

View file

@ -19,7 +19,8 @@ EGARDIA_TYPE_TO_DEVICE_CLASS = {'IR Sensor': 'motion',
@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."""
if (discovery_info is None or
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]
# multiple devices here!
async_add_devices(
async_add_entities(
(
EgardiaBinarySensor(
sensor_id=disc_info[sensor]['id'],

View file

@ -15,7 +15,7 @@ _LOGGER = logging.getLogger(__name__)
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):
"""Set up the eight sleep binary sensor."""
if discovery_info is None:
@ -30,7 +30,7 @@ async def async_setup_platform(hass, config, async_add_devices,
for sensor in sensors:
all_sensors.append(EightHeatSensor(name, eight, sensor))
async_add_devices(all_sensors, True)
async_add_entities(all_sensors, True)
class EightHeatSensor(EightSleepHeatEntity, BinarySensorDevice):

View file

@ -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."""
dev_id = config.get(CONF_ID)
devname = config.get(CONF_NAME)
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):

View file

@ -23,7 +23,8 @@ DEPENDENCIES = ['envisalink']
@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."""
configured_zones = discovery_info['zones']
@ -40,7 +41,7 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
)
devices.append(device)
async_add_devices(devices)
async_add_entities(devices)
class EnvisalinkBinarySensor(EnvisalinkDevice, BinarySensorDevice):

View file

@ -47,7 +47,8 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
@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."""
manager = hass.data[DATA_FFMPEG]
@ -55,7 +56,7 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
return
entity = FFmpegMotion(hass, manager, config)
async_add_devices([entity])
async_add_entities([entity])
class FFmpegBinarySensor(FFmpegBase, BinarySensorDevice):

View file

@ -44,7 +44,8 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
@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."""
manager = hass.data[DATA_FFMPEG]
@ -52,7 +53,7 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
return
entity = FFmpegNoise(hass, manager, config)
async_add_devices([entity])
async_add_entities([entity])
class FFmpegNoise(FFmpegBinarySensor):

View file

@ -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."""
binary_sensors = []
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():
binary_sensors.append(GC100BinarySensor(
port_name, port_addr, hass.data[DATA_GC100]))
add_devices(binary_sensors, True)
add_entities(binary_sensors, True)
class GC100BinarySensor(BinarySensorDevice):

View file

@ -13,13 +13,13 @@ DEVICETYPE_DEVICE_CLASS = {'motionsensor': 'motion',
'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."""
if discovery_info is None:
return
session = hass.data.get(DATA_HIVE)
add_devices([HiveBinarySensorEntity(session, discovery_info)])
add_entities([HiveBinarySensorEntity(session, discovery_info)])
class HiveBinarySensorEntity(BinarySensorDevice):

View file

@ -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."""
if discovery_info is None:
return
@ -40,7 +40,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
new_device = HMBinarySensor(conf)
devices.append(new_device)
add_devices(devices)
add_entities(devices)
class HMBinarySensor(HMDevice, BinarySensorDevice):

View file

@ -19,12 +19,12 @@ STATE_SMOKE_OFF = 'IDLE_OFF'
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."""
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."""
from homematicip.aio.device import (
AsyncShutterContact, AsyncMotionDetectorIndoor, AsyncSmokeDetector)
@ -40,7 +40,7 @@ async def async_setup_entry(hass, config_entry, async_add_devices):
devices.append(HomematicipSmokeDetector(home, device))
if devices:
async_add_devices(devices)
async_add_entities(devices)
class HomematicipShutterContact(HomematicipGenericDevice, BinarySensorDevice):

View file

@ -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."""
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)
sensors.append(HydrawiseBinarySensor(zone_data, sensor_type))
add_devices(sensors, True)
add_entities(sensors, True)
class HydrawiseBinarySensor(HydrawiseEntity, BinarySensorDevice):

View file

@ -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."""
ihc_controller = hass.data[IHC_DATA][IHC_CONTROLLER]
info = hass.data[IHC_DATA][IHC_INFO]
@ -56,7 +56,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
sensor_type, inverting)
devices.append(sensor)
add_devices(devices)
add_entities(devices)
class IHCBinarySensor(IHCDevice, BinarySensorDevice):

View file

@ -23,7 +23,8 @@ SENSOR_TYPES = {'openClosedSensor': 'opening',
@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."""
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)
async_add_devices([new_entity])
async_add_entities([new_entity])
class InsteonBinarySensor(InsteonEntity, BinarySensorDevice):

View file

@ -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."""
if None in (hass.config.latitude, hass.config.longitude):
_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)
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):

View file

@ -29,7 +29,7 @@ ISY_DEVICE_TYPES = {
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."""
devices = []
devices_by_nid = {}
@ -75,7 +75,7 @@ def setup_platform(hass, config: ConfigType,
for name, status, _ in hass.data[ISY994_PROGRAMS][DOMAIN]:
devices.append(ISYBinarySensorProgram(name, status))
add_devices(devices)
add_entities(devices)
def _detect_device_type(node) -> str:

View file

@ -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):
"""Set up binary sensor(s) for KNX platform."""
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:
async_add_devices_config(hass, config, async_add_devices)
async_add_entities_config(hass, config, async_add_entities)
@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."""
entities = []
for device_name in discovery_info[ATTR_DISCOVER_DEVICES]:
device = hass.data[DATA_KNX].xknx.devices[device_name]
entities.append(KNXBinarySensor(hass, device))
async_add_devices(entities)
async_add_entities(entities)
@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."""
name = config.get(CONF_NAME)
import xknx
@ -97,7 +97,7 @@ def async_add_devices_config(hass, config, async_add_devices):
entity.automations.append(KNXAutomation(
hass=hass, device=binary_sensor, hook=hook,
action=action, counter=counter))
async_add_devices([entity])
async_add_entities([entity])
class KNXBinarySensor(BinarySensorDevice):

View file

@ -20,7 +20,7 @@ _LOGGER = logging.getLogger(__name__)
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):
"""Set up binary sensors attached to a Konnected device."""
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)
for pin_num, pin_data in
data[CONF_DEVICES][device_id][CONF_BINARY_SENSORS].items()]
async_add_devices(sensors)
async_add_entities(sensors)
class KonnectedBinarySensor(BinarySensorDevice):

View file

@ -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."""
linode = hass.data.get(DATA_LINODE)
nodes = config.get(CONF_NODES)
@ -40,7 +40,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
return
dev.append(LinodeBinarySensor(linode, node_id))
add_devices(dev, True)
add_entities(dev, True)
class LinodeBinarySensor(BinarySensorDevice):

View file

@ -13,7 +13,7 @@ from homeassistant.const import STATE_UNKNOWN
_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."""
devices = []
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))
if devices:
add_devices(devices)
add_entities(devices)
class MaxCubeShutter(BinarySensorDevice):

View file

@ -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."""
sensors = []
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_SLAVE),
coil.get(CONF_COIL)))
add_devices(sensors)
add_entities(sensors)
class ModbusCoilSensor(BinarySensorDevice):

View file

@ -45,7 +45,8 @@ PLATFORM_SCHEMA = mqtt.MQTT_RO_PLATFORM_SCHEMA.extend({
@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."""
if discovery_info is not None:
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:
value_template.hass = hass
async_add_devices([MqttBinarySensor(
async_add_entities([MqttBinarySensor(
config.get(CONF_NAME),
config.get(CONF_STATE_TOPIC),
config.get(CONF_AVAILABILITY_TOPIC),

View file

@ -23,7 +23,8 @@ SENSORS = [
@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."""
if discovery_info is None:
return
@ -34,7 +35,7 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
for car in hub.cars:
sensors.append(EVBinarySensor(hub, sconfig, car.vid))
async_add_devices(sensors)
async_add_entities(sensors)
class EVBinarySensor(BinarySensorDevice):

View file

@ -22,11 +22,11 @@ SENSORS = {
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."""
mysensors.setup_mysensors_platform(
hass, DOMAIN, discovery_info, MySensorsBinarySensor,
async_add_devices=async_add_devices)
async_add_entities=async_add_entities)
class MySensorsBinarySensor(

View file

@ -17,9 +17,10 @@ DEPENDENCIES = ['http']
@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."""
hass.http.register_view(MyStromView(async_add_devices))
hass.http.register_view(MyStromView(async_add_entities))
return True
@ -31,10 +32,10 @@ class MyStromView(HomeAssistantView):
name = 'api:mystrom'
supported_actions = ['single', 'double', 'long', 'touch']
def __init__(self, add_devices):
def __init__(self, add_entities):
"""Initialize the myStrom URL endpoint."""
self.buttons = {}
self.add_devices = add_devices
self.add_entities = add_entities
@asyncio.coroutine
def get(self, request):
@ -62,7 +63,7 @@ class MyStromView(HomeAssistantView):
button_id, button_action)
self.buttons[entity_id] = MyStromBinarySensor(
'{}_{}'.format(button_id, button_action))
hass.async_add_job(self.add_devices, [self.buttons[entity_id]])
self.add_entities([self.buttons[entity_id]])
else:
new_state = True if self.buttons[entity_id].state == 'off' \
else False

View file

@ -54,14 +54,14 @@ _VALID_BINARY_SENSOR_TYPES = {**BINARY_TYPES, **CLIMATE_BINARY_TYPES,
_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.
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."""
nest = hass.data[DATA_NEST]
@ -112,7 +112,7 @@ async def async_setup_entry(hass, entry, async_add_devices):
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):

View file

@ -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."""
netatmo = hass.components.netatmo
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]:
continue
for variable in welcome_sensors:
add_devices([NetatmoBinarySensor(
add_entities([NetatmoBinarySensor(
data, camera_name, module_name, home, timeout,
camera_type, variable)], True)
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]:
continue
for variable in presence_sensors:
add_devices([NetatmoBinarySensor(
add_entities([NetatmoBinarySensor(
data, camera_name, module_name, home, timeout,
camera_type, variable)], True)
for module_name in data.get_module_names(camera_name):
for variable in tag_sensors:
camera_type = None
add_devices([NetatmoBinarySensor(
add_entities([NetatmoBinarySensor(
data, camera_name, module_name, home, timeout,
camera_type, variable)], True)

View file

@ -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."""
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
if zone['number'] not in exclude}
if zone_sensors:
add_devices(zone_sensors.values())
add_entities(zone_sensors.values())
watcher = NX584Watcher(client, zone_sensors)
watcher.start()
else:

View file

@ -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."""
octoprint_api = hass.data[DOMAIN]["api"]
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],
SENSOR_TYPES[octo_type][1], 'flags')
devices.append(new_sensor)
add_devices(devices, True)
add_entities(devices, True)
class OctoPrintBinarySensor(BinarySensorDevice):

View file

@ -25,7 +25,7 @@ ATTR_PROTECTION_WINDOW_ENDING_UV = 'end_uv'
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."""
if discovery_info is None:
return
@ -38,7 +38,7 @@ async def async_setup_platform(
binary_sensors.append(
OpenUvBinarySensor(openuv, sensor_type, name, icon))
async_add_devices(binary_sensors, True)
async_add_entities(binary_sensors, True)
class OpenUvBinarySensor(OpenUvEntity, BinarySensorDevice):

View file

@ -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."""
disarm = config.get(CONF_DISARM_AFTER_TRIGGER)
if disarm:
add_devices([PilightTriggerSensor(
add_entities([PilightTriggerSensor(
hass=hass,
name=config.get(CONF_NAME),
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),
)])
else:
add_devices([PilightBinarySensor(
add_entities([PilightBinarySensor(
hass=hass,
name=config.get(CONF_NAME),
variable=config.get(CONF_VARIABLE),

View file

@ -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."""
name = config.get(CONF_NAME)
host = config.get(CONF_HOST)
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):

View file

@ -15,7 +15,7 @@ DEPENDENCIES = [QWIKSWITCH]
_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."""
if discovery_info is None:
return
@ -24,7 +24,7 @@ async def async_setup_platform(hass, _, add_devices, discovery_info=None):
_LOGGER.debug("Setup qwikswitch.binary_sensor %s, %s",
qsusb, discovery_info)
devs = [QSBinarySensor(sensor) for sensor in discovery_info[QWIKSWITCH]]
add_devices(devs)
add_entities(devs)
class QSBinarySensor(QSEntity, BinarySensorDevice):

View file

@ -24,13 +24,13 @@ DEPENDENCIES = ['rachio']
_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."""
devices = []
for controller in hass.data[DOMAIN_RACHIO].controllers:
devices.append(RachioControllerOnlineBinarySensor(hass, controller))
add_devices(devices)
add_entities(devices)
_LOGGER.info("%d Rachio binary sensor(s) added", len(devices))

View file

@ -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."""
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:
sensors.append(RainCloudBinarySensor(zone, sensor_type))
add_devices(sensors, True)
add_entities(sensors, True)
return True

View file

@ -21,7 +21,7 @@ _LOGGER = logging.getLogger(__name__)
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."""
if discovery_info is None:
return
@ -34,7 +34,7 @@ async def async_setup_platform(
binary_sensors.append(
RainMachineBinarySensor(rainmachine, sensor_type, name, icon))
async_add_devices(binary_sensors, True)
async_add_entities(binary_sensors, True)
class RainMachineBinarySensor(RainMachineEntity, BinarySensorDevice):

View file

@ -24,12 +24,12 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
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."""
name = config.get(CONF_NAME)
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):

View file

@ -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."""
I2CHatBinarySensor.I2C_HATS_MANAGER = hass.data[I2C_HATS_MANAGER]
binary_sensors = []
@ -65,7 +65,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
except I2CHatsException as ex:
_LOGGER.error("Failed to register %s I2CHat@%s %s",
board, hex(address), str(ex))
add_devices(binary_sensors)
add_entities(binary_sensors)
class I2CHatBinarySensor(BinarySensorDevice):

View file

@ -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."""
name = config.get(CONF_NAME)
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)
return False
add_devices([RestBinarySensor(
add_entities([RestBinarySensor(
hass, rest, name, device_class, value_template)], True)

View file

@ -42,7 +42,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
}, 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."""
import RFXtrx as rfxtrxmod
sensors = []
@ -71,7 +71,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
sensors.append(device)
rfxtrx.RFX_DEVICES[device_id] = device
add_devices(sensors)
add_entities(sensors)
def binary_sensor_update(event):
"""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.hass = hass
rfxtrx.RFX_DEVICES[device_id] = sensor
add_devices([sensor])
add_entities([sensor])
_LOGGER.info(
"Added binary sensor %s (Device ID: %s Class: %s Sub: %s)",
pkt_id, slugify(event.device.id_string.lower()),

View file

@ -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."""
ring = hass.data[DATA_RING]
@ -56,7 +56,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
sensors.append(RingBinarySensor(hass,
device,
sensor_type))
add_devices(sensors, True)
add_entities(sensors, True)
return True

View file

@ -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."""
pull_mode = config.get(CONF_PULL_MODE)
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():
binary_sensors.append(RPiGPIOBinarySensor(
port_name, port_num, pull_mode, bouncetime, invert_logic))
add_devices(binary_sensors, True)
add_entities(binary_sensors, True)
class RPiGPIOBinarySensor(BinarySensorDevice):

View file

@ -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."""
binary_sensors = []
ports = config.get(CONF_PORTS)
@ -50,7 +50,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
binary_sensors.append(RPiPFIOBinarySensor(
hass, port, name, settle_time, invert_logic))
add_devices(binary_sensors, True)
add_entities(binary_sensors, True)
rpi_pfio.activate_listener(hass)

View file

@ -21,7 +21,8 @@ _LOGGER = logging.getLogger(__name__)
@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."""
if not discovery_info:
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)
devices.append(device)
async_add_devices(devices)
async_add_entities(devices)
class SatelIntegraBinarySensor(BinarySensorDevice):

View file

@ -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."""
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():
sensors.append(SkybellBinarySensor(device, sensor_type))
add_devices(sensors, True)
add_entities(sensors, True)
class SkybellBinarySensor(SkybellDevice, BinarySensorDevice):

View file

@ -10,7 +10,7 @@ from homeassistant.components.binary_sensor import BinarySensorDevice
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."""
if discovery_info is None:
return
@ -22,7 +22,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
for bed_id, _ in data.beds.items():
for side in sleepiq.SIDES:
dev.append(IsInBedBinarySensor(data, bed_id, side))
add_devices(dev)
add_entities(dev)
class IsInBedBinarySensor(sleepiq.SleepIQSensor, BinarySensorDevice):

View file

@ -45,13 +45,14 @@ def _create_sensor(hass, zone):
@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."""
if (discovery_info is None or
discovery_info[ATTR_DISCOVER_DEVICES] is None):
return
async_add_devices(
async_add_entities(
_create_sensor(hass, zone)
for zone in discovery_info[ATTR_DISCOVER_DEVICES]
if _get_device_class(zone['type']))

View file

@ -21,14 +21,14 @@ _LOGGER = logging.getLogger(__name__)
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."""
_LOGGER.debug("Setup Tahoma Binary sensor platform")
controller = hass.data[TAHOMA_DOMAIN]['controller']
devices = []
for device in hass.data[TAHOMA_DOMAIN]['devices']['smoke']:
devices.append(TahomaBinarySensor(device, controller))
add_devices(devices, True)
add_entities(devices, True)
class TahomaBinarySensor(TahomaDevice, BinarySensorDevice):

View file

@ -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."""
name = config.get(CONF_NAME)
location = config.get(CONF_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):

View file

@ -15,9 +15,9 @@ _LOGGER = logging.getLogger(__name__)
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."""
add_devices([TcpBinarySensor(hass, config)])
add_entities([TcpBinarySensor(hass, config)])
class TcpBinarySensor(BinarySensorDevice, TcpSensor):

View file

@ -15,11 +15,11 @@ from homeassistant.components.binary_sensor import BinarySensorDevice
_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."""
if discovery_info is None:
return
add_devices(
add_entities(
TelldusLiveSensor(hass, binary_sensor)
for binary_sensor in discovery_info
)

View file

@ -47,7 +47,8 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
@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."""
sensors = []
@ -82,7 +83,7 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
_LOGGER.error("No sensors added")
return False
async_add_devices(sensors)
async_add_entities(sensors)
return True

View file

@ -15,13 +15,13 @@ _LOGGER = logging.getLogger(__name__)
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."""
devices = [
TeslaBinarySensor(
device, hass.data[TESLA_DOMAIN]['controller'], 'connectivity')
for device in hass.data[TESLA_DOMAIN]['devices']['binary_sensor']]
add_devices(devices, True)
add_entities(devices, True)
class TeslaBinarySensor(TeslaDevice, BinarySensorDevice):

View file

@ -55,7 +55,8 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
@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."""
entity_id = config.get(CONF_ENTITY_ID)
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)
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)

View file

@ -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."""
sensors = []
@ -80,7 +80,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
if not sensors:
_LOGGER.error("No sensors added")
return False
add_devices(sensors)
add_entities(sensors)
return True

View file

@ -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."""
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]
add_devices(devices, True)
add_entities(devices, True)
class UpCloudBinarySensor(UpCloudServerEntity, BinarySensorDevice):

View file

@ -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."""
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'],
monitor['url']))
add_devices(devices, True)
add_entities(devices, True)
class UptimeRobotBinarySensor(BinarySensorDevice):

View file

@ -15,7 +15,7 @@ _LOGGER = logging.getLogger(__name__)
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):
"""Set up Velbus binary sensors."""
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])
channel = sensor[1]
sensors.append(VelbusBinarySensor(module, channel))
async_add_devices(sensors)
async_add_entities(sensors)
class VelbusBinarySensor(VelbusEntity, BinarySensorDevice):

View file

@ -16,9 +16,9 @@ DEPENDENCIES = ['vera']
_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."""
add_devices(
add_entities(
[VeraBinarySensor(device, hass.data[VERA_CONTROLLER])
for device in hass.data[VERA_DEVICES]['binary_sensor']], True)

View file

@ -13,7 +13,7 @@ from homeassistant.components.verisure import HUB as hub
_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 binary sensors."""
sensors = []
hub.update_overview()
@ -23,7 +23,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
VerisureDoorWindowSensor(device_label)
for device_label in hub.get(
"$.doorWindow.doorWindowDevice[*].deviceLabel")])
add_devices(sensors)
add_entities(sensors)
class VerisureDoorWindowSensor(BinarySensorDevice):

View file

@ -12,11 +12,11 @@ from homeassistant.components.binary_sensor import BinarySensorDevice
_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 Volvo sensors."""
if discovery_info is None:
return
add_devices([VolvoSensor(hass, *discovery_info)])
add_entities([VolvoSensor(hass, *discovery_info)])
class VolvoSensor(VolvoEntity, BinarySensorDevice):

View file

@ -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 Vultr subscription (server) binary sensor."""
vultr = hass.data[DATA_VULTR]
@ -41,7 +41,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
_LOGGER.error("Subscription %s not found", subscription)
return
add_devices([VultrBinarySensor(vultr, subscription, name)], True)
add_entities([VultrBinarySensor(vultr, subscription, name)], True)
class VultrBinarySensor(BinarySensorDevice):

View file

@ -15,7 +15,7 @@ DEPENDENCIES = ['wemo']
_LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_devices_callback, discovery_info=None):
def setup_platform(hass, config, add_entities_callback, discovery_info=None):
"""Register discovered WeMo binary sensors."""
from pywemo import discovery
@ -31,7 +31,7 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
raise PlatformNotReady
if device:
add_devices_callback([WemoBinarySensor(hass, device)])
add_entities_callback([WemoBinarySensor(hass, device)])
class WemoBinarySensor(BinarySensorDevice):

View file

@ -31,7 +31,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 Wink binary sensor platform."""
import pywink
@ -39,49 +39,49 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
_id = sensor.object_id() + sensor.name()
if _id not in hass.data[DOMAIN]['unique_ids']:
if sensor.capability() in SENSOR_TYPES:
add_devices([WinkBinarySensorDevice(sensor, hass)])
add_entities([WinkBinarySensorDevice(sensor, hass)])
for key in pywink.get_keys():
_id = key.object_id() + key.name()
if _id not in hass.data[DOMAIN]['unique_ids']:
add_devices([WinkBinarySensorDevice(key, hass)])
add_entities([WinkBinarySensorDevice(key, hass)])
for sensor in pywink.get_smoke_and_co_detectors():
_id = sensor.object_id() + sensor.name()
if _id not in hass.data[DOMAIN]['unique_ids']:
add_devices([WinkSmokeDetector(sensor, hass)])
add_entities([WinkSmokeDetector(sensor, hass)])
for hub in pywink.get_hubs():
_id = hub.object_id() + hub.name()
if _id not in hass.data[DOMAIN]['unique_ids']:
add_devices([WinkHub(hub, hass)])
add_entities([WinkHub(hub, hass)])
for remote in pywink.get_remotes():
_id = remote.object_id() + remote.name()
if _id not in hass.data[DOMAIN]['unique_ids']:
add_devices([WinkRemote(remote, hass)])
add_entities([WinkRemote(remote, hass)])
for button in pywink.get_buttons():
_id = button.object_id() + button.name()
if _id not in hass.data[DOMAIN]['unique_ids']:
add_devices([WinkButton(button, hass)])
add_entities([WinkButton(button, hass)])
for gang in pywink.get_gangs():
_id = gang.object_id() + gang.name()
if _id not in hass.data[DOMAIN]['unique_ids']:
add_devices([WinkGang(gang, hass)])
add_entities([WinkGang(gang, hass)])
for door_bell_sensor in pywink.get_door_bells():
_id = door_bell_sensor.object_id() + door_bell_sensor.name()
if _id not in hass.data[DOMAIN]['unique_ids']:
add_devices([WinkBinarySensorDevice(door_bell_sensor, hass)])
add_entities([WinkBinarySensorDevice(door_bell_sensor, hass)])
for camera_sensor in pywink.get_cameras():
_id = camera_sensor.object_id() + camera_sensor.name()
if _id not in hass.data[DOMAIN]['unique_ids']:
try:
if camera_sensor.capability() in SENSOR_TYPES:
add_devices([WinkBinarySensorDevice(camera_sensor, hass)])
add_entities([WinkBinarySensorDevice(camera_sensor, hass)])
except AttributeError:
_LOGGER.info("Device isn't a sensor, skipping")

View file

@ -107,7 +107,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 WirelessTags."""
platform = hass.data.get(WIRELESSTAG_DOMAIN)
@ -120,7 +120,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
sensors.append(WirelessTagBinarySensor(platform, tag,
sensor_type))
add_devices(sensors, True)
add_entities(sensors, True)
hass.add_job(platform.install_push_notifications, sensors)

View file

@ -58,7 +58,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 Workday sensor."""
import holidays
@ -92,7 +92,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
for date, name in sorted(obj_holidays.items()):
_LOGGER.debug("%s %s", date, name)
add_devices([IsWorkdaySensor(
add_entities([IsWorkdaySensor(
obj_holidays, workdays, excludes, days_offset, sensor_name)], True)

View file

@ -19,7 +19,7 @@ DENSITY = 'density'
ATTR_DENSITY = 'Density'
def setup_platform(hass, config, add_devices, discovery_info=None):
def setup_platform(hass, config, add_entities, discovery_info=None):
"""Perform the setup for Xiaomi devices."""
devices = []
for (_, gateway) in hass.data[PY_XIAOMI_GATEWAY].gateways.items():
@ -65,7 +65,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
'dual_channel', hass, gateway))
elif model in ['cube', 'sensor_cube', 'sensor_cube.aqgl01']:
devices.append(XiaomiCube(device, hass, gateway))
add_devices(devices)
add_entities(devices)
class XiaomiBinarySensor(XiaomiDevice, BinarySensorDevice):

View file

@ -24,7 +24,7 @@ CLASS_MAPPING = {
}
async def async_setup_platform(hass, config, async_add_devices,
async def async_setup_platform(hass, config, async_add_entities,
discovery_info=None):
"""Set up the Zigbee Home Automation binary sensors."""
discovery_info = zha.get_discovery_info(hass, discovery_info)
@ -34,14 +34,14 @@ async def async_setup_platform(hass, config, async_add_devices,
from zigpy.zcl.clusters.general import OnOff
from zigpy.zcl.clusters.security import IasZone
if IasZone.cluster_id in discovery_info['in_clusters']:
await _async_setup_iaszone(hass, config, async_add_devices,
await _async_setup_iaszone(hass, config, async_add_entities,
discovery_info)
elif OnOff.cluster_id in discovery_info['out_clusters']:
await _async_setup_remote(hass, config, async_add_devices,
await _async_setup_remote(hass, config, async_add_entities,
discovery_info)
async def _async_setup_iaszone(hass, config, async_add_devices,
async def _async_setup_iaszone(hass, config, async_add_entities,
discovery_info):
device_class = None
from zigpy.zcl.clusters.security import IasZone
@ -59,10 +59,11 @@ async def _async_setup_iaszone(hass, config, async_add_devices,
pass
sensor = BinarySensor(device_class, **discovery_info)
async_add_devices([sensor], update_before_add=True)
async_add_entities([sensor], update_before_add=True)
async def _async_setup_remote(hass, config, async_add_devices, discovery_info):
async def _async_setup_remote(hass, config, async_add_entities,
discovery_info):
async def safe(coro):
"""Run coro, catching ZigBee delivery errors, and ignoring them."""
@ -85,7 +86,7 @@ async def _async_setup_remote(hass, config, async_add_devices, discovery_info):
await safe(cluster.configure_reporting(0, 1, 600, 1))
sensor = Switch(**discovery_info)
async_add_devices([sensor], update_before_add=True)
async_add_entities([sensor], update_before_add=True)
class BinarySensor(zha.Entity, BinarySensorDevice):

View file

@ -22,9 +22,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 the ZigBee binary sensor platform."""
add_devices(
add_entities(
[ZigBeeBinarySensor(hass, ZigBeeDigitalInConfig(config))], True)