Disable too-many-* (#4107)
* Disable too-many-* and too-few-public-methods * Remove globally disabled pylint warnings
This commit is contained in:
parent
b910a9917d
commit
be272ac64a
298 changed files with 271 additions and 570 deletions
|
@ -99,8 +99,7 @@ def _async_setup_component(hass: core.HomeAssistant,
|
||||||
|
|
||||||
This method is a coroutine.
|
This method is a coroutine.
|
||||||
"""
|
"""
|
||||||
# pylint: disable=too-many-return-statements,too-many-branches
|
# pylint: disable=too-many-return-statements
|
||||||
# pylint: disable=too-many-statements
|
|
||||||
if domain in hass.config.components:
|
if domain in hass.config.components:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -312,7 +311,6 @@ def async_prepare_setup_platform(hass: core.HomeAssistant, config, domain: str,
|
||||||
return platform
|
return platform
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-branches, too-many-statements, too-many-arguments
|
|
||||||
def from_config_dict(config: Dict[str, Any],
|
def from_config_dict(config: Dict[str, Any],
|
||||||
hass: Optional[core.HomeAssistant]=None,
|
hass: Optional[core.HomeAssistant]=None,
|
||||||
config_dir: Optional[str]=None,
|
config_dir: Optional[str]=None,
|
||||||
|
@ -352,7 +350,6 @@ def from_config_dict(config: Dict[str, Any],
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
# pylint: disable=too-many-branches, too-many-statements, too-many-arguments
|
|
||||||
def async_from_config_dict(config: Dict[str, Any],
|
def async_from_config_dict(config: Dict[str, Any],
|
||||||
hass: core.HomeAssistant,
|
hass: core.HomeAssistant,
|
||||||
config_dir: Optional[str]=None,
|
config_dir: Optional[str]=None,
|
||||||
|
|
|
@ -42,7 +42,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
add_devices([AlarmDotCom(hass, name, code, username, password)])
|
add_devices([AlarmDotCom(hass, name, code, username, password)])
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments, too-many-instance-attributes
|
|
||||||
# pylint: disable=abstract-method
|
# pylint: disable=abstract-method
|
||||||
class AlarmDotCom(alarm.AlarmControlPanel):
|
class AlarmDotCom(alarm.AlarmControlPanel):
|
||||||
"""Represent an Alarm.com status."""
|
"""Represent an Alarm.com status."""
|
||||||
|
|
|
@ -43,7 +43,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
class EnvisalinkAlarm(EnvisalinkDevice, alarm.AlarmControlPanel):
|
class EnvisalinkAlarm(EnvisalinkDevice, alarm.AlarmControlPanel):
|
||||||
"""Representation of an Envisalink-based alarm panel."""
|
"""Representation of an Envisalink-based alarm panel."""
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments
|
|
||||||
def __init__(self, partition_number, alarm_name, code, panic_type, info,
|
def __init__(self, partition_number, alarm_name, code, panic_type, info,
|
||||||
controller):
|
controller):
|
||||||
"""Initialize the alarm panel."""
|
"""Initialize the alarm panel."""
|
||||||
|
|
|
@ -50,7 +50,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
)])
|
)])
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments, too-many-instance-attributes
|
|
||||||
# pylint: disable=abstract-method
|
# pylint: disable=abstract-method
|
||||||
class ManualAlarm(alarm.AlarmControlPanel):
|
class ManualAlarm(alarm.AlarmControlPanel):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -55,7 +55,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
config.get(CONF_CODE))])
|
config.get(CONF_CODE))])
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments, too-many-instance-attributes
|
|
||||||
# pylint: disable=abstract-method
|
# pylint: disable=abstract-method
|
||||||
class MqttAlarm(alarm.AlarmControlPanel):
|
class MqttAlarm(alarm.AlarmControlPanel):
|
||||||
"""Representation of a MQTT alarm status."""
|
"""Representation of a MQTT alarm status."""
|
||||||
|
|
|
@ -286,7 +286,6 @@ class AlexaFlashBriefingView(HomeAssistantView):
|
||||||
self.flash_briefings = copy.deepcopy(flash_briefings)
|
self.flash_briefings = copy.deepcopy(flash_briefings)
|
||||||
template.attach(hass, self.flash_briefings)
|
template.attach(hass, self.flash_briefings)
|
||||||
|
|
||||||
# pylint: disable=too-many-branches
|
|
||||||
@callback
|
@callback
|
||||||
def get(self, request, briefing_id):
|
def get(self, request, briefing_id):
|
||||||
"""Handle Alexa Flash Briefing request."""
|
"""Handle Alexa Flash Briefing request."""
|
||||||
|
|
|
@ -219,7 +219,6 @@ class AutomationEntity(ToggleEntity):
|
||||||
"""Entity to show status of entity."""
|
"""Entity to show status of entity."""
|
||||||
|
|
||||||
# pylint: disable=abstract-method
|
# pylint: disable=abstract-method
|
||||||
# pylint: disable=too-many-arguments, too-many-instance-attributes
|
|
||||||
def __init__(self, name, async_attach_triggers, cond_func, async_action,
|
def __init__(self, name, async_attach_triggers, cond_func, async_action,
|
||||||
hidden):
|
hidden):
|
||||||
"""Initialize an automation entity."""
|
"""Initialize an automation entity."""
|
||||||
|
|
|
@ -54,7 +54,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
sensor_class, pin)])
|
sensor_class, pin)])
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-instance-attributes, too-many-arguments
|
|
||||||
class ArestBinarySensor(BinarySensorDevice):
|
class ArestBinarySensor(BinarySensorDevice):
|
||||||
"""Implement an aREST binary sensor for a pin."""
|
"""Implement an aREST binary sensor for a pin."""
|
||||||
|
|
||||||
|
@ -93,7 +92,6 @@ class ArestBinarySensor(BinarySensorDevice):
|
||||||
self.arest.update()
|
self.arest.update()
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-few-public-methods
|
|
||||||
class ArestData(object):
|
class ArestData(object):
|
||||||
"""Class for handling the data retrieval for pins."""
|
"""Class for handling the data retrieval for pins."""
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
value_template)])
|
value_template)])
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments, too-many-instance-attributes
|
|
||||||
class CommandBinarySensor(BinarySensorDevice):
|
class CommandBinarySensor(BinarySensorDevice):
|
||||||
"""Represent a command line binary sensor."""
|
"""Represent a command line binary sensor."""
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-locals
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_devices, 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
|
||||||
|
|
|
@ -35,7 +35,6 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
|
||||||
class EnvisalinkBinarySensor(EnvisalinkDevice, BinarySensorDevice):
|
class EnvisalinkBinarySensor(EnvisalinkDevice, BinarySensorDevice):
|
||||||
"""Representation of an Envisalink binary sensor."""
|
"""Representation of an Envisalink binary sensor."""
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments
|
|
||||||
def __init__(self, zone_number, zone_name, zone_type, info, controller):
|
def __init__(self, zone_number, zone_name, zone_type, info, controller):
|
||||||
"""Initialize the binary_sensor."""
|
"""Initialize the binary_sensor."""
|
||||||
from pydispatch import dispatcher
|
from pydispatch import dispatcher
|
||||||
|
|
|
@ -51,7 +51,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
)])
|
)])
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments, too-many-instance-attributes
|
|
||||||
class MqttBinarySensor(BinarySensorDevice):
|
class MqttBinarySensor(BinarySensorDevice):
|
||||||
"""Representation a binary sensor that is updated by MQTT."""
|
"""Representation a binary sensor that is updated by MQTT."""
|
||||||
|
|
||||||
|
|
|
@ -58,11 +58,9 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
add_devices(devices)
|
add_devices(devices)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-instance-attributes
|
|
||||||
class OctoPrintBinarySensor(BinarySensorDevice):
|
class OctoPrintBinarySensor(BinarySensorDevice):
|
||||||
"""Representation an OctoPrint binary sensor."""
|
"""Representation an OctoPrint binary sensor."""
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments
|
|
||||||
def __init__(self, api, condition, sensor_type, sensor_name, unit,
|
def __init__(self, api, condition, sensor_type, sensor_name, unit,
|
||||||
endpoint, group, tool=None):
|
endpoint, group, tool=None):
|
||||||
"""Initialize a new OctoPrint sensor."""
|
"""Initialize a new OctoPrint sensor."""
|
||||||
|
|
|
@ -41,7 +41,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=unused-variable, too-many-locals
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
"""Setup the REST binary sensor."""
|
"""Setup the REST binary sensor."""
|
||||||
name = config.get(CONF_NAME)
|
name = config.get(CONF_NAME)
|
||||||
|
@ -76,7 +75,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
hass, rest, name, sensor_class, value_template)])
|
hass, rest, name, sensor_class, value_template)])
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments
|
|
||||||
class RestBinarySensor(BinarySensorDevice):
|
class RestBinarySensor(BinarySensorDevice):
|
||||||
"""Representation of a REST binary sensor."""
|
"""Representation of a REST binary sensor."""
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
add_devices(binary_sensors)
|
add_devices(binary_sensors)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments, too-many-instance-attributes
|
|
||||||
class RPiGPIOBinarySensor(BinarySensorDevice):
|
class RPiGPIOBinarySensor(BinarySensorDevice):
|
||||||
"""Represent a binary sensor that uses Raspberry Pi GPIO."""
|
"""Represent a binary sensor that uses Raspberry Pi GPIO."""
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
add_devices(dev)
|
add_devices(dev)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-instance-attributes
|
|
||||||
class IsInBedBinarySensor(sleepiq.SleepIQSensor, BinarySensorDevice):
|
class IsInBedBinarySensor(sleepiq.SleepIQSensor, BinarySensorDevice):
|
||||||
"""Implementation of a SleepIQ presence sensor."""
|
"""Implementation of a SleepIQ presence sensor."""
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,6 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
||||||
class BinarySensorTemplate(BinarySensorDevice):
|
class BinarySensorTemplate(BinarySensorDevice):
|
||||||
"""A virtual binary sensor that triggers from another sensor."""
|
"""A virtual binary sensor that triggers from another sensor."""
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments
|
|
||||||
def __init__(self, hass, device, friendly_name, sensor_class,
|
def __init__(self, hass, device, friendly_name, sensor_class,
|
||||||
value_template, entity_ids):
|
value_template, entity_ids):
|
||||||
"""Initialize the Template binary sensor."""
|
"""Initialize the Template binary sensor."""
|
||||||
|
|
|
@ -72,7 +72,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
class SensorTrend(BinarySensorDevice):
|
class SensorTrend(BinarySensorDevice):
|
||||||
"""Representation of a trend Sensor."""
|
"""Representation of a trend Sensor."""
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments, too-many-instance-attributes
|
|
||||||
def __init__(self, hass, device_id, friendly_name,
|
def __init__(self, hass, device_id, friendly_name,
|
||||||
target_entity, attribute, sensor_class, invert):
|
target_entity, attribute, sensor_class, invert):
|
||||||
"""Initialize the sensor."""
|
"""Initialize the sensor."""
|
||||||
|
|
|
@ -33,7 +33,7 @@ CONFIG_SCHEMA = vol.Schema({
|
||||||
}, extra=vol.ALLOW_EXTRA)
|
}, extra=vol.ALLOW_EXTRA)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=unused-argument,too-few-public-methods
|
# pylint: disable=unused-argument
|
||||||
def setup(hass, config):
|
def setup(hass, config):
|
||||||
"""Setup BloomSky component."""
|
"""Setup BloomSky component."""
|
||||||
api_key = config[DOMAIN][CONF_API_KEY]
|
api_key = config[DOMAIN][CONF_API_KEY]
|
||||||
|
|
|
@ -28,7 +28,6 @@ ENTITY_IMAGE_URL = '/api/camera_proxy/{0}?token={1}'
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
# pylint: disable=too-many-branches
|
|
||||||
def async_setup(hass, config):
|
def async_setup(hass, config):
|
||||||
"""Setup the camera component."""
|
"""Setup the camera component."""
|
||||||
component = EntityComponent(
|
component = EntityComponent(
|
||||||
|
|
|
@ -36,7 +36,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
add_devices([FoscamCamera(config)])
|
add_devices([FoscamCamera(config)])
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-instance-attributes
|
|
||||||
class FoscamCamera(Camera):
|
class FoscamCamera(Camera):
|
||||||
"""An implementation of a Foscam IP camera."""
|
"""An implementation of a Foscam IP camera."""
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,6 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
||||||
hass.loop.create_task(async_add_devices([GenericCamera(hass, config)]))
|
hass.loop.create_task(async_add_devices([GenericCamera(hass, config)]))
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-instance-attributes
|
|
||||||
class GenericCamera(Camera):
|
class GenericCamera(Camera):
|
||||||
"""A generic implementation of an IP camera."""
|
"""A generic implementation of an IP camera."""
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,6 @@ def extract_image_from_mjpeg(stream):
|
||||||
return jpg
|
return jpg
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-instance-attributes
|
|
||||||
class MjpegCamera(Camera):
|
class MjpegCamera(Camera):
|
||||||
"""An implementation of an IP camera that is reachable over a URL."""
|
"""An implementation of an IP camera that is reachable over a URL."""
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@ from homeassistant.util.async import run_coroutine_threadsafe
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
# pylint: disable=too-many-locals
|
|
||||||
DEFAULT_NAME = 'Synology Camera'
|
DEFAULT_NAME = 'Synology Camera'
|
||||||
DEFAULT_STREAM_ID = '0'
|
DEFAULT_STREAM_ID = '0'
|
||||||
TIMEOUT = 5
|
TIMEOUT = 5
|
||||||
|
@ -179,11 +178,9 @@ def get_session_id(hass, username, password, login_url, valid_cert):
|
||||||
return auth_resp['data']['sid']
|
return auth_resp['data']['sid']
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-instance-attributes
|
|
||||||
class SynologyCamera(Camera):
|
class SynologyCamera(Camera):
|
||||||
"""An implementation of a Synology NAS based IP camera."""
|
"""An implementation of a Synology NAS based IP camera."""
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments
|
|
||||||
def __init__(self, config, camera_id, camera_name,
|
def __init__(self, config, camera_id, camera_name,
|
||||||
snapshot_path, streaming_path, camera_path, auth_path):
|
snapshot_path, streaming_path, camera_path, auth_path):
|
||||||
"""Initialize a Synology Surveillance Station camera."""
|
"""Initialize a Synology Surveillance Station camera."""
|
||||||
|
|
|
@ -123,7 +123,6 @@ def set_aux_heat(hass, aux_heat, entity_id=None):
|
||||||
hass.services.call(DOMAIN, SERVICE_SET_AUX_HEAT, data)
|
hass.services.call(DOMAIN, SERVICE_SET_AUX_HEAT, data)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments
|
|
||||||
def set_temperature(hass, temperature=None, entity_id=None,
|
def set_temperature(hass, temperature=None, entity_id=None,
|
||||||
target_temp_high=None, target_temp_low=None,
|
target_temp_high=None, target_temp_low=None,
|
||||||
operation_mode=None):
|
operation_mode=None):
|
||||||
|
@ -181,7 +180,6 @@ def set_swing_mode(hass, swing_mode, entity_id=None):
|
||||||
hass.services.call(DOMAIN, SERVICE_SET_SWING_MODE, data)
|
hass.services.call(DOMAIN, SERVICE_SET_SWING_MODE, data)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-branches
|
|
||||||
def setup(hass, config):
|
def setup(hass, config):
|
||||||
"""Setup climate devices."""
|
"""Setup climate devices."""
|
||||||
component = EntityComponent(_LOGGER, DOMAIN, hass, SCAN_INTERVAL)
|
component = EntityComponent(_LOGGER, DOMAIN, hass, SCAN_INTERVAL)
|
||||||
|
@ -364,7 +362,7 @@ def setup(hass, config):
|
||||||
class ClimateDevice(Entity):
|
class ClimateDevice(Entity):
|
||||||
"""Representation of a climate device."""
|
"""Representation of a climate device."""
|
||||||
|
|
||||||
# pylint: disable=too-many-public-methods,no-self-use
|
# pylint: disable=no-self-use
|
||||||
@property
|
@property
|
||||||
def state(self):
|
def state(self):
|
||||||
"""Return the current state."""
|
"""Return the current state."""
|
||||||
|
|
|
@ -21,11 +21,9 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments, too-many-public-methods
|
|
||||||
class DemoClimate(ClimateDevice):
|
class DemoClimate(ClimateDevice):
|
||||||
"""Representation of a demo climate device."""
|
"""Representation of a demo climate device."""
|
||||||
|
|
||||||
# pylint: disable=too-many-instance-attributes
|
|
||||||
def __init__(self, name, target_temperature, unit_of_measurement,
|
def __init__(self, name, target_temperature, unit_of_measurement,
|
||||||
away, current_temperature, current_fan_mode,
|
away, current_temperature, current_fan_mode,
|
||||||
target_humidity, current_humidity, current_swing_mode,
|
target_humidity, current_humidity, current_swing_mode,
|
||||||
|
|
|
@ -72,7 +72,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
schema=SET_FAN_MIN_ON_TIME_SCHEMA)
|
schema=SET_FAN_MIN_ON_TIME_SCHEMA)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-public-methods, abstract-method
|
# pylint: disable=abstract-method
|
||||||
class Thermostat(ClimateDevice):
|
class Thermostat(ClimateDevice):
|
||||||
"""A thermostat class for Ecobee."""
|
"""A thermostat class for Ecobee."""
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
add_devices(devices)
|
add_devices(devices)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-instance-attributes, import-error, abstract-method
|
# pylint: disable=import-error, abstract-method
|
||||||
class EQ3BTSmartThermostat(ClimateDevice):
|
class EQ3BTSmartThermostat(ClimateDevice):
|
||||||
"""Representation of a eQ-3 Bluetooth Smart thermostat."""
|
"""Representation of a eQ-3 Bluetooth Smart thermostat."""
|
||||||
|
|
||||||
|
|
|
@ -62,11 +62,10 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
target_temp, ac_mode, min_cycle_duration)])
|
target_temp, ac_mode, min_cycle_duration)])
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-instance-attributes, abstract-method
|
# pylint: disable=abstract-method
|
||||||
class GenericThermostat(ClimateDevice):
|
class GenericThermostat(ClimateDevice):
|
||||||
"""Representation of a GenericThermostat device."""
|
"""Representation of a GenericThermostat device."""
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments
|
|
||||||
def __init__(self, hass, name, heater_entity_id, sensor_entity_id,
|
def __init__(self, hass, name, heater_entity_id, sensor_entity_id,
|
||||||
min_temp, max_temp, target_temp, ac_mode, min_cycle_duration):
|
min_temp, max_temp, target_temp, ac_mode, min_cycle_duration):
|
||||||
"""Initialize the thermostat."""
|
"""Initialize the thermostat."""
|
||||||
|
|
|
@ -56,7 +56,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
class HeatmiserV3Thermostat(ClimateDevice):
|
class HeatmiserV3Thermostat(ClimateDevice):
|
||||||
"""Representation of a HeatmiserV3 thermostat."""
|
"""Representation of a HeatmiserV3 thermostat."""
|
||||||
|
|
||||||
# pylint: disable=too-many-instance-attributes, abstract-method
|
# pylint: disable=abstract-method
|
||||||
def __init__(self, heatmiser, device, name, serport):
|
def __init__(self, heatmiser, device, name, serport):
|
||||||
"""Initialize the thermostat."""
|
"""Initialize the thermostat."""
|
||||||
self.heatmiser = heatmiser
|
self.heatmiser = heatmiser
|
||||||
|
|
|
@ -100,7 +100,7 @@ def _setup_us(username, password, config, add_devices):
|
||||||
class RoundThermostat(ClimateDevice):
|
class RoundThermostat(ClimateDevice):
|
||||||
"""Representation of a Honeywell Round Connected thermostat."""
|
"""Representation of a Honeywell Round Connected thermostat."""
|
||||||
|
|
||||||
# pylint: disable=too-many-instance-attributes, abstract-method
|
# pylint: disable=abstract-method
|
||||||
def __init__(self, device, zone_id, master, away_temp):
|
def __init__(self, device, zone_id, master, away_temp):
|
||||||
"""Initialize the thermostat."""
|
"""Initialize the thermostat."""
|
||||||
self.device = device
|
self.device = device
|
||||||
|
|
|
@ -37,7 +37,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
map_sv_types, devices, add_devices, MySensorsHVAC))
|
map_sv_types, devices, add_devices, MySensorsHVAC))
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments, too-many-public-methods
|
|
||||||
class MySensorsHVAC(mysensors.MySensorsDeviceEntity, ClimateDevice):
|
class MySensorsHVAC(mysensors.MySensorsDeviceEntity, ClimateDevice):
|
||||||
"""Representation of a MySensorsHVAC hvac."""
|
"""Representation of a MySensorsHVAC hvac."""
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
for structure, device in nest.devices()])
|
for structure, device in nest.devices()])
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=abstract-method,too-many-public-methods
|
# pylint: disable=abstract-method
|
||||||
class NestThermostat(ClimateDevice):
|
class NestThermostat(ClimateDevice):
|
||||||
"""Representation of a Nest thermostat."""
|
"""Representation of a Nest thermostat."""
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
class ZWaveClimate(ZWaveDeviceEntity, ClimateDevice):
|
class ZWaveClimate(ZWaveDeviceEntity, ClimateDevice):
|
||||||
"""Represents a ZWave Climate device."""
|
"""Represents a ZWave Climate device."""
|
||||||
|
|
||||||
# pylint: disable=too-many-instance-attributes
|
|
||||||
def __init__(self, value, temp_unit):
|
def __init__(self, value, temp_unit):
|
||||||
"""Initialize the zwave climate device."""
|
"""Initialize the zwave climate device."""
|
||||||
from openzwave.network import ZWaveNetwork
|
from openzwave.network import ZWaveNetwork
|
||||||
|
@ -121,7 +120,6 @@ class ZWaveClimate(ZWaveDeviceEntity, ClimateDevice):
|
||||||
self.update_ha_state()
|
self.update_ha_state()
|
||||||
_LOGGER.debug("Value changed on network %s", value)
|
_LOGGER.debug("Value changed on network %s", value)
|
||||||
|
|
||||||
# pylint: disable=too-many-branches
|
|
||||||
def update_properties(self):
|
def update_properties(self):
|
||||||
"""Callback on data change for the registered node/value pair."""
|
"""Callback on data change for the registered node/value pair."""
|
||||||
# Operation Mode
|
# Operation Mode
|
||||||
|
|
|
@ -34,7 +34,6 @@ STATE_CONFIGURE = 'configure'
|
||||||
STATE_CONFIGURED = 'configured'
|
STATE_CONFIGURED = 'configured'
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments
|
|
||||||
def request_config(
|
def request_config(
|
||||||
hass, name, callback, description=None, description_image=None,
|
hass, name, callback, description=None, description_image=None,
|
||||||
submit_caption=None, fields=None, link_name=None, link_url=None,
|
submit_caption=None, fields=None, link_name=None, link_url=None,
|
||||||
|
@ -102,7 +101,6 @@ class Configurator(object):
|
||||||
hass.services.register(
|
hass.services.register(
|
||||||
DOMAIN, SERVICE_CONFIGURE, self.handle_service_call)
|
DOMAIN, SERVICE_CONFIGURE, self.handle_service_call)
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments
|
|
||||||
def request_config(
|
def request_config(
|
||||||
self, name, callback,
|
self, name, callback,
|
||||||
description, description_image, submit_caption,
|
description, description_image, submit_caption,
|
||||||
|
|
|
@ -60,11 +60,9 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
add_devices(covers)
|
add_devices(covers)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments, too-many-instance-attributes
|
|
||||||
class CommandCover(CoverDevice):
|
class CommandCover(CoverDevice):
|
||||||
"""Representation a command line cover."""
|
"""Representation a command line cover."""
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments
|
|
||||||
def __init__(self, hass, name, command_open, command_close, command_stop,
|
def __init__(self, hass, name, command_open, command_close, command_stop,
|
||||||
command_state, value_template):
|
command_state, value_template):
|
||||||
"""Initialize the cover."""
|
"""Initialize the cover."""
|
||||||
|
|
|
@ -20,7 +20,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
class DemoCover(CoverDevice):
|
class DemoCover(CoverDevice):
|
||||||
"""Representation of a demo cover."""
|
"""Representation of a demo cover."""
|
||||||
|
|
||||||
# pylint: disable=no-self-use, too-many-instance-attributes
|
# pylint: disable=no-self-use
|
||||||
def __init__(self, hass, name, position=None, tilt_position=None):
|
def __init__(self, hass, name, position=None, tilt_position=None):
|
||||||
"""Initialize the cover."""
|
"""Initialize the cover."""
|
||||||
self.hass = hass
|
self.hass = hass
|
||||||
|
|
|
@ -67,7 +67,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
)])
|
)])
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments, too-many-instance-attributes
|
|
||||||
class MqttCover(CoverDevice):
|
class MqttCover(CoverDevice):
|
||||||
"""Representation of a cover that can be controlled using MQTT."""
|
"""Representation of a cover that can be controlled using MQTT."""
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
class RPiGPIOCover(CoverDevice):
|
class RPiGPIOCover(CoverDevice):
|
||||||
"""Representation of a Raspberry GPIO cover."""
|
"""Representation of a Raspberry GPIO cover."""
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments
|
|
||||||
def __init__(self, name, relay_pin, state_pin, state_pull_mode,
|
def __init__(self, name, relay_pin, state_pin, state_pull_mode,
|
||||||
relay_time):
|
relay_time):
|
||||||
"""Initialize the cover."""
|
"""Initialize the cover."""
|
||||||
|
|
|
@ -45,7 +45,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
add_devices(covers)
|
add_devices(covers)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments, too-many-instance-attributes
|
|
||||||
class SCSGateCover(CoverDevice):
|
class SCSGateCover(CoverDevice):
|
||||||
"""Representation of SCSGate cover."""
|
"""Representation of SCSGate cover."""
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,6 @@ CONFIG_SCHEMA = vol.Schema({
|
||||||
}, extra=vol.ALLOW_EXTRA)
|
}, extra=vol.ALLOW_EXTRA)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-locals
|
|
||||||
def setup(hass, config):
|
def setup(hass, config):
|
||||||
"""The triggers to turn lights on or off based on device presence."""
|
"""The triggers to turn lights on or off based on device presence."""
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
|
@ -4,8 +4,6 @@ Provide functionality to keep track of devices.
|
||||||
For more details about this component, please refer to the documentation at
|
For more details about this component, please refer to the documentation at
|
||||||
https://home-assistant.io/components/device_tracker/
|
https://home-assistant.io/components/device_tracker/
|
||||||
"""
|
"""
|
||||||
# pylint: disable=too-many-instance-attributes, too-many-arguments
|
|
||||||
# pylint: disable=too-many-locals
|
|
||||||
import asyncio
|
import asyncio
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
|
@ -88,7 +86,6 @@ def is_on(hass: HomeAssistantType, entity_id: str=None):
|
||||||
return hass.states.is_state(entity, STATE_HOME)
|
return hass.states.is_state(entity, STATE_HOME)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments
|
|
||||||
def see(hass: HomeAssistantType, mac: str=None, dev_id: str=None,
|
def see(hass: HomeAssistantType, mac: str=None, dev_id: str=None,
|
||||||
host_name: str=None, location_name: str=None,
|
host_name: str=None, location_name: str=None,
|
||||||
gps: GPSType=None, gps_accuracy=None,
|
gps: GPSType=None, gps_accuracy=None,
|
||||||
|
|
|
@ -90,9 +90,7 @@ AsusWrtResult = namedtuple('AsusWrtResult', 'neighbors leases arp')
|
||||||
class AsusWrtDeviceScanner(object):
|
class AsusWrtDeviceScanner(object):
|
||||||
"""This class queries a router running ASUSWRT firmware."""
|
"""This class queries a router running ASUSWRT firmware."""
|
||||||
|
|
||||||
# pylint: disable=too-many-instance-attributes, too-many-branches
|
|
||||||
# Eighth attribute needed for mode (AP mode vs router mode)
|
# Eighth attribute needed for mode (AP mode vs router mode)
|
||||||
|
|
||||||
def __init__(self, config):
|
def __init__(self, config):
|
||||||
"""Initialize the scanner."""
|
"""Initialize the scanner."""
|
||||||
self.host = config[CONF_HOST]
|
self.host = config[CONF_HOST]
|
||||||
|
|
|
@ -60,8 +60,6 @@ def setup_scanner(hass, config: dict, see):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-instance-attributes
|
|
||||||
# pylint: disable=too-few-public-methods
|
|
||||||
class AutomaticDeviceScanner(object):
|
class AutomaticDeviceScanner(object):
|
||||||
"""A class representing an Automatic device."""
|
"""A class representing an Automatic device."""
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,6 @@ def get_scanner(hass, config):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-instance-attributes
|
|
||||||
class DdWrtDeviceScanner(object):
|
class DdWrtDeviceScanner(object):
|
||||||
"""This class queries a wireless router running DD-WRT firmware."""
|
"""This class queries a wireless router running DD-WRT firmware."""
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,6 @@ def get_scanner(hass, config):
|
||||||
return scanner if scanner.success_init else None
|
return scanner if scanner.success_init else None
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-instance-attributes
|
|
||||||
class FritzBoxScanner(object):
|
class FritzBoxScanner(object):
|
||||||
"""This class queries a FRITZ!Box router."""
|
"""This class queries a FRITZ!Box router."""
|
||||||
|
|
||||||
|
|
|
@ -51,9 +51,9 @@ class LocativeView(HomeAssistantView):
|
||||||
return res
|
return res
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
|
# pylint: disable=too-many-return-statements
|
||||||
def _handle(self, data):
|
def _handle(self, data):
|
||||||
"""Handle locative request."""
|
"""Handle locative request."""
|
||||||
# pylint: disable=too-many-return-statements
|
|
||||||
if 'latitude' not in data or 'longitude' not in data:
|
if 'latitude' not in data or 'longitude' not in data:
|
||||||
return ('Latitude and longitude not specified.',
|
return ('Latitude and longitude not specified.',
|
||||||
HTTP_UNPROCESSABLE_ENTITY)
|
HTTP_UNPROCESSABLE_ENTITY)
|
||||||
|
|
|
@ -37,7 +37,6 @@ def get_scanner(hass, config):
|
||||||
return scanner if scanner.success_init else None
|
return scanner if scanner.success_init else None
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-instance-attributes
|
|
||||||
class LuciDeviceScanner(object):
|
class LuciDeviceScanner(object):
|
||||||
"""This class queries a wireless router running OpenWrt firmware.
|
"""This class queries a wireless router running OpenWrt firmware.
|
||||||
|
|
||||||
|
|
|
@ -114,10 +114,9 @@ def setup_scanner(hass, config, see):
|
||||||
'for topic %s.', topic)
|
'for topic %s.', topic)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
# pylint: disable=too-many-return-statements
|
||||||
def validate_payload(topic, payload, data_type):
|
def validate_payload(topic, payload, data_type):
|
||||||
"""Validate the OwnTracks payload."""
|
"""Validate the OwnTracks payload."""
|
||||||
# pylint: disable=too-many-return-statements
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
data = json.loads(payload)
|
data = json.loads(payload)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
|
|
@ -49,7 +49,6 @@ def get_scanner(hass, config):
|
||||||
class SnmpScanner(object):
|
class SnmpScanner(object):
|
||||||
"""Queries any SNMP capable Access Point for connected devices."""
|
"""Queries any SNMP capable Access Point for connected devices."""
|
||||||
|
|
||||||
# pylint: disable=too-many-instance-attributes
|
|
||||||
def __init__(self, config):
|
def __init__(self, config):
|
||||||
"""Initialize the scanner."""
|
"""Initialize the scanner."""
|
||||||
from pysnmp.entity.rfc3413.oneliner import cmdgen
|
from pysnmp.entity.rfc3413.oneliner import cmdgen
|
||||||
|
|
|
@ -37,7 +37,6 @@ def get_scanner(hass, config):
|
||||||
return scanner if scanner.success_init else None
|
return scanner if scanner.success_init else None
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-instance-attributes
|
|
||||||
class UbusDeviceScanner(object):
|
class UbusDeviceScanner(object):
|
||||||
"""
|
"""
|
||||||
This class queries a wireless router running OpenWrt firmware.
|
This class queries a wireless router running OpenWrt firmware.
|
||||||
|
|
|
@ -42,7 +42,6 @@ CONFIG_SCHEMA = vol.Schema({
|
||||||
}, extra=vol.ALLOW_EXTRA)
|
}, extra=vol.ALLOW_EXTRA)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=unused-argument,too-few-public-methods
|
|
||||||
def setup(hass, config):
|
def setup(hass, config):
|
||||||
"""Set up the Digital Ocean component."""
|
"""Set up the Digital Ocean component."""
|
||||||
conf = config[DOMAIN]
|
conf = config[DOMAIN]
|
||||||
|
|
|
@ -38,7 +38,6 @@ CONFIG_SCHEMA = vol.Schema({
|
||||||
}, extra=vol.ALLOW_EXTRA)
|
}, extra=vol.ALLOW_EXTRA)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-branches
|
|
||||||
def setup(hass, config):
|
def setup(hass, config):
|
||||||
"""Listen for download events to download files."""
|
"""Listen for download events to download files."""
|
||||||
download_path = config[DOMAIN][CONF_DOWNLOAD_DIR]
|
download_path = config[DOMAIN][CONF_DOWNLOAD_DIR]
|
||||||
|
|
|
@ -32,7 +32,6 @@ CONFIG_SCHEMA = vol.Schema({
|
||||||
}, extra=vol.ALLOW_EXTRA)
|
}, extra=vol.ALLOW_EXTRA)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-locals
|
|
||||||
def setup(hass, config):
|
def setup(hass, config):
|
||||||
"""Setup the Dweet.io component."""
|
"""Setup the Dweet.io component."""
|
||||||
conf = config[DOMAIN]
|
conf = config[DOMAIN]
|
||||||
|
|
|
@ -86,7 +86,6 @@ def setup_ecobee(hass, network, config):
|
||||||
discovery.load_platform(hass, 'binary_sensor', DOMAIN, {}, config)
|
discovery.load_platform(hass, 'binary_sensor', DOMAIN, {}, config)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-few-public-methods
|
|
||||||
class EcobeeData(object):
|
class EcobeeData(object):
|
||||||
"""Get the latest data and update the states."""
|
"""Get the latest data and update the states."""
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,6 @@ def setup(hass, yaml_config):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-few-public-methods
|
|
||||||
class Config(object):
|
class Config(object):
|
||||||
"""Holds configuration variables for the emulated hue bridge."""
|
"""Holds configuration variables for the emulated hue bridge."""
|
||||||
|
|
||||||
|
|
|
@ -56,14 +56,14 @@ class EnOceanDongle:
|
||||||
"""Send a command from the EnOcean dongle."""
|
"""Send a command from the EnOcean dongle."""
|
||||||
self.__communicator.send(command)
|
self.__communicator.send(command)
|
||||||
|
|
||||||
def _combine_hex(self, data): # pylint: disable=no-self-use
|
# pylint: disable=no-self-use
|
||||||
|
def _combine_hex(self, data):
|
||||||
"""Combine list of integer values to one big integer."""
|
"""Combine list of integer values to one big integer."""
|
||||||
output = 0x00
|
output = 0x00
|
||||||
for i, j in enumerate(reversed(data)):
|
for i, j in enumerate(reversed(data)):
|
||||||
output |= (j << i * 8)
|
output |= (j << i * 8)
|
||||||
return output
|
return output
|
||||||
|
|
||||||
# pylint: disable=too-many-branches
|
|
||||||
def callback(self, temp):
|
def callback(self, temp):
|
||||||
"""Callback function for EnOcean Device.
|
"""Callback function for EnOcean Device.
|
||||||
|
|
||||||
|
@ -112,7 +112,6 @@ class EnOceanDongle:
|
||||||
device.value_changed(value)
|
device.value_changed(value)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-few-public-methods
|
|
||||||
class EnOceanDevice():
|
class EnOceanDevice():
|
||||||
"""Parent class for all devices associated with the EnOcean component."""
|
"""Parent class for all devices associated with the EnOcean component."""
|
||||||
|
|
||||||
|
|
|
@ -77,8 +77,7 @@ CONFIG_SCHEMA = vol.Schema({
|
||||||
}, extra=vol.ALLOW_EXTRA)
|
}, extra=vol.ALLOW_EXTRA)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=unused-argument, too-many-function-args, too-many-locals
|
# pylint: disable=unused-argument
|
||||||
# pylint: disable=too-many-return-statements
|
|
||||||
def setup(hass, base_config):
|
def setup(hass, base_config):
|
||||||
"""Common setup for Envisalink devices."""
|
"""Common setup for Envisalink devices."""
|
||||||
from pyenvisalink import EnvisalinkAlarmPanel
|
from pyenvisalink import EnvisalinkAlarmPanel
|
||||||
|
|
|
@ -86,7 +86,6 @@ def is_on(hass, entity_id: str=None) -> bool:
|
||||||
return state.attributes[ATTR_SPEED] not in [SPEED_OFF, STATE_UNKNOWN]
|
return state.attributes[ATTR_SPEED] not in [SPEED_OFF, STATE_UNKNOWN]
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments
|
|
||||||
def turn_on(hass, entity_id: str=None, speed: str=None) -> None:
|
def turn_on(hass, entity_id: str=None, speed: str=None) -> None:
|
||||||
"""Turn all or specified fan on."""
|
"""Turn all or specified fan on."""
|
||||||
data = {
|
data = {
|
||||||
|
@ -141,7 +140,6 @@ def set_speed(hass, entity_id: str=None, speed: str=None) -> None:
|
||||||
hass.services.call(DOMAIN, SERVICE_SET_SPEED, data)
|
hass.services.call(DOMAIN, SERVICE_SET_SPEED, data)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-branches, too-many-locals, too-many-statements
|
|
||||||
def setup(hass, config: dict) -> None:
|
def setup(hass, config: dict) -> None:
|
||||||
"""Expose fan control via statemachine and services."""
|
"""Expose fan control via statemachine and services."""
|
||||||
component = EntityComponent(
|
component = EntityComponent(
|
||||||
|
|
|
@ -110,11 +110,9 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
)])
|
)])
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-instance-attributes
|
|
||||||
class MqttFan(FanEntity):
|
class MqttFan(FanEntity):
|
||||||
"""A MQTT fan component."""
|
"""A MQTT fan component."""
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments
|
|
||||||
def __init__(self, hass, name, topic, templates, qos, retain, payload,
|
def __init__(self, hass, name, topic, templates, qos, retain, payload,
|
||||||
speed_list, optimistic):
|
speed_list, optimistic):
|
||||||
"""Initialize the MQTT fan."""
|
"""Initialize the MQTT fan."""
|
||||||
|
|
|
@ -44,7 +44,6 @@ def setup(hass, config):
|
||||||
return len(feeds) > 0
|
return len(feeds) > 0
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-few-public-methods
|
|
||||||
class FeedManager(object):
|
class FeedManager(object):
|
||||||
"""Abstraction over feedparser module."""
|
"""Abstraction over feedparser module."""
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,6 @@ _LOGGER = logging.getLogger(__name__)
|
||||||
def register_built_in_panel(hass, component_name, sidebar_title=None,
|
def register_built_in_panel(hass, component_name, sidebar_title=None,
|
||||||
sidebar_icon=None, url_path=None, config=None):
|
sidebar_icon=None, url_path=None, config=None):
|
||||||
"""Register a built-in panel."""
|
"""Register a built-in panel."""
|
||||||
# pylint: disable=too-many-arguments
|
|
||||||
path = 'panels/ha-panel-{}.html'.format(component_name)
|
path = 'panels/ha-panel-{}.html'.format(component_name)
|
||||||
|
|
||||||
if hass.http.development:
|
if hass.http.development:
|
||||||
|
@ -70,7 +69,6 @@ def register_panel(hass, component_name, path, md5=None, sidebar_title=None,
|
||||||
|
|
||||||
Warning: this API will probably change. Use at own risk.
|
Warning: this API will probably change. Use at own risk.
|
||||||
"""
|
"""
|
||||||
# pylint: disable=too-many-arguments
|
|
||||||
if url_path is None:
|
if url_path is None:
|
||||||
url_path = component_name
|
url_path = component_name
|
||||||
|
|
||||||
|
|
|
@ -218,7 +218,6 @@ def _async_process_config(hass, config, component):
|
||||||
class Group(Entity):
|
class Group(Entity):
|
||||||
"""Track a group of entity ids."""
|
"""Track a group of entity ids."""
|
||||||
|
|
||||||
# pylint: disable=too-many-instance-attributes, too-many-arguments
|
|
||||||
def __init__(self, hass, name, order=None, user_defined=True, icon=None,
|
def __init__(self, hass, name, order=None, user_defined=True, icon=None,
|
||||||
view=False):
|
view=False):
|
||||||
"""Initialize a group.
|
"""Initialize a group.
|
||||||
|
@ -240,7 +239,6 @@ class Group(Entity):
|
||||||
self._visible = True
|
self._visible = True
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
# pylint: disable=too-many-arguments
|
|
||||||
def create_group(hass, name, entity_ids=None, user_defined=True,
|
def create_group(hass, name, entity_ids=None, user_defined=True,
|
||||||
icon=None, view=False, object_id=None):
|
icon=None, view=False, object_id=None):
|
||||||
"""Initialize a group."""
|
"""Initialize a group."""
|
||||||
|
@ -251,7 +249,6 @@ class Group(Entity):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
# pylint: disable=too-many-arguments
|
|
||||||
def async_create_group(hass, name, entity_ids=None, user_defined=True,
|
def async_create_group(hass, name, entity_ids=None, user_defined=True,
|
||||||
icon=None, view=False, object_id=None):
|
icon=None, view=False, object_id=None):
|
||||||
"""Initialize a group.
|
"""Initialize a group.
|
||||||
|
@ -420,7 +417,6 @@ class Group(Entity):
|
||||||
|
|
||||||
This method must be run in the event loop.
|
This method must be run in the event loop.
|
||||||
"""
|
"""
|
||||||
# pylint: disable=too-many-branches
|
|
||||||
# To store current states of group entities. Might not be needed.
|
# To store current states of group entities. Might not be needed.
|
||||||
states = None
|
states = None
|
||||||
gr_state = self._state
|
gr_state = self._state
|
||||||
|
|
|
@ -247,7 +247,6 @@ class HistoryPeriodView(HomeAssistantView):
|
||||||
return self.json(result.values())
|
return self.json(result.values())
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-few-public-methods
|
|
||||||
class Filters(object):
|
class Filters(object):
|
||||||
"""Container for the configured include and exclude filters."""
|
"""Container for the configured include and exclude filters."""
|
||||||
|
|
||||||
|
|
|
@ -183,7 +183,7 @@ def set_value(hass, entity_id, value):
|
||||||
hass.services.call(DOMAIN, SERVICE_SET_VALUE, data)
|
hass.services.call(DOMAIN, SERVICE_SET_VALUE, data)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=unused-argument,too-many-locals
|
# pylint: disable=unused-argument
|
||||||
def setup(hass, config):
|
def setup(hass, config):
|
||||||
"""Setup the Homematic component."""
|
"""Setup the Homematic component."""
|
||||||
global HOMEMATIC, HOMEMATIC_LINK_DELAY
|
global HOMEMATIC, HOMEMATIC_LINK_DELAY
|
||||||
|
@ -271,7 +271,6 @@ def setup(hass, config):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-branches
|
|
||||||
def _system_callback_handler(hass, config, src, *args):
|
def _system_callback_handler(hass, config, src, *args):
|
||||||
"""Callback handler."""
|
"""Callback handler."""
|
||||||
if src == 'newDevices':
|
if src == 'newDevices':
|
||||||
|
@ -323,7 +322,6 @@ def _get_devices(device_type, keys):
|
||||||
"""Get the Homematic devices."""
|
"""Get the Homematic devices."""
|
||||||
device_arr = []
|
device_arr = []
|
||||||
|
|
||||||
# pylint: disable=too-many-nested-blocks
|
|
||||||
for key in keys:
|
for key in keys:
|
||||||
device = HOMEMATIC.devices[key]
|
device = HOMEMATIC.devices[key]
|
||||||
class_name = device.__class__.__name__
|
class_name = device.__class__.__name__
|
||||||
|
@ -585,7 +583,6 @@ class HMVariable(Entity):
|
||||||
class HMDevice(Entity):
|
class HMDevice(Entity):
|
||||||
"""The Homematic device base object."""
|
"""The Homematic device base object."""
|
||||||
|
|
||||||
# pylint: disable=too-many-instance-attributes
|
|
||||||
def __init__(self, config):
|
def __init__(self, config):
|
||||||
"""Initialize a generic Homematic device."""
|
"""Initialize a generic Homematic device."""
|
||||||
self._name = config.get(ATTR_NAME)
|
self._name = config.get(ATTR_NAME)
|
||||||
|
|
|
@ -97,7 +97,6 @@ def request_class():
|
||||||
class HideSensitiveFilter(logging.Filter):
|
class HideSensitiveFilter(logging.Filter):
|
||||||
"""Filter API password calls."""
|
"""Filter API password calls."""
|
||||||
|
|
||||||
# pylint: disable=too-few-public-methods
|
|
||||||
def __init__(self, hass):
|
def __init__(self, hass):
|
||||||
"""Initialize sensitive data filter."""
|
"""Initialize sensitive data filter."""
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
@ -247,9 +246,6 @@ class HAStaticRoute(StaticRoute):
|
||||||
class HomeAssistantWSGI(object):
|
class HomeAssistantWSGI(object):
|
||||||
"""WSGI server for Home Assistant."""
|
"""WSGI server for Home Assistant."""
|
||||||
|
|
||||||
# pylint: disable=too-many-instance-attributes, too-many-locals
|
|
||||||
# pylint: disable=too-many-arguments
|
|
||||||
|
|
||||||
def __init__(self, hass, development, api_password, ssl_certificate,
|
def __init__(self, hass, development, api_password, ssl_certificate,
|
||||||
ssl_key, server_host, server_port, cors_origins,
|
ssl_key, server_host, server_port, cors_origins,
|
||||||
trusted_networks):
|
trusted_networks):
|
||||||
|
@ -405,7 +401,8 @@ class HomeAssistantView(object):
|
||||||
|
|
||||||
self.hass = hass
|
self.hass = hass
|
||||||
|
|
||||||
def json(self, result, status_code=200): # pylint: disable=no-self-use
|
# pylint: disable=no-self-use
|
||||||
|
def json(self, result, status_code=200):
|
||||||
"""Return a JSON response."""
|
"""Return a JSON response."""
|
||||||
msg = json.dumps(
|
msg = json.dumps(
|
||||||
result, sort_keys=True, cls=rem.JSONEncoder).encode('UTF-8')
|
result, sort_keys=True, cls=rem.JSONEncoder).encode('UTF-8')
|
||||||
|
@ -417,7 +414,8 @@ class HomeAssistantView(object):
|
||||||
return self.json({'message': error}, status_code)
|
return self.json({'message': error}, status_code)
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def file(self, request, fil): # pylint: disable=no-self-use
|
# pylint: disable=no-self-use
|
||||||
|
def file(self, request, fil):
|
||||||
"""Return a file."""
|
"""Return a file."""
|
||||||
assert isinstance(fil, str), 'only string paths allowed'
|
assert isinstance(fil, str), 'only string paths allowed'
|
||||||
response = yield from _GZIP_FILE_SENDER.send(request, Path(fil))
|
response = yield from _GZIP_FILE_SENDER.send(request, Path(fil))
|
||||||
|
|
|
@ -49,7 +49,6 @@ CONFIG_SCHEMA = vol.Schema({
|
||||||
}, extra=vol.ALLOW_EXTRA)
|
}, extra=vol.ALLOW_EXTRA)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-locals
|
|
||||||
def setup(hass, config):
|
def setup(hass, config):
|
||||||
"""Setup the InfluxDB component."""
|
"""Setup the InfluxDB component."""
|
||||||
from influxdb import InfluxDBClient, exceptions
|
from influxdb import InfluxDBClient, exceptions
|
||||||
|
|
|
@ -148,7 +148,6 @@ def async_setup(hass, config):
|
||||||
class InputSelect(Entity):
|
class InputSelect(Entity):
|
||||||
"""Representation of a select input."""
|
"""Representation of a select input."""
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments
|
|
||||||
def __init__(self, object_id, name, state, options, icon):
|
def __init__(self, object_id, name, state, options, icon):
|
||||||
"""Initialize a select input."""
|
"""Initialize a select input."""
|
||||||
self.entity_id = ENTITY_ID_FORMAT.format(object_id)
|
self.entity_id = ENTITY_ID_FORMAT.format(object_id)
|
||||||
|
|
|
@ -114,7 +114,6 @@ def async_setup(hass, config):
|
||||||
class InputSlider(Entity):
|
class InputSlider(Entity):
|
||||||
"""Represent an slider."""
|
"""Represent an slider."""
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments, too-many-instance-attributes
|
|
||||||
def __init__(self, object_id, name, state, minimum, maximum, step, icon,
|
def __init__(self, object_id, name, state, minimum, maximum, step, icon,
|
||||||
unit):
|
unit):
|
||||||
"""Initialize a select input."""
|
"""Initialize a select input."""
|
||||||
|
|
|
@ -93,15 +93,16 @@ def _categorize_nodes(hidden_identifier: str, sensor_identifier: str) -> None:
|
||||||
NODES = []
|
NODES = []
|
||||||
GROUPS = []
|
GROUPS = []
|
||||||
|
|
||||||
|
# pylint: disable=no-member
|
||||||
for (path, node) in ISY.nodes:
|
for (path, node) in ISY.nodes:
|
||||||
hidden = hidden_identifier in path or hidden_identifier in node.name
|
hidden = hidden_identifier in path or hidden_identifier in node.name
|
||||||
if hidden:
|
if hidden:
|
||||||
node.name += hidden_identifier
|
node.name += hidden_identifier
|
||||||
if sensor_identifier in path or sensor_identifier in node.name:
|
if sensor_identifier in path or sensor_identifier in node.name:
|
||||||
SENSOR_NODES.append(node)
|
SENSOR_NODES.append(node)
|
||||||
elif isinstance(node, PYISY.Nodes.Node): # pylint: disable=no-member
|
elif isinstance(node, PYISY.Nodes.Node):
|
||||||
NODES.append(node)
|
NODES.append(node)
|
||||||
elif isinstance(node, PYISY.Nodes.Group): # pylint: disable=no-member
|
elif isinstance(node, PYISY.Nodes.Group):
|
||||||
GROUPS.append(node)
|
GROUPS.append(node)
|
||||||
|
|
||||||
|
|
||||||
|
@ -131,7 +132,6 @@ def _categorize_programs() -> None:
|
||||||
PROGRAMS[component].append(program)
|
PROGRAMS[component].append(program)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-locals
|
|
||||||
def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
"""Set up the ISY 994 platform."""
|
"""Set up the ISY 994 platform."""
|
||||||
isy_config = config.get(DOMAIN)
|
isy_config = config.get(DOMAIN)
|
||||||
|
|
|
@ -27,7 +27,6 @@ CONFIG_SCHEMA = vol.Schema({
|
||||||
}, extra=vol.ALLOW_EXTRA)
|
}, extra=vol.ALLOW_EXTRA)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-locals
|
|
||||||
def register_device(hass, device_id, api_key, name):
|
def register_device(hass, device_id, api_key, name):
|
||||||
"""Method to register services for each join device listed."""
|
"""Method to register services for each join device listed."""
|
||||||
from pyjoin import (ring_device, set_wallpaper, send_sms,
|
from pyjoin import (ring_device, set_wallpaper, send_sms,
|
||||||
|
|
|
@ -124,7 +124,6 @@ def is_on(hass, entity_id=None):
|
||||||
return hass.states.is_state(entity_id, STATE_ON)
|
return hass.states.is_state(entity_id, STATE_ON)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments
|
|
||||||
def turn_on(hass, entity_id=None, transition=None, brightness=None,
|
def turn_on(hass, entity_id=None, transition=None, brightness=None,
|
||||||
rgb_color=None, xy_color=None, color_temp=None, white_value=None,
|
rgb_color=None, xy_color=None, color_temp=None, white_value=None,
|
||||||
profile=None, flash=None, effect=None, color_name=None):
|
profile=None, flash=None, effect=None, color_name=None):
|
||||||
|
@ -172,7 +171,6 @@ def toggle(hass, entity_id=None, transition=None):
|
||||||
hass.services.call(DOMAIN, SERVICE_TOGGLE, data)
|
hass.services.call(DOMAIN, SERVICE_TOGGLE, data)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-branches, too-many-locals, too-many-statements
|
|
||||||
def setup(hass, config):
|
def setup(hass, config):
|
||||||
"""Expose light control via statemachine and services."""
|
"""Expose light control via statemachine and services."""
|
||||||
component = EntityComponent(
|
component = EntityComponent(
|
||||||
|
|
|
@ -34,7 +34,6 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
|
||||||
class DemoLight(Light):
|
class DemoLight(Light):
|
||||||
"""Represenation of a demo light."""
|
"""Represenation of a demo light."""
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, name, state, rgb=None, ct=None, brightness=180,
|
self, name, state, rgb=None, ct=None, brightness=180,
|
||||||
xy_color=(.5, .5), white=200):
|
xy_color=(.5, .5), white=200):
|
||||||
|
|
|
@ -76,7 +76,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
class FluxLight(Light):
|
class FluxLight(Light):
|
||||||
"""Representation of a Flux light."""
|
"""Representation of a Flux light."""
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments
|
|
||||||
def __init__(self, device):
|
def __init__(self, device):
|
||||||
"""Initialize the light."""
|
"""Initialize the light."""
|
||||||
import flux_led
|
import flux_led
|
||||||
|
|
|
@ -199,7 +199,6 @@ def request_configuration(host, hass, add_devices, filename,
|
||||||
class HueLight(Light):
|
class HueLight(Light):
|
||||||
"""Representation of a Hue light."""
|
"""Representation of a Hue light."""
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments
|
|
||||||
def __init__(self, light_id, info, bridge, update_lights,
|
def __init__(self, light_id, info, bridge, update_lights,
|
||||||
bridge_type, allow_unreachable):
|
bridge_type, allow_unreachable):
|
||||||
"""Initialize the light."""
|
"""Initialize the light."""
|
||||||
|
|
|
@ -80,7 +80,6 @@ class LIFX(object):
|
||||||
break
|
break
|
||||||
return bulb
|
return bulb
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments
|
|
||||||
def on_device(self, ipaddr, name, power, hue, sat, bri, kel):
|
def on_device(self, ipaddr, name, power, hue, sat, bri, kel):
|
||||||
"""Initialize the light."""
|
"""Initialize the light."""
|
||||||
bulb = self.find_bulb(ipaddr)
|
bulb = self.find_bulb(ipaddr)
|
||||||
|
@ -99,7 +98,6 @@ class LIFX(object):
|
||||||
bulb.set_color(hue, sat, bri, kel)
|
bulb.set_color(hue, sat, bri, kel)
|
||||||
bulb.update_ha_state()
|
bulb.update_ha_state()
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments
|
|
||||||
def on_color(self, ipaddr, hue, sat, bri, kel):
|
def on_color(self, ipaddr, hue, sat, bri, kel):
|
||||||
"""Initialize the light."""
|
"""Initialize the light."""
|
||||||
bulb = self.find_bulb(ipaddr)
|
bulb = self.find_bulb(ipaddr)
|
||||||
|
@ -137,11 +135,9 @@ def convert_rgb_to_hsv(rgb):
|
||||||
int(brightness * SHORT_MAX)]
|
int(brightness * SHORT_MAX)]
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-instance-attributes
|
|
||||||
class LIFXLight(Light):
|
class LIFXLight(Light):
|
||||||
"""Representation of a LIFX light."""
|
"""Representation of a LIFX light."""
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments
|
|
||||||
def __init__(self, liffy, ipaddr, name, power, hue, saturation, brightness,
|
def __init__(self, liffy, ipaddr, name, power, hue, saturation, brightness,
|
||||||
kelvin):
|
kelvin):
|
||||||
"""Initialize the light."""
|
"""Initialize the light."""
|
||||||
|
|
|
@ -101,8 +101,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
class MqttLight(Light):
|
class MqttLight(Light):
|
||||||
"""MQTT light."""
|
"""MQTT light."""
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments,too-many-instance-attributes
|
|
||||||
# pylint: disable=too-many-locals,too-many-branches
|
|
||||||
def __init__(self, hass, name, topic, templates, qos, retain, payload,
|
def __init__(self, hass, name, topic, templates, qos, retain, payload,
|
||||||
optimistic, brightness_scale):
|
optimistic, brightness_scale):
|
||||||
"""Initialize MQTT light."""
|
"""Initialize MQTT light."""
|
||||||
|
|
|
@ -85,7 +85,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
class MqttJson(Light):
|
class MqttJson(Light):
|
||||||
"""Representation of a MQTT JSON light."""
|
"""Representation of a MQTT JSON light."""
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments,too-many-instance-attributes
|
|
||||||
def __init__(self, hass, name, topic, qos, retain,
|
def __init__(self, hass, name, topic, qos, retain,
|
||||||
optimistic, brightness, rgb, flash_times):
|
optimistic, brightness, rgb, flash_times):
|
||||||
"""Initialize MQTT JSON light."""
|
"""Initialize MQTT JSON light."""
|
||||||
|
|
|
@ -78,7 +78,6 @@ class WinkLight(WinkDevice, Light):
|
||||||
"""Flag supported features."""
|
"""Flag supported features."""
|
||||||
return SUPPORT_WINK
|
return SUPPORT_WINK
|
||||||
|
|
||||||
# pylint: disable=too-few-public-methods
|
|
||||||
def turn_on(self, **kwargs):
|
def turn_on(self, **kwargs):
|
||||||
"""Turn the switch on."""
|
"""Turn the switch on."""
|
||||||
brightness = kwargs.get(ATTR_BRIGHTNESS)
|
brightness = kwargs.get(ATTR_BRIGHTNESS)
|
||||||
|
|
|
@ -43,7 +43,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
class YeelightLight(Light):
|
class YeelightLight(Light):
|
||||||
"""Representation of a Yeelight light."""
|
"""Representation of a Yeelight light."""
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments
|
|
||||||
def __init__(self, device):
|
def __init__(self, device):
|
||||||
"""Initialize the light."""
|
"""Initialize the light."""
|
||||||
import pyyeelight
|
import pyyeelight
|
||||||
|
|
|
@ -105,7 +105,6 @@ def brightness_state(value):
|
||||||
class ZwaveDimmer(zwave.ZWaveDeviceEntity, Light):
|
class ZwaveDimmer(zwave.ZWaveDeviceEntity, Light):
|
||||||
"""Representation of a Z-Wave dimmer."""
|
"""Representation of a Z-Wave dimmer."""
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments
|
|
||||||
def __init__(self, value):
|
def __init__(self, value):
|
||||||
"""Initialize the light."""
|
"""Initialize the light."""
|
||||||
from openzwave.network import ZWaveNetwork
|
from openzwave.network import ZWaveNetwork
|
||||||
|
@ -263,7 +262,6 @@ class ZwaveColorLight(ZwaveDimmer):
|
||||||
# Check for the missing color values
|
# Check for the missing color values
|
||||||
self._get_color_values()
|
self._get_color_values()
|
||||||
|
|
||||||
# pylint: disable=too-many-branches
|
|
||||||
def update_properties(self):
|
def update_properties(self):
|
||||||
"""Update internal properties based on zwave values."""
|
"""Update internal properties based on zwave values."""
|
||||||
super().update_properties()
|
super().update_properties()
|
||||||
|
|
|
@ -58,7 +58,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
)])
|
)])
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments, too-many-instance-attributes
|
|
||||||
class MqttLock(LockDevice):
|
class MqttLock(LockDevice):
|
||||||
"""Represents a lock that can be toggled using MQTT."""
|
"""Represents a lock that can be toggled using MQTT."""
|
||||||
|
|
||||||
|
|
|
@ -154,7 +154,6 @@ class LogbookView(HomeAssistantView):
|
||||||
class Entry(object):
|
class Entry(object):
|
||||||
"""A human readable version of the log."""
|
"""A human readable version of the log."""
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments, too-few-public-methods
|
|
||||||
def __init__(self, when=None, name=None, message=None, domain=None,
|
def __init__(self, when=None, name=None, message=None, domain=None,
|
||||||
entity_id=None):
|
entity_id=None):
|
||||||
"""Initialize the entry."""
|
"""Initialize the entry."""
|
||||||
|
@ -182,7 +181,6 @@ def humanify(events):
|
||||||
- if 2+ sensor updates in GROUP_BY_MINUTES, show last
|
- if 2+ sensor updates in GROUP_BY_MINUTES, show last
|
||||||
- if home assistant stop and start happen in same minute call it restarted
|
- if home assistant stop and start happen in same minute call it restarted
|
||||||
"""
|
"""
|
||||||
# pylint: disable=too-many-branches
|
|
||||||
# Group events in batches of GROUP_BY_MINUTES
|
# Group events in batches of GROUP_BY_MINUTES
|
||||||
for _, g_events in groupby(
|
for _, g_events in groupby(
|
||||||
events,
|
events,
|
||||||
|
@ -288,7 +286,6 @@ def humanify(events):
|
||||||
|
|
||||||
def _exclude_events(events, config):
|
def _exclude_events(events, config):
|
||||||
"""Get lists of excluded entities and platforms."""
|
"""Get lists of excluded entities and platforms."""
|
||||||
# pylint: disable=too-many-branches
|
|
||||||
excluded_entities = []
|
excluded_entities = []
|
||||||
excluded_domains = []
|
excluded_domains = []
|
||||||
included_entities = []
|
included_entities = []
|
||||||
|
@ -355,10 +352,10 @@ def _exclude_events(events, config):
|
||||||
return filtered_events
|
return filtered_events
|
||||||
|
|
||||||
|
|
||||||
|
# pylint: disable=too-many-return-statements
|
||||||
def _entry_message_from_state(domain, state):
|
def _entry_message_from_state(domain, state):
|
||||||
"""Convert a state to a message for the logbook."""
|
"""Convert a state to a message for the logbook."""
|
||||||
# We pass domain in so we don't have to split entity_id again
|
# We pass domain in so we don't have to split entity_id again
|
||||||
# pylint: disable=too-many-return-statements
|
|
||||||
if domain == 'device_tracker':
|
if domain == 'device_tracker':
|
||||||
if state.state == STATE_NOT_HOME:
|
if state.state == STATE_NOT_HOME:
|
||||||
return 'is away'
|
return 'is away'
|
||||||
|
|
|
@ -398,10 +398,8 @@ def setup(hass, config):
|
||||||
class MediaPlayerDevice(Entity):
|
class MediaPlayerDevice(Entity):
|
||||||
"""ABC for media player devices."""
|
"""ABC for media player devices."""
|
||||||
|
|
||||||
# pylint: disable=too-many-public-methods,no-self-use
|
# pylint: disable=no-self-use
|
||||||
|
|
||||||
# Implement these for your media player
|
# Implement these for your media player
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def state(self):
|
def state(self):
|
||||||
"""State of the player."""
|
"""State of the player."""
|
||||||
|
|
|
@ -117,7 +117,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
setup_bravia(config, pin, hass, add_devices)
|
setup_bravia(config, pin, hass, add_devices)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-branches
|
|
||||||
def setup_bravia(config, pin, hass, add_devices):
|
def setup_bravia(config, pin, hass, add_devices):
|
||||||
"""Setup a Sony Bravia TV based on host parameter."""
|
"""Setup a Sony Bravia TV based on host parameter."""
|
||||||
host = config.get(CONF_HOST)
|
host = config.get(CONF_HOST)
|
||||||
|
@ -181,8 +180,7 @@ def request_configuration(config, hass, add_devices):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=abstract-method, too-many-public-methods,
|
# pylint: disable=abstract-method
|
||||||
# pylint: disable=too-many-instance-attributes, too-many-arguments
|
|
||||||
class BraviaTVDevice(MediaPlayerDevice):
|
class BraviaTVDevice(MediaPlayerDevice):
|
||||||
"""Representation of a Sony Bravia TV."""
|
"""Representation of a Sony Bravia TV."""
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,6 @@ class CastDevice(MediaPlayerDevice):
|
||||||
"""Representation of a Cast device on the network."""
|
"""Representation of a Cast device on the network."""
|
||||||
|
|
||||||
# pylint: disable=abstract-method
|
# pylint: disable=abstract-method
|
||||||
# pylint: disable=too-many-public-methods
|
|
||||||
def __init__(self, chromecast):
|
def __init__(self, chromecast):
|
||||||
"""Initialize the Cast device."""
|
"""Initialize the Cast device."""
|
||||||
self.cast = chromecast
|
self.cast = chromecast
|
||||||
|
|
|
@ -58,7 +58,7 @@ def setup_platform(hass, config, add_devices, discover_info=None):
|
||||||
class CmusDevice(MediaPlayerDevice):
|
class CmusDevice(MediaPlayerDevice):
|
||||||
"""Representation of a running cmus."""
|
"""Representation of a running cmus."""
|
||||||
|
|
||||||
# pylint: disable=no-member, too-many-public-methods, abstract-method
|
# pylint: disable=no-member, abstract-method
|
||||||
def __init__(self, server, password, port, name):
|
def __init__(self, server, password, port, name):
|
||||||
"""Initialize the CMUS device."""
|
"""Initialize the CMUS device."""
|
||||||
from pycmus import remote
|
from pycmus import remote
|
||||||
|
|
|
@ -45,7 +45,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
class DenonDevice(MediaPlayerDevice):
|
class DenonDevice(MediaPlayerDevice):
|
||||||
"""Representation of a Denon device."""
|
"""Representation of a Denon device."""
|
||||||
|
|
||||||
# pylint: disable=too-many-public-methods, abstract-method
|
# pylint: disable=abstract-method
|
||||||
def __init__(self, name, host):
|
def __init__(self, name, host):
|
||||||
"""Initialize the Denon device."""
|
"""Initialize the Denon device."""
|
||||||
self._name = name
|
self._name = name
|
||||||
|
|
|
@ -66,7 +66,6 @@ class DirecTvDevice(MediaPlayerDevice):
|
||||||
"""Representation of a DirecTV reciever on the network."""
|
"""Representation of a DirecTV reciever on the network."""
|
||||||
|
|
||||||
# pylint: disable=abstract-method
|
# pylint: disable=abstract-method
|
||||||
# pylint: disable=too-many-public-methods
|
|
||||||
def __init__(self, name, host, port):
|
def __init__(self, name, host, port):
|
||||||
"""Initialize the device."""
|
"""Initialize the device."""
|
||||||
from DirectPy import DIRECTV
|
from DirectPy import DIRECTV
|
||||||
|
|
|
@ -170,8 +170,7 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
|
||||||
class GPMDP(MediaPlayerDevice):
|
class GPMDP(MediaPlayerDevice):
|
||||||
"""Representation of a GPMDP."""
|
"""Representation of a GPMDP."""
|
||||||
|
|
||||||
# pylint: disable=too-many-public-methods, abstract-method
|
# pylint: disable=abstract-method
|
||||||
# pylint: disable=too-many-instance-attributes
|
|
||||||
def __init__(self, name, url, code):
|
def __init__(self, name, url, code):
|
||||||
"""Initialize the media player."""
|
"""Initialize the media player."""
|
||||||
from websocket import create_connection
|
from websocket import create_connection
|
||||||
|
|
|
@ -154,7 +154,6 @@ class Itunes(object):
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=unused-argument, abstract-method
|
# pylint: disable=unused-argument, abstract-method
|
||||||
# pylint: disable=too-many-instance-attributes
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
"""Setup the iTunes platform."""
|
"""Setup the iTunes platform."""
|
||||||
add_devices([
|
add_devices([
|
||||||
|
@ -172,7 +171,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
class ItunesDevice(MediaPlayerDevice):
|
class ItunesDevice(MediaPlayerDevice):
|
||||||
"""Representation of an iTunes API instance."""
|
"""Representation of an iTunes API instance."""
|
||||||
|
|
||||||
# pylint: disable=too-many-public-methods, too-many-arguments
|
|
||||||
def __init__(self, name, host, port, use_ssl, add_devices):
|
def __init__(self, name, host, port, use_ssl, add_devices):
|
||||||
"""Initialize the iTunes device."""
|
"""Initialize the iTunes device."""
|
||||||
self._name = name
|
self._name = name
|
||||||
|
@ -353,7 +351,6 @@ class ItunesDevice(MediaPlayerDevice):
|
||||||
class AirPlayDevice(MediaPlayerDevice):
|
class AirPlayDevice(MediaPlayerDevice):
|
||||||
"""Representation an AirPlay device via an iTunes API instance."""
|
"""Representation an AirPlay device via an iTunes API instance."""
|
||||||
|
|
||||||
# pylint: disable=too-many-public-methods
|
|
||||||
def __init__(self, device_id, client):
|
def __init__(self, device_id, client):
|
||||||
"""Initialize the AirPlay device."""
|
"""Initialize the AirPlay device."""
|
||||||
self._id = device_id
|
self._id = device_id
|
||||||
|
|
|
@ -63,8 +63,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
class KodiDevice(MediaPlayerDevice):
|
class KodiDevice(MediaPlayerDevice):
|
||||||
"""Representation of a XBMC/Kodi device."""
|
"""Representation of a XBMC/Kodi device."""
|
||||||
|
|
||||||
# pylint: disable=too-many-public-methods, abstract-method
|
# pylint: disable=abstract-method
|
||||||
# pylint: disable=too-many-instance-attributes
|
|
||||||
def __init__(self, name, url, auth=None, turn_off_action=None):
|
def __init__(self, name, url, auth=None, turn_off_action=None):
|
||||||
"""Initialize the Kodi device."""
|
"""Initialize the Kodi device."""
|
||||||
import jsonrpc_requests
|
import jsonrpc_requests
|
||||||
|
|
|
@ -52,8 +52,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
add_devices([LgTVDevice(client, config[CONF_NAME])])
|
add_devices([LgTVDevice(client, config[CONF_NAME])])
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-public-methods, abstract-method
|
# pylint: disable=abstract-method
|
||||||
# pylint: disable=too-many-instance-attributes
|
|
||||||
class LgTVDevice(MediaPlayerDevice):
|
class LgTVDevice(MediaPlayerDevice):
|
||||||
"""Representation of a LG TV."""
|
"""Representation of a LG TV."""
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
class MpdDevice(MediaPlayerDevice):
|
class MpdDevice(MediaPlayerDevice):
|
||||||
"""Representation of a MPD server."""
|
"""Representation of a MPD server."""
|
||||||
|
|
||||||
# pylint: disable=no-member, too-many-public-methods, abstract-method
|
# pylint: disable=no-member, abstract-method
|
||||||
def __init__(self, server, port, location, password):
|
def __init__(self, server, port, location, password):
|
||||||
"""Initialize the MPD device."""
|
"""Initialize the MPD device."""
|
||||||
import mpd
|
import mpd
|
||||||
|
|
|
@ -65,11 +65,10 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
add_devices(hosts)
|
add_devices(hosts)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-instance-attributes
|
|
||||||
class OnkyoDevice(MediaPlayerDevice):
|
class OnkyoDevice(MediaPlayerDevice):
|
||||||
"""Representation of an Onkyo device."""
|
"""Representation of an Onkyo device."""
|
||||||
|
|
||||||
# pylint: disable=too-many-public-methods, abstract-method
|
# pylint: disable=abstract-method
|
||||||
def __init__(self, receiver, sources, name=None):
|
def __init__(self, receiver, sources, name=None):
|
||||||
"""Initialize the Onkyo Receiver."""
|
"""Initialize the Onkyo Receiver."""
|
||||||
self._receiver = receiver
|
self._receiver = receiver
|
||||||
|
|
|
@ -72,7 +72,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
class PanasonicVieraTVDevice(MediaPlayerDevice):
|
class PanasonicVieraTVDevice(MediaPlayerDevice):
|
||||||
"""Representation of a Panasonic Viera TV."""
|
"""Representation of a Panasonic Viera TV."""
|
||||||
|
|
||||||
# pylint: disable=too-many-public-methods
|
|
||||||
def __init__(self, name, remote):
|
def __init__(self, name, remote):
|
||||||
"""Initialize the samsung device."""
|
"""Initialize the samsung device."""
|
||||||
# Save a reference to the imported class
|
# Save a reference to the imported class
|
||||||
|
|
|
@ -60,7 +60,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
add_devices([pandora])
|
add_devices([pandora])
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-instance-attributes
|
|
||||||
class PandoraMediaPlayer(MediaPlayerDevice):
|
class PandoraMediaPlayer(MediaPlayerDevice):
|
||||||
"""A media player that uses the Pianobar interface to Pandora."""
|
"""A media player that uses the Pianobar interface to Pandora."""
|
||||||
|
|
||||||
|
|
|
@ -54,8 +54,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
class PioneerDevice(MediaPlayerDevice):
|
class PioneerDevice(MediaPlayerDevice):
|
||||||
"""Representation of a Pioneer device."""
|
"""Representation of a Pioneer device."""
|
||||||
|
|
||||||
# pylint: disable=too-many-public-methods, abstract-method
|
# pylint: disable=abstract-method
|
||||||
# pylint: disable=too-many-instance-attributes
|
|
||||||
def __init__(self, name, host, port, timeout):
|
def __init__(self, name, host, port, timeout):
|
||||||
"""Initialize the Pioneer device."""
|
"""Initialize the Pioneer device."""
|
||||||
self._name = name
|
self._name = name
|
||||||
|
|
|
@ -83,7 +83,6 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
|
||||||
setup_plexserver(host, token, hass, add_devices_callback)
|
setup_plexserver(host, token, hass, add_devices_callback)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-branches
|
|
||||||
def setup_plexserver(host, token, hass, add_devices_callback):
|
def setup_plexserver(host, token, hass, add_devices_callback):
|
||||||
"""Setup a plexserver based on host parameter."""
|
"""Setup a plexserver based on host parameter."""
|
||||||
import plexapi.server
|
import plexapi.server
|
||||||
|
@ -192,7 +191,7 @@ def request_configuration(host, hass, add_devices_callback):
|
||||||
class PlexClient(MediaPlayerDevice):
|
class PlexClient(MediaPlayerDevice):
|
||||||
"""Representation of a Plex device."""
|
"""Representation of a Plex device."""
|
||||||
|
|
||||||
# pylint: disable=too-many-public-methods, attribute-defined-outside-init
|
# pylint: disable=attribute-defined-outside-init
|
||||||
def __init__(self, device, plex_sessions, update_devices, update_sessions):
|
def __init__(self, device, plex_sessions, update_devices, update_sessions):
|
||||||
"""Initialize the Plex device."""
|
"""Initialize the Plex device."""
|
||||||
from plexapi.utils import NA
|
from plexapi.utils import NA
|
||||||
|
|
|
@ -66,7 +66,6 @@ class RokuDevice(MediaPlayerDevice):
|
||||||
"""Representation of a Roku device on the network."""
|
"""Representation of a Roku device on the network."""
|
||||||
|
|
||||||
# pylint: disable=abstract-method
|
# pylint: disable=abstract-method
|
||||||
# pylint: disable=too-many-public-methods
|
|
||||||
def __init__(self, host):
|
def __init__(self, host):
|
||||||
"""Initialize the Roku device."""
|
"""Initialize the Roku device."""
|
||||||
from roku import Roku
|
from roku import Roku
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue