Upgrade pylint to 1.8.2 (#12274)
* Upgrade pylint to 1.8.1 * Fix no-else-return * Fix bad-whitespace * Fix too-many-nested-blocks * Fix raising-format-tuple See https://github.com/PyCQA/pylint/blob/master/doc/whatsnew/1.8.rst * Fix len-as-condition * Fix logging-not-lazy Not sure about that TEMP_CELSIUS though, but internally it's probably just like if you concatenated any other (variable) string * Fix stop-iteration-return * Fix useless-super-delegation * Fix trailing-comma-tuple Both of these seem to simply be bugs: * Nest: The value of self._humidity never seems to be used anywhere * Dovado: The called API method seems to expect a "normal" number * Fix redefined-argument-from-local * Fix consider-using-enumerate * Fix wrong-import-order * Fix arguments-differ * Fix missed no-else-return * Fix no-member and related * Fix signatures-differ * Revert "Upgrade pylint to 1.8.1" This reverts commit af78aa00f125a7d34add97b9d50c14db48412211. * Fix arguments-differ * except for device_tracker * Cleanup * Fix test using positional argument * Fix line too long I forgot to run flake8 - shame on me... 🙃 * Fix bad-option-value for 1.6.5 * Fix arguments-differ for device_tracker * Upgrade pylint to 1.8.2 * 👕 Fix missed no-member
This commit is contained in:
parent
64c5d26a84
commit
678f284015
196 changed files with 541 additions and 593 deletions
|
@ -7,6 +7,7 @@ https://home-assistant.io/components/abode/
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
from requests.exceptions import HTTPError, ConnectTimeout
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
|
@ -17,7 +18,6 @@ from homeassistant.const import (
|
||||||
from homeassistant.helpers import config_validation as cv
|
from homeassistant.helpers import config_validation as cv
|
||||||
from homeassistant.helpers import discovery
|
from homeassistant.helpers import discovery
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from requests.exceptions import HTTPError, ConnectTimeout
|
|
||||||
|
|
||||||
REQUIREMENTS = ['abodepy==0.12.2']
|
REQUIREMENTS = ['abodepy==0.12.2']
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,6 @@ class CanaryAlarm(AlarmControlPanel):
|
||||||
return STATE_ALARM_ARMED_HOME
|
return STATE_ALARM_ARMED_HOME
|
||||||
elif mode.name == LOCATION_MODE_NIGHT:
|
elif mode.name == LOCATION_MODE_NIGHT:
|
||||||
return STATE_ALARM_ARMED_NIGHT
|
return STATE_ALARM_ARMED_NIGHT
|
||||||
else:
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -172,7 +172,6 @@ class ManualAlarm(alarm.AlarmControlPanel):
|
||||||
trigger_time) < dt_util.utcnow():
|
trigger_time) < dt_util.utcnow():
|
||||||
if self._disarm_after_trigger:
|
if self._disarm_after_trigger:
|
||||||
return STATE_ALARM_DISARMED
|
return STATE_ALARM_DISARMED
|
||||||
else:
|
|
||||||
self._state = self._previous_state
|
self._state = self._previous_state
|
||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
|
@ -187,7 +186,6 @@ class ManualAlarm(alarm.AlarmControlPanel):
|
||||||
"""Get the current state."""
|
"""Get the current state."""
|
||||||
if self.state == STATE_ALARM_PENDING:
|
if self.state == STATE_ALARM_PENDING:
|
||||||
return self._previous_state
|
return self._previous_state
|
||||||
else:
|
|
||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
def _pending_time(self, state):
|
def _pending_time(self, state):
|
||||||
|
|
|
@ -208,7 +208,6 @@ class ManualMQTTAlarm(alarm.AlarmControlPanel):
|
||||||
trigger_time) < dt_util.utcnow():
|
trigger_time) < dt_util.utcnow():
|
||||||
if self._disarm_after_trigger:
|
if self._disarm_after_trigger:
|
||||||
return STATE_ALARM_DISARMED
|
return STATE_ALARM_DISARMED
|
||||||
else:
|
|
||||||
self._state = self._previous_state
|
self._state = self._previous_state
|
||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
|
@ -223,7 +222,6 @@ class ManualMQTTAlarm(alarm.AlarmControlPanel):
|
||||||
"""Get the current state."""
|
"""Get the current state."""
|
||||||
if self.state == STATE_ALARM_PENDING:
|
if self.state == STATE_ALARM_PENDING:
|
||||||
return self._previous_state
|
return self._previous_state
|
||||||
else:
|
|
||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
def _pending_time(self, state):
|
def _pending_time(self, state):
|
||||||
|
|
|
@ -50,7 +50,7 @@ class EnvisalinkBinarySensor(EnvisalinkDevice, BinarySensorDevice):
|
||||||
self._zone_type = zone_type
|
self._zone_type = zone_type
|
||||||
self._zone_number = zone_number
|
self._zone_number = zone_number
|
||||||
|
|
||||||
_LOGGER.debug('Setting up zone: ' + zone_name)
|
_LOGGER.debug('Setting up zone: %s', zone_name)
|
||||||
super().__init__(zone_name, info, controller)
|
super().__init__(zone_name, info, controller)
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
|
|
|
@ -498,7 +498,7 @@ class TodoistProjectData(object):
|
||||||
|
|
||||||
# Organize the best tasks (so users can see all the tasks
|
# Organize the best tasks (so users can see all the tasks
|
||||||
# they have, organized)
|
# they have, organized)
|
||||||
while len(project_tasks) > 0:
|
while project_tasks:
|
||||||
best_task = self.select_best_task(project_tasks)
|
best_task = self.select_best_task(project_tasks)
|
||||||
_LOGGER.debug("Found Todoist Task: %s", best_task[SUMMARY])
|
_LOGGER.debug("Found Todoist Task: %s", best_task[SUMMARY])
|
||||||
project_tasks.remove(best_task)
|
project_tasks.remove(best_task)
|
||||||
|
|
|
@ -119,6 +119,8 @@ class MjpegCamera(Camera):
|
||||||
else:
|
else:
|
||||||
req = requests.get(self._mjpeg_url, stream=True, timeout=10)
|
req = requests.get(self._mjpeg_url, stream=True, timeout=10)
|
||||||
|
|
||||||
|
# https://github.com/PyCQA/pylint/issues/1437
|
||||||
|
# pylint: disable=no-member
|
||||||
with closing(req) as response:
|
with closing(req) as response:
|
||||||
return extract_image_from_mjpeg(response.iter_content(102400))
|
return extract_image_from_mjpeg(response.iter_content(102400))
|
||||||
|
|
||||||
|
|
|
@ -188,7 +188,7 @@ class UnifiVideoCamera(Camera):
|
||||||
self._nvr.set_recordmode(self._uuid, set_mode)
|
self._nvr.set_recordmode(self._uuid, set_mode)
|
||||||
self._motion_status = mode
|
self._motion_status = mode
|
||||||
except NvrError as err:
|
except NvrError as err:
|
||||||
_LOGGER.error("Unable to set recordmode to " + set_mode)
|
_LOGGER.error("Unable to set recordmode to %s", set_mode)
|
||||||
_LOGGER.debug(err)
|
_LOGGER.debug(err)
|
||||||
|
|
||||||
def enable_motion_detection(self):
|
def enable_motion_detection(self):
|
||||||
|
|
|
@ -42,7 +42,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
# pylint: disable=unused-argument
|
|
||||||
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
||||||
"""Discover and setup Xeoma Cameras."""
|
"""Discover and setup Xeoma Cameras."""
|
||||||
from pyxeoma.xeoma import Xeoma, XeomaError
|
from pyxeoma.xeoma import Xeoma, XeomaError
|
||||||
|
@ -69,6 +68,8 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
||||||
]
|
]
|
||||||
|
|
||||||
for cam in config[CONF_CAMERAS]:
|
for cam in config[CONF_CAMERAS]:
|
||||||
|
# https://github.com/PyCQA/pylint/issues/1830
|
||||||
|
# pylint: disable=stop-iteration-return
|
||||||
camera = next(
|
camera = next(
|
||||||
(dc for dc in discovered_cameras
|
(dc for dc in discovered_cameras
|
||||||
if dc[CONF_IMAGE_NAME] == cam[CONF_IMAGE_NAME]), None)
|
if dc[CONF_IMAGE_NAME] == cam[CONF_IMAGE_NAME]), None)
|
||||||
|
|
|
@ -669,16 +669,16 @@ class ClimateDevice(Entity):
|
||||||
"""
|
"""
|
||||||
return self.hass.async_add_job(self.set_humidity, humidity)
|
return self.hass.async_add_job(self.set_humidity, humidity)
|
||||||
|
|
||||||
def set_fan_mode(self, fan):
|
def set_fan_mode(self, fan_mode):
|
||||||
"""Set new target fan mode."""
|
"""Set new target fan mode."""
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
def async_set_fan_mode(self, fan):
|
def async_set_fan_mode(self, fan_mode):
|
||||||
"""Set new target fan mode.
|
"""Set new target fan mode.
|
||||||
|
|
||||||
This method must be run in the event loop and returns a coroutine.
|
This method must be run in the event loop and returns a coroutine.
|
||||||
"""
|
"""
|
||||||
return self.hass.async_add_job(self.set_fan_mode, fan)
|
return self.hass.async_add_job(self.set_fan_mode, fan_mode)
|
||||||
|
|
||||||
def set_operation_mode(self, operation_mode):
|
def set_operation_mode(self, operation_mode):
|
||||||
"""Set new target operation mode."""
|
"""Set new target operation mode."""
|
||||||
|
|
|
@ -236,9 +236,9 @@ class DaikinClimate(ClimateDevice):
|
||||||
"""Return the fan setting."""
|
"""Return the fan setting."""
|
||||||
return self.get(ATTR_FAN_MODE)
|
return self.get(ATTR_FAN_MODE)
|
||||||
|
|
||||||
def set_fan_mode(self, fan):
|
def set_fan_mode(self, fan_mode):
|
||||||
"""Set fan mode."""
|
"""Set fan mode."""
|
||||||
self.set({ATTR_FAN_MODE: fan})
|
self.set({ATTR_FAN_MODE: fan_mode})
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def fan_list(self):
|
def fan_list(self):
|
||||||
|
|
|
@ -195,9 +195,9 @@ class DemoClimate(ClimateDevice):
|
||||||
self._current_swing_mode = swing_mode
|
self._current_swing_mode = swing_mode
|
||||||
self.schedule_update_ha_state()
|
self.schedule_update_ha_state()
|
||||||
|
|
||||||
def set_fan_mode(self, fan):
|
def set_fan_mode(self, fan_mode):
|
||||||
"""Set new target temperature."""
|
"""Set new target temperature."""
|
||||||
self._current_fan_mode = fan
|
self._current_fan_mode = fan_mode
|
||||||
self.schedule_update_ha_state()
|
self.schedule_update_ha_state()
|
||||||
|
|
||||||
def set_operation_mode(self, operation_mode):
|
def set_operation_mode(self, operation_mode):
|
||||||
|
@ -225,9 +225,9 @@ class DemoClimate(ClimateDevice):
|
||||||
self._away = False
|
self._away = False
|
||||||
self.schedule_update_ha_state()
|
self.schedule_update_ha_state()
|
||||||
|
|
||||||
def set_hold_mode(self, hold):
|
def set_hold_mode(self, hold_mode):
|
||||||
"""Update hold mode on."""
|
"""Update hold_mode on."""
|
||||||
self._hold = hold
|
self._hold = hold_mode
|
||||||
self.schedule_update_ha_state()
|
self.schedule_update_ha_state()
|
||||||
|
|
||||||
def turn_aux_heat_on(self):
|
def turn_aux_heat_on(self):
|
||||||
|
|
|
@ -98,7 +98,6 @@ class EphEmberThermostat(ClimateDevice):
|
||||||
"""Return current operation ie. heat, cool, idle."""
|
"""Return current operation ie. heat, cool, idle."""
|
||||||
if self._zone['isCurrentlyActive']:
|
if self._zone['isCurrentlyActive']:
|
||||||
return STATE_HEAT
|
return STATE_HEAT
|
||||||
else:
|
|
||||||
return STATE_IDLE
|
return STATE_IDLE
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -53,7 +53,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
add_devices(devices)
|
add_devices(devices)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=import-error
|
# pylint: disable=import-error, no-name-in-module
|
||||||
class EQ3BTSmartThermostat(ClimateDevice):
|
class EQ3BTSmartThermostat(ClimateDevice):
|
||||||
"""Representation of an eQ-3 Bluetooth Smart thermostat."""
|
"""Representation of an eQ-3 Bluetooth Smart thermostat."""
|
||||||
|
|
||||||
|
|
|
@ -152,6 +152,6 @@ class Flexit(ClimateDevice):
|
||||||
self._target_temperature = kwargs.get(ATTR_TEMPERATURE)
|
self._target_temperature = kwargs.get(ATTR_TEMPERATURE)
|
||||||
self.unit.set_temp(self._target_temperature)
|
self.unit.set_temp(self._target_temperature)
|
||||||
|
|
||||||
def set_fan_mode(self, fan):
|
def set_fan_mode(self, fan_mode):
|
||||||
"""Set new fan mode."""
|
"""Set new fan mode."""
|
||||||
self.unit.set_fan_speed(self._fan_list.index(fan))
|
self.unit.set_fan_speed(self._fan_list.index(fan_mode))
|
||||||
|
|
|
@ -190,10 +190,8 @@ class GenericThermostat(ClimateDevice):
|
||||||
"""Return the current state."""
|
"""Return the current state."""
|
||||||
if self._is_device_active:
|
if self._is_device_active:
|
||||||
return self.current_operation
|
return self.current_operation
|
||||||
else:
|
|
||||||
if self._enabled:
|
if self._enabled:
|
||||||
return STATE_IDLE
|
return STATE_IDLE
|
||||||
else:
|
|
||||||
return STATE_OFF
|
return STATE_OFF
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -146,10 +146,10 @@ class MelissaClimate(ClimateDevice):
|
||||||
temp = kwargs.get(ATTR_TEMPERATURE)
|
temp = kwargs.get(ATTR_TEMPERATURE)
|
||||||
self.send({self._api.TEMP: temp})
|
self.send({self._api.TEMP: temp})
|
||||||
|
|
||||||
def set_fan_mode(self, fan):
|
def set_fan_mode(self, fan_mode):
|
||||||
"""Set fan mode."""
|
"""Set fan mode."""
|
||||||
fan_mode = self.hass_fan_to_melissa(fan)
|
melissa_fan_mode = self.hass_fan_to_melissa(fan_mode)
|
||||||
self.send({self._api.FAN: fan_mode})
|
self.send({self._api.FAN: melissa_fan_mode})
|
||||||
|
|
||||||
def set_operation_mode(self, operation_mode):
|
def set_operation_mode(self, operation_mode):
|
||||||
"""Set operation mode."""
|
"""Set operation mode."""
|
||||||
|
@ -174,7 +174,6 @@ class MelissaClimate(ClimateDevice):
|
||||||
if not self._api.send(self._serial_number, self._cur_settings):
|
if not self._api.send(self._serial_number, self._cur_settings):
|
||||||
self._cur_settings = old_value
|
self._cur_settings = old_value
|
||||||
return False
|
return False
|
||||||
else:
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
|
@ -196,7 +195,6 @@ class MelissaClimate(ClimateDevice):
|
||||||
return STATE_OFF
|
return STATE_OFF
|
||||||
elif state == self._api.STATE_IDLE:
|
elif state == self._api.STATE_IDLE:
|
||||||
return STATE_IDLE
|
return STATE_IDLE
|
||||||
else:
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def melissa_op_to_hass(self, mode):
|
def melissa_op_to_hass(self, mode):
|
||||||
|
@ -211,7 +209,6 @@ class MelissaClimate(ClimateDevice):
|
||||||
return STATE_DRY
|
return STATE_DRY
|
||||||
elif mode == self._api.MODE_FAN:
|
elif mode == self._api.MODE_FAN:
|
||||||
return STATE_FAN_ONLY
|
return STATE_FAN_ONLY
|
||||||
else:
|
|
||||||
_LOGGER.warning(
|
_LOGGER.warning(
|
||||||
"Operation mode %s could not be mapped to hass", mode)
|
"Operation mode %s could not be mapped to hass", mode)
|
||||||
return None
|
return None
|
||||||
|
@ -226,7 +223,6 @@ class MelissaClimate(ClimateDevice):
|
||||||
return SPEED_MEDIUM
|
return SPEED_MEDIUM
|
||||||
elif fan == self._api.FAN_HIGH:
|
elif fan == self._api.FAN_HIGH:
|
||||||
return SPEED_HIGH
|
return SPEED_HIGH
|
||||||
else:
|
|
||||||
_LOGGER.warning("Fan mode %s could not be mapped to hass", fan)
|
_LOGGER.warning("Fan mode %s could not be mapped to hass", fan)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
|
@ -482,15 +482,15 @@ class MqttClimate(MqttAvailability, ClimateDevice):
|
||||||
self.async_schedule_update_ha_state()
|
self.async_schedule_update_ha_state()
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_set_fan_mode(self, fan):
|
def async_set_fan_mode(self, fan_mode):
|
||||||
"""Set new target temperature."""
|
"""Set new target temperature."""
|
||||||
if self._send_if_off or self._current_operation != STATE_OFF:
|
if self._send_if_off or self._current_operation != STATE_OFF:
|
||||||
mqtt.async_publish(
|
mqtt.async_publish(
|
||||||
self.hass, self._topic[CONF_FAN_MODE_COMMAND_TOPIC],
|
self.hass, self._topic[CONF_FAN_MODE_COMMAND_TOPIC],
|
||||||
fan, self._qos, self._retain)
|
fan_mode, self._qos, self._retain)
|
||||||
|
|
||||||
if self._topic[CONF_FAN_MODE_STATE_TOPIC] is None:
|
if self._topic[CONF_FAN_MODE_STATE_TOPIC] is None:
|
||||||
self._current_fan_mode = fan
|
self._current_fan_mode = fan_mode
|
||||||
self.async_schedule_update_ha_state()
|
self.async_schedule_update_ha_state()
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
|
@ -552,15 +552,15 @@ class MqttClimate(MqttAvailability, ClimateDevice):
|
||||||
self.async_schedule_update_ha_state()
|
self.async_schedule_update_ha_state()
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_set_hold_mode(self, hold):
|
def async_set_hold_mode(self, hold_mode):
|
||||||
"""Update hold mode on."""
|
"""Update hold mode on."""
|
||||||
if self._topic[CONF_HOLD_COMMAND_TOPIC] is not None:
|
if self._topic[CONF_HOLD_COMMAND_TOPIC] is not None:
|
||||||
mqtt.async_publish(self.hass,
|
mqtt.async_publish(self.hass,
|
||||||
self._topic[CONF_HOLD_COMMAND_TOPIC],
|
self._topic[CONF_HOLD_COMMAND_TOPIC],
|
||||||
hold, self._qos, self._retain)
|
hold_mode, self._qos, self._retain)
|
||||||
|
|
||||||
if self._topic[CONF_HOLD_STATE_TOPIC] is None:
|
if self._topic[CONF_HOLD_STATE_TOPIC] is None:
|
||||||
self._hold = hold
|
self._hold = hold_mode
|
||||||
self.async_schedule_update_ha_state()
|
self.async_schedule_update_ha_state()
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
|
|
|
@ -143,14 +143,14 @@ class MySensorsHVAC(mysensors.MySensorsEntity, ClimateDevice):
|
||||||
self._values[value_type] = value
|
self._values[value_type] = value
|
||||||
self.schedule_update_ha_state()
|
self.schedule_update_ha_state()
|
||||||
|
|
||||||
def set_fan_mode(self, fan):
|
def set_fan_mode(self, fan_mode):
|
||||||
"""Set new target temperature."""
|
"""Set new target temperature."""
|
||||||
set_req = self.gateway.const.SetReq
|
set_req = self.gateway.const.SetReq
|
||||||
self.gateway.set_child_value(
|
self.gateway.set_child_value(
|
||||||
self.node_id, self.child_id, set_req.V_HVAC_SPEED, fan)
|
self.node_id, self.child_id, set_req.V_HVAC_SPEED, fan_mode)
|
||||||
if self.gateway.optimistic:
|
if self.gateway.optimistic:
|
||||||
# Optimistically assume that device has changed state
|
# Optimistically assume that device has changed state
|
||||||
self._values[set_req.V_HVAC_SPEED] = fan
|
self._values[set_req.V_HVAC_SPEED] = fan_mode
|
||||||
self.schedule_update_ha_state()
|
self.schedule_update_ha_state()
|
||||||
|
|
||||||
def set_operation_mode(self, operation_mode):
|
def set_operation_mode(self, operation_mode):
|
||||||
|
|
|
@ -207,9 +207,9 @@ class NestThermostat(ClimateDevice):
|
||||||
"""List of available fan modes."""
|
"""List of available fan modes."""
|
||||||
return self._fan_list
|
return self._fan_list
|
||||||
|
|
||||||
def set_fan_mode(self, fan):
|
def set_fan_mode(self, fan_mode):
|
||||||
"""Turn fan on/off."""
|
"""Turn fan on/off."""
|
||||||
self.device.fan = fan.lower()
|
self.device.fan = fan_mode.lower()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def min_temp(self):
|
def min_temp(self):
|
||||||
|
@ -225,7 +225,7 @@ class NestThermostat(ClimateDevice):
|
||||||
"""Cache value from Python-nest."""
|
"""Cache value from Python-nest."""
|
||||||
self._location = self.device.where
|
self._location = self.device.where
|
||||||
self._name = self.device.name
|
self._name = self.device.name
|
||||||
self._humidity = self.device.humidity,
|
self._humidity = self.device.humidity
|
||||||
self._temperature = self.device.temperature
|
self._temperature = self.device.temperature
|
||||||
self._mode = self.device.mode
|
self._mode = self.device.mode
|
||||||
self._target_temperature = self.device.target
|
self._target_temperature = self.device.target
|
||||||
|
|
|
@ -185,7 +185,7 @@ class NuHeatThermostat(ClimateDevice):
|
||||||
self._thermostat.resume_schedule()
|
self._thermostat.resume_schedule()
|
||||||
self._force_update = True
|
self._force_update = True
|
||||||
|
|
||||||
def set_hold_mode(self, hold_mode, **kwargs):
|
def set_hold_mode(self, hold_mode):
|
||||||
"""Update the hold mode of the thermostat."""
|
"""Update the hold mode of the thermostat."""
|
||||||
if hold_mode == MODE_AUTO:
|
if hold_mode == MODE_AUTO:
|
||||||
schedule_mode = SCHEDULE_RUN
|
schedule_mode = SCHEDULE_RUN
|
||||||
|
|
|
@ -183,7 +183,6 @@ class RadioThermostat(ClimateDevice):
|
||||||
"""List of available fan modes."""
|
"""List of available fan modes."""
|
||||||
if self._is_model_ct80:
|
if self._is_model_ct80:
|
||||||
return CT80_FAN_OPERATION_LIST
|
return CT80_FAN_OPERATION_LIST
|
||||||
else:
|
|
||||||
return CT30_FAN_OPERATION_LIST
|
return CT30_FAN_OPERATION_LIST
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -191,9 +190,9 @@ class RadioThermostat(ClimateDevice):
|
||||||
"""Return whether the fan is on."""
|
"""Return whether the fan is on."""
|
||||||
return self._fmode
|
return self._fmode
|
||||||
|
|
||||||
def set_fan_mode(self, fan):
|
def set_fan_mode(self, fan_mode):
|
||||||
"""Turn fan on/off."""
|
"""Turn fan on/off."""
|
||||||
code = FAN_MODE_TO_CODE.get(fan, None)
|
code = FAN_MODE_TO_CODE.get(fan_mode, None)
|
||||||
if code is not None:
|
if code is not None:
|
||||||
self.device.fmode = code
|
self.device.fmode = code
|
||||||
|
|
||||||
|
|
|
@ -240,13 +240,13 @@ class SensiboClimate(ClimateDevice):
|
||||||
def min_temp(self):
|
def min_temp(self):
|
||||||
"""Return the minimum temperature."""
|
"""Return the minimum temperature."""
|
||||||
return self._temperatures_list[0] \
|
return self._temperatures_list[0] \
|
||||||
if len(self._temperatures_list) else super().min_temp()
|
if self._temperatures_list else super().min_temp()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def max_temp(self):
|
def max_temp(self):
|
||||||
"""Return the maximum temperature."""
|
"""Return the maximum temperature."""
|
||||||
return self._temperatures_list[-1] \
|
return self._temperatures_list[-1] \
|
||||||
if len(self._temperatures_list) else super().max_temp()
|
if self._temperatures_list else super().max_temp()
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_set_temperature(self, **kwargs):
|
def async_set_temperature(self, **kwargs):
|
||||||
|
@ -273,11 +273,11 @@ class SensiboClimate(ClimateDevice):
|
||||||
self._id, 'targetTemperature', temperature, self._ac_states)
|
self._id, 'targetTemperature', temperature, self._ac_states)
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_set_fan_mode(self, fan):
|
def async_set_fan_mode(self, fan_mode):
|
||||||
"""Set new target fan mode."""
|
"""Set new target fan mode."""
|
||||||
with async_timeout.timeout(TIMEOUT):
|
with async_timeout.timeout(TIMEOUT):
|
||||||
yield from self._client.async_set_ac_state_property(
|
yield from self._client.async_set_ac_state_property(
|
||||||
self._id, 'fanLevel', fan, self._ac_states)
|
self._id, 'fanLevel', fan_mode, self._ac_states)
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_set_operation_mode(self, operation_mode):
|
def async_set_operation_mode(self, operation_mode):
|
||||||
|
|
|
@ -213,6 +213,7 @@ class TadoClimate(ClimateDevice):
|
||||||
self._target_temp = temperature
|
self._target_temp = temperature
|
||||||
self._control_heating()
|
self._control_heating()
|
||||||
|
|
||||||
|
# pylint: disable=arguments-differ
|
||||||
def set_operation_mode(self, readable_operation_mode):
|
def set_operation_mode(self, readable_operation_mode):
|
||||||
"""Set new operation mode."""
|
"""Set new operation mode."""
|
||||||
operation_mode = CONST_MODE_SMART_SCHEDULE
|
operation_mode = CONST_MODE_SMART_SCHEDULE
|
||||||
|
|
|
@ -51,7 +51,6 @@ class TeslaThermostat(TeslaDevice, ClimateDevice):
|
||||||
mode = self.tesla_device.is_hvac_enabled()
|
mode = self.tesla_device.is_hvac_enabled()
|
||||||
if mode:
|
if mode:
|
||||||
return OPERATION_LIST[0] # On
|
return OPERATION_LIST[0] # On
|
||||||
else:
|
|
||||||
return OPERATION_LIST[1] # Off
|
return OPERATION_LIST[1] # Off
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -111,7 +111,6 @@ class VenstarThermostat(ClimateDevice):
|
||||||
"""Return the unit of measurement, as defined by the API."""
|
"""Return the unit of measurement, as defined by the API."""
|
||||||
if self._client.tempunits == self._client.TEMPUNITS_F:
|
if self._client.tempunits == self._client.TEMPUNITS_F:
|
||||||
return TEMP_FAHRENHEIT
|
return TEMP_FAHRENHEIT
|
||||||
else:
|
|
||||||
return TEMP_CELSIUS
|
return TEMP_CELSIUS
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -143,7 +142,6 @@ class VenstarThermostat(ClimateDevice):
|
||||||
return STATE_COOL
|
return STATE_COOL
|
||||||
elif self._client.mode == self._client.MODE_AUTO:
|
elif self._client.mode == self._client.MODE_AUTO:
|
||||||
return STATE_AUTO
|
return STATE_AUTO
|
||||||
else:
|
|
||||||
return STATE_OFF
|
return STATE_OFF
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -151,7 +149,6 @@ class VenstarThermostat(ClimateDevice):
|
||||||
"""Return the fan setting."""
|
"""Return the fan setting."""
|
||||||
if self._client.fan == self._client.FAN_AUTO:
|
if self._client.fan == self._client.FAN_AUTO:
|
||||||
return STATE_AUTO
|
return STATE_AUTO
|
||||||
else:
|
|
||||||
return STATE_ON
|
return STATE_ON
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -169,7 +166,6 @@ class VenstarThermostat(ClimateDevice):
|
||||||
return self._client.heattemp
|
return self._client.heattemp
|
||||||
elif self._client.mode == self._client.MODE_COOL:
|
elif self._client.mode == self._client.MODE_COOL:
|
||||||
return self._client.cooltemp
|
return self._client.cooltemp
|
||||||
else:
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -177,7 +173,6 @@ class VenstarThermostat(ClimateDevice):
|
||||||
"""Return the lower bound temp if auto mode is on."""
|
"""Return the lower bound temp if auto mode is on."""
|
||||||
if self._client.mode == self._client.MODE_AUTO:
|
if self._client.mode == self._client.MODE_AUTO:
|
||||||
return self._client.heattemp
|
return self._client.heattemp
|
||||||
else:
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -185,7 +180,6 @@ class VenstarThermostat(ClimateDevice):
|
||||||
"""Return the upper bound temp if auto mode is on."""
|
"""Return the upper bound temp if auto mode is on."""
|
||||||
if self._client.mode == self._client.MODE_AUTO:
|
if self._client.mode == self._client.MODE_AUTO:
|
||||||
return self._client.cooltemp
|
return self._client.cooltemp
|
||||||
else:
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -245,9 +239,9 @@ class VenstarThermostat(ClimateDevice):
|
||||||
if not success:
|
if not success:
|
||||||
_LOGGER.error("Failed to change the temperature")
|
_LOGGER.error("Failed to change the temperature")
|
||||||
|
|
||||||
def set_fan_mode(self, fan):
|
def set_fan_mode(self, fan_mode):
|
||||||
"""Set new target fan mode."""
|
"""Set new target fan mode."""
|
||||||
if fan == STATE_ON:
|
if fan_mode == STATE_ON:
|
||||||
success = self._client.set_fan(self._client.FAN_ON)
|
success = self._client.set_fan(self._client.FAN_ON)
|
||||||
else:
|
else:
|
||||||
success = self._client.set_fan(self._client.FAN_AUTO)
|
success = self._client.set_fan(self._client.FAN_AUTO)
|
||||||
|
|
|
@ -85,13 +85,13 @@ class VeraThermostat(VeraDevice, ClimateDevice):
|
||||||
"""Return a list of available fan modes."""
|
"""Return a list of available fan modes."""
|
||||||
return FAN_OPERATION_LIST
|
return FAN_OPERATION_LIST
|
||||||
|
|
||||||
def set_fan_mode(self, mode):
|
def set_fan_mode(self, fan_mode):
|
||||||
"""Set new target temperature."""
|
"""Set new target temperature."""
|
||||||
if mode == FAN_OPERATION_LIST[0]:
|
if fan_mode == FAN_OPERATION_LIST[0]:
|
||||||
self.vera_device.fan_on()
|
self.vera_device.fan_on()
|
||||||
elif mode == FAN_OPERATION_LIST[1]:
|
elif fan_mode == FAN_OPERATION_LIST[1]:
|
||||||
self.vera_device.fan_auto()
|
self.vera_device.fan_auto()
|
||||||
elif mode == FAN_OPERATION_LIST[2]:
|
elif fan_mode == FAN_OPERATION_LIST[2]:
|
||||||
return self.vera_device.fan_cycle()
|
return self.vera_device.fan_cycle()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -324,9 +324,9 @@ class WinkThermostat(WinkDevice, ClimateDevice):
|
||||||
return self.wink.fan_modes()
|
return self.wink.fan_modes()
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def set_fan_mode(self, fan):
|
def set_fan_mode(self, fan_mode):
|
||||||
"""Turn fan on/off."""
|
"""Turn fan on/off."""
|
||||||
self.wink.set_fan_mode(fan.lower())
|
self.wink.set_fan_mode(fan_mode.lower())
|
||||||
|
|
||||||
def turn_aux_heat_on(self):
|
def turn_aux_heat_on(self):
|
||||||
"""Turn auxiliary heater on."""
|
"""Turn auxiliary heater on."""
|
||||||
|
@ -486,7 +486,6 @@ class WinkAC(WinkDevice, ClimateDevice):
|
||||||
return SPEED_LOW
|
return SPEED_LOW
|
||||||
elif speed <= 0.66:
|
elif speed <= 0.66:
|
||||||
return SPEED_MEDIUM
|
return SPEED_MEDIUM
|
||||||
else:
|
|
||||||
return SPEED_HIGH
|
return SPEED_HIGH
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -494,18 +493,18 @@ class WinkAC(WinkDevice, ClimateDevice):
|
||||||
"""Return a list of available fan modes."""
|
"""Return a list of available fan modes."""
|
||||||
return [SPEED_LOW, SPEED_MEDIUM, SPEED_HIGH]
|
return [SPEED_LOW, SPEED_MEDIUM, SPEED_HIGH]
|
||||||
|
|
||||||
def set_fan_mode(self, fan):
|
def set_fan_mode(self, fan_mode):
|
||||||
"""
|
"""
|
||||||
Set fan speed.
|
Set fan speed.
|
||||||
|
|
||||||
The official Wink app only supports 3 modes [low, medium, high]
|
The official Wink app only supports 3 modes [low, medium, high]
|
||||||
which are equal to [0.33, 0.66, 1.0] respectively.
|
which are equal to [0.33, 0.66, 1.0] respectively.
|
||||||
"""
|
"""
|
||||||
if fan == SPEED_LOW:
|
if fan_mode == SPEED_LOW:
|
||||||
speed = 0.33
|
speed = 0.33
|
||||||
elif fan == SPEED_MEDIUM:
|
elif fan_mode == SPEED_MEDIUM:
|
||||||
speed = 0.66
|
speed = 0.66
|
||||||
elif fan == SPEED_HIGH:
|
elif fan_mode == SPEED_HIGH:
|
||||||
speed = 1.0
|
speed = 1.0
|
||||||
self.wink.set_ac_fan_speed(speed)
|
self.wink.set_ac_fan_speed(speed)
|
||||||
|
|
||||||
|
|
|
@ -198,10 +198,10 @@ class ZWaveClimate(ZWaveDeviceEntity, ClimateDevice):
|
||||||
|
|
||||||
self.values.primary.data = temperature
|
self.values.primary.data = temperature
|
||||||
|
|
||||||
def set_fan_mode(self, fan):
|
def set_fan_mode(self, fan_mode):
|
||||||
"""Set new target fan mode."""
|
"""Set new target fan mode."""
|
||||||
if self.values.fan_mode:
|
if self.values.fan_mode:
|
||||||
self.values.fan_mode.data = fan
|
self.values.fan_mode.data = fan_mode
|
||||||
|
|
||||||
def set_operation_mode(self, operation_mode):
|
def set_operation_mode(self, operation_mode):
|
||||||
"""Set new target operation mode."""
|
"""Set new target operation mode."""
|
||||||
|
|
|
@ -31,6 +31,8 @@ class InvalidCode(CloudError):
|
||||||
class PasswordChangeRequired(CloudError):
|
class PasswordChangeRequired(CloudError):
|
||||||
"""Raised when a password change is required."""
|
"""Raised when a password change is required."""
|
||||||
|
|
||||||
|
# https://github.com/PyCQA/pylint/issues/1085
|
||||||
|
# pylint: disable=useless-super-delegation
|
||||||
def __init__(self, message='Password change required.'):
|
def __init__(self, message='Password change required.'):
|
||||||
"""Initialize a password change required error."""
|
"""Initialize a password change required error."""
|
||||||
super().__init__(message)
|
super().__init__(message)
|
||||||
|
|
|
@ -5,7 +5,8 @@ For more details about this platform, please refer to the documentation
|
||||||
https://home-assistant.io/components/demo/
|
https://home-assistant.io/components/demo/
|
||||||
"""
|
"""
|
||||||
from homeassistant.components.cover import (
|
from homeassistant.components.cover import (
|
||||||
CoverDevice, SUPPORT_OPEN, SUPPORT_CLOSE)
|
CoverDevice, SUPPORT_OPEN, SUPPORT_CLOSE, ATTR_POSITION,
|
||||||
|
ATTR_TILT_POSITION)
|
||||||
from homeassistant.helpers.event import track_utc_time_change
|
from homeassistant.helpers.event import track_utc_time_change
|
||||||
|
|
||||||
|
|
||||||
|
@ -137,8 +138,9 @@ class DemoCover(CoverDevice):
|
||||||
self._listen_cover_tilt()
|
self._listen_cover_tilt()
|
||||||
self._requested_closing_tilt = False
|
self._requested_closing_tilt = False
|
||||||
|
|
||||||
def set_cover_position(self, position, **kwargs):
|
def set_cover_position(self, **kwargs):
|
||||||
"""Move the cover to a specific position."""
|
"""Move the cover to a specific position."""
|
||||||
|
position = kwargs.get(ATTR_POSITION)
|
||||||
self._set_position = round(position, -1)
|
self._set_position = round(position, -1)
|
||||||
if self._position == position:
|
if self._position == position:
|
||||||
return
|
return
|
||||||
|
@ -146,8 +148,9 @@ class DemoCover(CoverDevice):
|
||||||
self._listen_cover()
|
self._listen_cover()
|
||||||
self._requested_closing = position < self._position
|
self._requested_closing = position < self._position
|
||||||
|
|
||||||
def set_cover_tilt_position(self, tilt_position, **kwargs):
|
def set_cover_tilt_position(self, **kwargs):
|
||||||
"""Move the cover til to a specific position."""
|
"""Move the cover til to a specific position."""
|
||||||
|
tilt_position = kwargs.get(ATTR_TILT_POSITION)
|
||||||
self._set_tilt_position = round(tilt_position, -1)
|
self._set_tilt_position = round(tilt_position, -1)
|
||||||
if self._tilt_position == tilt_position:
|
if self._tilt_position == tilt_position:
|
||||||
return
|
return
|
||||||
|
|
|
@ -201,21 +201,21 @@ class GaradgetCover(CoverDevice):
|
||||||
"""Check the state of the service during an operation."""
|
"""Check the state of the service during an operation."""
|
||||||
self.schedule_update_ha_state(True)
|
self.schedule_update_ha_state(True)
|
||||||
|
|
||||||
def close_cover(self):
|
def close_cover(self, **kwargs):
|
||||||
"""Close the cover."""
|
"""Close the cover."""
|
||||||
if self._state not in ['close', 'closing']:
|
if self._state not in ['close', 'closing']:
|
||||||
ret = self._put_command('setState', 'close')
|
ret = self._put_command('setState', 'close')
|
||||||
self._start_watcher('close')
|
self._start_watcher('close')
|
||||||
return ret.get('return_value') == 1
|
return ret.get('return_value') == 1
|
||||||
|
|
||||||
def open_cover(self):
|
def open_cover(self, **kwargs):
|
||||||
"""Open the cover."""
|
"""Open the cover."""
|
||||||
if self._state not in ['open', 'opening']:
|
if self._state not in ['open', 'opening']:
|
||||||
ret = self._put_command('setState', 'open')
|
ret = self._put_command('setState', 'open')
|
||||||
self._start_watcher('open')
|
self._start_watcher('open')
|
||||||
return ret.get('return_value') == 1
|
return ret.get('return_value') == 1
|
||||||
|
|
||||||
def stop_cover(self):
|
def stop_cover(self, **kwargs):
|
||||||
"""Stop the door where it is."""
|
"""Stop the door where it is."""
|
||||||
if self._state not in ['stopped']:
|
if self._state not in ['stopped']:
|
||||||
ret = self._put_command('setState', 'stop')
|
ret = self._put_command('setState', 'stop')
|
||||||
|
|
|
@ -42,10 +42,6 @@ def setup_platform(hass, config: ConfigType,
|
||||||
class ISYCoverDevice(ISYDevice, CoverDevice):
|
class ISYCoverDevice(ISYDevice, CoverDevice):
|
||||||
"""Representation of an ISY994 cover device."""
|
"""Representation of an ISY994 cover device."""
|
||||||
|
|
||||||
def __init__(self, node: object) -> None:
|
|
||||||
"""Initialize the ISY994 cover device."""
|
|
||||||
super().__init__(node)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_cover_position(self) -> int:
|
def current_cover_position(self) -> int:
|
||||||
"""Return the current cover position."""
|
"""Return the current cover position."""
|
||||||
|
@ -61,7 +57,6 @@ class ISYCoverDevice(ISYDevice, CoverDevice):
|
||||||
"""Get the state of the ISY994 cover device."""
|
"""Get the state of the ISY994 cover device."""
|
||||||
if self.is_unknown():
|
if self.is_unknown():
|
||||||
return None
|
return None
|
||||||
else:
|
|
||||||
return VALUE_TO_STATE.get(self.value, STATE_OPEN)
|
return VALUE_TO_STATE.get(self.value, STATE_OPEN)
|
||||||
|
|
||||||
def open_cover(self, **kwargs) -> None:
|
def open_cover(self, **kwargs) -> None:
|
||||||
|
|
|
@ -84,11 +84,11 @@ class MyQDevice(CoverDevice):
|
||||||
"""Return true if cover is closed, else False."""
|
"""Return true if cover is closed, else False."""
|
||||||
return self._status == STATE_CLOSED
|
return self._status == STATE_CLOSED
|
||||||
|
|
||||||
def close_cover(self):
|
def close_cover(self, **kwargs):
|
||||||
"""Issue close command to cover."""
|
"""Issue close command to cover."""
|
||||||
self.myq.close_device(self.device_id)
|
self.myq.close_device(self.device_id)
|
||||||
|
|
||||||
def open_cover(self):
|
def open_cover(self, **kwargs):
|
||||||
"""Issue open command to cover."""
|
"""Issue open command to cover."""
|
||||||
self.myq.open_device(self.device_id)
|
self.myq.open_device(self.device_id)
|
||||||
|
|
||||||
|
|
|
@ -119,14 +119,14 @@ class OpenGarageCover(CoverDevice):
|
||||||
return None
|
return None
|
||||||
return self._state in [STATE_CLOSED, STATE_OPENING]
|
return self._state in [STATE_CLOSED, STATE_OPENING]
|
||||||
|
|
||||||
def close_cover(self):
|
def close_cover(self, **kwargs):
|
||||||
"""Close the cover."""
|
"""Close the cover."""
|
||||||
if self._state not in [STATE_CLOSED, STATE_CLOSING]:
|
if self._state not in [STATE_CLOSED, STATE_CLOSING]:
|
||||||
self._state_before_move = self._state
|
self._state_before_move = self._state
|
||||||
self._state = STATE_CLOSING
|
self._state = STATE_CLOSING
|
||||||
self._push_button()
|
self._push_button()
|
||||||
|
|
||||||
def open_cover(self):
|
def open_cover(self, **kwargs):
|
||||||
"""Open the cover."""
|
"""Open the cover."""
|
||||||
if self._state not in [STATE_OPEN, STATE_OPENING]:
|
if self._state not in [STATE_OPEN, STATE_OPENING]:
|
||||||
self._state_before_move = self._state
|
self._state_before_move = self._state
|
||||||
|
|
|
@ -109,12 +109,12 @@ class RPiGPIOCover(CoverDevice):
|
||||||
sleep(self._relay_time)
|
sleep(self._relay_time)
|
||||||
rpi_gpio.write_output(self._relay_pin, not self._invert_relay)
|
rpi_gpio.write_output(self._relay_pin, not self._invert_relay)
|
||||||
|
|
||||||
def close_cover(self):
|
def close_cover(self, **kwargs):
|
||||||
"""Close the cover."""
|
"""Close the cover."""
|
||||||
if not self.is_closed:
|
if not self.is_closed:
|
||||||
self._trigger()
|
self._trigger()
|
||||||
|
|
||||||
def open_cover(self):
|
def open_cover(self, **kwargs):
|
||||||
"""Open the cover."""
|
"""Open the cover."""
|
||||||
if self.is_closed:
|
if self.is_closed:
|
||||||
self._trigger()
|
self._trigger()
|
||||||
|
|
|
@ -6,7 +6,7 @@ https://home-assistant.io/components/cover.tahoma/
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.components.cover import CoverDevice
|
from homeassistant.components.cover import CoverDevice, ATTR_POSITION
|
||||||
from homeassistant.components.tahoma import (
|
from homeassistant.components.tahoma import (
|
||||||
DOMAIN as TAHOMA_DOMAIN, TahomaDevice)
|
DOMAIN as TAHOMA_DOMAIN, TahomaDevice)
|
||||||
|
|
||||||
|
@ -49,9 +49,9 @@ class TahomaCover(TahomaDevice, CoverDevice):
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def set_cover_position(self, position, **kwargs):
|
def set_cover_position(self, **kwargs):
|
||||||
"""Move the cover to a specific position."""
|
"""Move the cover to a specific position."""
|
||||||
self.apply_action('setPosition', 100 - position)
|
self.apply_action('setPosition', 100 - kwargs.get(ATTR_POSITION))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_closed(self):
|
def is_closed(self):
|
||||||
|
@ -64,7 +64,6 @@ class TahomaCover(TahomaDevice, CoverDevice):
|
||||||
"""Return the class of the device."""
|
"""Return the class of the device."""
|
||||||
if self.tahoma_device.type == 'io:WindowOpenerVeluxIOComponent':
|
if self.tahoma_device.type == 'io:WindowOpenerVeluxIOComponent':
|
||||||
return 'window'
|
return 'window'
|
||||||
else:
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def open_cover(self, **kwargs):
|
def open_cover(self, **kwargs):
|
||||||
|
|
|
@ -6,7 +6,8 @@ https://home-assistant.io/components/cover.vera/
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.components.cover import CoverDevice, ENTITY_ID_FORMAT
|
from homeassistant.components.cover import CoverDevice, ENTITY_ID_FORMAT, \
|
||||||
|
ATTR_POSITION
|
||||||
from homeassistant.components.vera import (
|
from homeassistant.components.vera import (
|
||||||
VERA_CONTROLLER, VERA_DEVICES, VeraDevice)
|
VERA_CONTROLLER, VERA_DEVICES, VeraDevice)
|
||||||
|
|
||||||
|
@ -44,9 +45,9 @@ class VeraCover(VeraDevice, CoverDevice):
|
||||||
return 100
|
return 100
|
||||||
return position
|
return position
|
||||||
|
|
||||||
def set_cover_position(self, position, **kwargs):
|
def set_cover_position(self, **kwargs):
|
||||||
"""Move the cover to a specific position."""
|
"""Move the cover to a specific position."""
|
||||||
self.vera_device.set_level(position)
|
self.vera_device.set_level(kwargs.get(ATTR_POSITION))
|
||||||
self.schedule_update_ha_state()
|
self.schedule_update_ha_state()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -6,7 +6,8 @@ https://home-assistant.io/components/cover.wink/
|
||||||
"""
|
"""
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
from homeassistant.components.cover import CoverDevice, STATE_UNKNOWN
|
from homeassistant.components.cover import CoverDevice, STATE_UNKNOWN, \
|
||||||
|
ATTR_POSITION
|
||||||
from homeassistant.components.wink import WinkDevice, DOMAIN
|
from homeassistant.components.wink import WinkDevice, DOMAIN
|
||||||
|
|
||||||
DEPENDENCIES = ['wink']
|
DEPENDENCIES = ['wink']
|
||||||
|
@ -42,16 +43,16 @@ class WinkCoverDevice(WinkDevice, CoverDevice):
|
||||||
"""Open the cover."""
|
"""Open the cover."""
|
||||||
self.wink.set_state(1)
|
self.wink.set_state(1)
|
||||||
|
|
||||||
def set_cover_position(self, position, **kwargs):
|
def set_cover_position(self, **kwargs):
|
||||||
"""Move the cover shutter to a specific position."""
|
"""Move the cover shutter to a specific position."""
|
||||||
self.wink.set_state(float(position)/100)
|
position = kwargs.get(ATTR_POSITION)
|
||||||
|
self.wink.set_state(position/100)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_cover_position(self):
|
def current_cover_position(self):
|
||||||
"""Return the current position of cover shutter."""
|
"""Return the current position of cover shutter."""
|
||||||
if self.wink.state() is not None:
|
if self.wink.state() is not None:
|
||||||
return int(self.wink.state()*100)
|
return int(self.wink.state()*100)
|
||||||
else:
|
|
||||||
return STATE_UNKNOWN
|
return STATE_UNKNOWN
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
"""Support for Xiaomi curtain."""
|
"""Support for Xiaomi curtain."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.components.cover import CoverDevice
|
from homeassistant.components.cover import CoverDevice, ATTR_POSITION
|
||||||
from homeassistant.components.xiaomi_aqara import (PY_XIAOMI_GATEWAY,
|
from homeassistant.components.xiaomi_aqara import (PY_XIAOMI_GATEWAY,
|
||||||
XiaomiDevice)
|
XiaomiDevice)
|
||||||
|
|
||||||
|
@ -55,8 +55,9 @@ class XiaomiGenericCover(XiaomiDevice, CoverDevice):
|
||||||
"""Stop the cover."""
|
"""Stop the cover."""
|
||||||
self._write_to_hub(self._sid, **{self._data_key['status']: 'stop'})
|
self._write_to_hub(self._sid, **{self._data_key['status']: 'stop'})
|
||||||
|
|
||||||
def set_cover_position(self, position, **kwargs):
|
def set_cover_position(self, **kwargs):
|
||||||
"""Move the cover to a specific position."""
|
"""Move the cover to a specific position."""
|
||||||
|
position = kwargs.get(ATTR_POSITION)
|
||||||
self._write_to_hub(self._sid, **{self._data_key['pos']: str(position)})
|
self._write_to_hub(self._sid, **{self._data_key['pos']: str(position)})
|
||||||
|
|
||||||
def parse_data(self, data, raw_data):
|
def parse_data(self, data, raw_data):
|
||||||
|
|
|
@ -8,7 +8,7 @@ https://home-assistant.io/components/cover.zwave/
|
||||||
# pylint: disable=import-error
|
# pylint: disable=import-error
|
||||||
import logging
|
import logging
|
||||||
from homeassistant.components.cover import (
|
from homeassistant.components.cover import (
|
||||||
DOMAIN, SUPPORT_OPEN, SUPPORT_CLOSE)
|
DOMAIN, SUPPORT_OPEN, SUPPORT_CLOSE, ATTR_POSITION)
|
||||||
from homeassistant.components.zwave import ZWaveDeviceEntity
|
from homeassistant.components.zwave import ZWaveDeviceEntity
|
||||||
from homeassistant.components import zwave
|
from homeassistant.components import zwave
|
||||||
from homeassistant.components.zwave import async_setup_platform # noqa # pylint: disable=unused-import
|
from homeassistant.components.zwave import async_setup_platform # noqa # pylint: disable=unused-import
|
||||||
|
@ -97,9 +97,10 @@ class ZwaveRollershutter(zwave.ZWaveDeviceEntity, CoverDevice):
|
||||||
"""Move the roller shutter down."""
|
"""Move the roller shutter down."""
|
||||||
self._network.manager.pressButton(self._close_id)
|
self._network.manager.pressButton(self._close_id)
|
||||||
|
|
||||||
def set_cover_position(self, position, **kwargs):
|
def set_cover_position(self, **kwargs):
|
||||||
"""Move the roller shutter to a specific position."""
|
"""Move the roller shutter to a specific position."""
|
||||||
self.node.set_dimmer(self.values.primary.value_id, position)
|
self.node.set_dimmer(self.values.primary.value_id,
|
||||||
|
kwargs.get(ATTR_POSITION))
|
||||||
|
|
||||||
def stop_cover(self, **kwargs):
|
def stop_cover(self, **kwargs):
|
||||||
"""Stop the roller shutter."""
|
"""Stop the roller shutter."""
|
||||||
|
@ -139,11 +140,11 @@ class ZwaveGarageDoorSwitch(ZwaveGarageDoorBase):
|
||||||
"""Return the current position of Zwave garage door."""
|
"""Return the current position of Zwave garage door."""
|
||||||
return not self._state
|
return not self._state
|
||||||
|
|
||||||
def close_cover(self):
|
def close_cover(self, **kwargs):
|
||||||
"""Close the garage door."""
|
"""Close the garage door."""
|
||||||
self.values.primary.data = False
|
self.values.primary.data = False
|
||||||
|
|
||||||
def open_cover(self):
|
def open_cover(self, **kwargs):
|
||||||
"""Open the garage door."""
|
"""Open the garage door."""
|
||||||
self.values.primary.data = True
|
self.values.primary.data = True
|
||||||
|
|
||||||
|
@ -166,10 +167,10 @@ class ZwaveGarageDoorBarrier(ZwaveGarageDoorBase):
|
||||||
"""Return the current position of Zwave garage door."""
|
"""Return the current position of Zwave garage door."""
|
||||||
return self._state == "Closed"
|
return self._state == "Closed"
|
||||||
|
|
||||||
def close_cover(self):
|
def close_cover(self, **kwargs):
|
||||||
"""Close the garage door."""
|
"""Close the garage door."""
|
||||||
self.values.primary.data = "Closed"
|
self.values.primary.data = "Closed"
|
||||||
|
|
||||||
def open_cover(self):
|
def open_cover(self, **kwargs):
|
||||||
"""Open the garage door."""
|
"""Open the garage door."""
|
||||||
self.values.primary.data = "Opened"
|
self.values.primary.data = "Opened"
|
||||||
|
|
|
@ -252,11 +252,11 @@ class DeviceTracker(object):
|
||||||
)
|
)
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_see(self, mac: str=None, dev_id: str=None, host_name: str=None,
|
def async_see(self, mac: str = None, dev_id: str = None,
|
||||||
location_name: str=None, gps: GPSType=None,
|
host_name: str = None, location_name: str = None,
|
||||||
gps_accuracy=None, battery: str=None, attributes: dict=None,
|
gps: GPSType = None, gps_accuracy=None, battery: str = None,
|
||||||
source_type: str=SOURCE_TYPE_GPS, picture: str=None,
|
attributes: dict = None, source_type: str = SOURCE_TYPE_GPS,
|
||||||
icon: str=None):
|
picture: str = None, icon: str = None):
|
||||||
"""Notify the device tracker that you see a device.
|
"""Notify the device tracker that you see a device.
|
||||||
|
|
||||||
This method is a coroutine.
|
This method is a coroutine.
|
||||||
|
@ -477,7 +477,8 @@ class Device(Entity):
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_seen(self, host_name: str = None, location_name: str = None,
|
def async_seen(self, host_name: str = None, location_name: str = None,
|
||||||
gps: GPSType = None, gps_accuracy=0, battery: str = None,
|
gps: GPSType = None, gps_accuracy=0, battery: str = None,
|
||||||
attributes: dict=None, source_type: str=SOURCE_TYPE_GPS):
|
attributes: dict = None,
|
||||||
|
source_type: str = SOURCE_TYPE_GPS):
|
||||||
"""Mark the device as seen."""
|
"""Mark the device as seen."""
|
||||||
self.source_type = source_type
|
self.source_type = source_type
|
||||||
self.last_seen = dt_util.utcnow()
|
self.last_seen = dt_util.utcnow()
|
||||||
|
@ -621,16 +622,16 @@ class DeviceScanner(object):
|
||||||
"""
|
"""
|
||||||
return self.hass.async_add_job(self.scan_devices)
|
return self.hass.async_add_job(self.scan_devices)
|
||||||
|
|
||||||
def get_device_name(self, mac: str) -> str:
|
def get_device_name(self, device: str) -> str:
|
||||||
"""Get device name from mac."""
|
"""Get the name of a device."""
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
def async_get_device_name(self, mac: str) -> Any:
|
def async_get_device_name(self, device: str) -> Any:
|
||||||
"""Get device name from mac.
|
"""Get the name of a device.
|
||||||
|
|
||||||
This method must be run in the event loop and returns a coroutine.
|
This method must be run in the event loop and returns a coroutine.
|
||||||
"""
|
"""
|
||||||
return self.hass.async_add_job(self.get_device_name, mac)
|
return self.hass.async_add_job(self.get_device_name, device)
|
||||||
|
|
||||||
|
|
||||||
def load_config(path: str, hass: HomeAssistantType, consider_home: timedelta):
|
def load_config(path: str, hass: HomeAssistantType, consider_home: timedelta):
|
||||||
|
|
|
@ -177,7 +177,6 @@ class AutomaticAuthCallbackView(HomeAssistantView):
|
||||||
_LOGGER.error(
|
_LOGGER.error(
|
||||||
"Error authorizing Automatic: %s", params['error'])
|
"Error authorizing Automatic: %s", params['error'])
|
||||||
return response
|
return response
|
||||||
else:
|
|
||||||
_LOGGER.error(
|
_LOGGER.error(
|
||||||
"Error authorizing Automatic. Invalid response returned")
|
"Error authorizing Automatic. Invalid response returned")
|
||||||
return response
|
return response
|
||||||
|
|
|
@ -45,10 +45,10 @@ class BboxDeviceScanner(DeviceScanner):
|
||||||
|
|
||||||
return [device.mac for device in self.last_results]
|
return [device.mac for device in self.last_results]
|
||||||
|
|
||||||
def get_device_name(self, mac):
|
def get_device_name(self, device):
|
||||||
"""Return the name of the given device or None if we don't know."""
|
"""Return the name of the given device or None if we don't know."""
|
||||||
filter_named = [device.name for device in self.last_results if
|
filter_named = [result.name for result in self.last_results if
|
||||||
device.mac == mac]
|
result.mac == device]
|
||||||
|
|
||||||
if filter_named:
|
if filter_named:
|
||||||
return filter_named[0]
|
return filter_named[0]
|
||||||
|
|
|
@ -102,7 +102,7 @@ def setup_scanner(hass, config, see, discovery_info=None):
|
||||||
"""Lookup Bluetooth LE devices and update status."""
|
"""Lookup Bluetooth LE devices and update status."""
|
||||||
devs = discover_ble_devices()
|
devs = discover_ble_devices()
|
||||||
for mac in devs_to_track:
|
for mac in devs_to_track:
|
||||||
_LOGGER.debug("Checking " + mac)
|
_LOGGER.debug("Checking %s", mac)
|
||||||
result = mac in devs
|
result = mac in devs
|
||||||
if not result:
|
if not result:
|
||||||
# Could not lookup device name
|
# Could not lookup device name
|
||||||
|
|
|
@ -41,7 +41,7 @@ def setup_scanner(hass, config, see, discovery_info=None):
|
||||||
result = bluetooth.discover_devices(
|
result = bluetooth.discover_devices(
|
||||||
duration=8, lookup_names=True, flush_cache=True,
|
duration=8, lookup_names=True, flush_cache=True,
|
||||||
lookup_class=False)
|
lookup_class=False)
|
||||||
_LOGGER.debug("Bluetooth devices discovered = " + str(len(result)))
|
_LOGGER.debug("Bluetooth devices discovered = %d", len(result))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
yaml_path = hass.config.path(YAML_DEVICES)
|
yaml_path = hass.config.path(YAML_DEVICES)
|
||||||
|
|
|
@ -75,9 +75,9 @@ class FritzBoxScanner(DeviceScanner):
|
||||||
active_hosts.append(known_host['mac'])
|
active_hosts.append(known_host['mac'])
|
||||||
return active_hosts
|
return active_hosts
|
||||||
|
|
||||||
def get_device_name(self, mac):
|
def get_device_name(self, device):
|
||||||
"""Return the name of the given device or None if is not known."""
|
"""Return the name of the given device or None if is not known."""
|
||||||
ret = self.fritz_box.get_specific_host_entry(mac).get(
|
ret = self.fritz_box.get_specific_host_entry(device).get(
|
||||||
'NewHostName'
|
'NewHostName'
|
||||||
)
|
)
|
||||||
if ret == {}:
|
if ret == {}:
|
||||||
|
|
|
@ -120,7 +120,6 @@ class GeofencyView(HomeAssistantView):
|
||||||
"""Return name of device tracker."""
|
"""Return name of device tracker."""
|
||||||
if 'beaconUUID' in data:
|
if 'beaconUUID' in data:
|
||||||
return "{}_{}".format(BEACON_DEV_PREFIX, data['name'])
|
return "{}_{}".format(BEACON_DEV_PREFIX, data['name'])
|
||||||
else:
|
|
||||||
return data['device']
|
return data['device']
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
|
|
|
@ -60,11 +60,11 @@ class HitronCODADeviceScanner(DeviceScanner):
|
||||||
|
|
||||||
return [device.mac for device in self.last_results]
|
return [device.mac for device in self.last_results]
|
||||||
|
|
||||||
def get_device_name(self, mac):
|
def get_device_name(self, device):
|
||||||
"""Return the name of the device with the given MAC address."""
|
"""Return the name of the device with the given MAC address."""
|
||||||
name = next((
|
name = next((
|
||||||
device.name for device in self.last_results
|
result.name for result in self.last_results
|
||||||
if device.mac == mac), None)
|
if result.mac == device), None)
|
||||||
return name
|
return name
|
||||||
|
|
||||||
def _login(self):
|
def _login(self):
|
||||||
|
|
|
@ -86,6 +86,7 @@ class HuaweiDeviceScanner(DeviceScanner):
|
||||||
active_clients = [client for client in data if client.state]
|
active_clients = [client for client in data if client.state]
|
||||||
self.last_results = active_clients
|
self.last_results = active_clients
|
||||||
|
|
||||||
|
# pylint: disable=logging-not-lazy
|
||||||
_LOGGER.debug("Active clients: " + "\n"
|
_LOGGER.debug("Active clients: " + "\n"
|
||||||
.join((client.mac + " " + client.name)
|
.join((client.mac + " " + client.name)
|
||||||
for client in active_clients))
|
for client in active_clients))
|
||||||
|
|
|
@ -67,10 +67,10 @@ class KeeneticNDMS2DeviceScanner(DeviceScanner):
|
||||||
|
|
||||||
return [device.mac for device in self.last_results]
|
return [device.mac for device in self.last_results]
|
||||||
|
|
||||||
def get_device_name(self, mac):
|
def get_device_name(self, device):
|
||||||
"""Return the name of the given device or None if we don't know."""
|
"""Return the name of the given device or None if we don't know."""
|
||||||
filter_named = [device.name for device in self.last_results
|
filter_named = [result.name for result in self.last_results
|
||||||
if device.mac == mac]
|
if result.mac == device]
|
||||||
|
|
||||||
if filter_named:
|
if filter_named:
|
||||||
return filter_named[0]
|
return filter_named[0]
|
||||||
|
|
|
@ -62,7 +62,7 @@ class LinksysAPDeviceScanner(DeviceScanner):
|
||||||
return self.last_results
|
return self.last_results
|
||||||
|
|
||||||
# pylint: disable=no-self-use
|
# pylint: disable=no-self-use
|
||||||
def get_device_name(self, mac):
|
def get_device_name(self, device):
|
||||||
"""
|
"""
|
||||||
Return the name (if known) of the device.
|
Return the name (if known) of the device.
|
||||||
|
|
||||||
|
|
|
@ -45,9 +45,9 @@ class LinksysSmartWifiDeviceScanner(DeviceScanner):
|
||||||
|
|
||||||
return self.last_results.keys()
|
return self.last_results.keys()
|
||||||
|
|
||||||
def get_device_name(self, mac):
|
def get_device_name(self, device):
|
||||||
"""Return the name (if known) of the device."""
|
"""Return the name (if known) of the device."""
|
||||||
return self.last_results.get(mac)
|
return self.last_results.get(device)
|
||||||
|
|
||||||
def _update_info(self):
|
def _update_info(self):
|
||||||
"""Check for connected devices."""
|
"""Check for connected devices."""
|
||||||
|
|
|
@ -85,7 +85,7 @@ class MerakiView(HomeAssistantView):
|
||||||
return self.json_message('Invalid device type',
|
return self.json_message('Invalid device type',
|
||||||
HTTP_UNPROCESSABLE_ENTITY)
|
HTTP_UNPROCESSABLE_ENTITY)
|
||||||
_LOGGER.debug("Processing %s", data['type'])
|
_LOGGER.debug("Processing %s", data['type'])
|
||||||
if len(data["data"]["observations"]) == 0:
|
if not data["data"]["observations"]:
|
||||||
_LOGGER.debug("No observations found")
|
_LOGGER.debug("No observations found")
|
||||||
return
|
return
|
||||||
self._handle(request.app['hass'], data)
|
self._handle(request.app['hass'], data)
|
||||||
|
@ -107,8 +107,7 @@ class MerakiView(HomeAssistantView):
|
||||||
|
|
||||||
if lat == "NaN" or lng == "NaN":
|
if lat == "NaN" or lng == "NaN":
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"No coordinates received, skipping location for: " + mac
|
"No coordinates received, skipping location for: %s", mac)
|
||||||
)
|
|
||||||
gps_location = None
|
gps_location = None
|
||||||
accuracy = None
|
accuracy = None
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -137,9 +137,9 @@ class MikrotikScanner(DeviceScanner):
|
||||||
self._update_info()
|
self._update_info()
|
||||||
return [device for device in self.last_results]
|
return [device for device in self.last_results]
|
||||||
|
|
||||||
def get_device_name(self, mac):
|
def get_device_name(self, device):
|
||||||
"""Return the name of the given device or None if we don't know."""
|
"""Return the name of the given device or None if we don't know."""
|
||||||
return self.last_results.get(mac)
|
return self.last_results.get(device)
|
||||||
|
|
||||||
def _update_info(self):
|
def _update_info(self):
|
||||||
"""Retrieve latest information from the Mikrotik box."""
|
"""Retrieve latest information from the Mikrotik box."""
|
||||||
|
|
|
@ -70,11 +70,11 @@ class NetgearDeviceScanner(DeviceScanner):
|
||||||
|
|
||||||
return (device.mac for device in self.last_results)
|
return (device.mac for device in self.last_results)
|
||||||
|
|
||||||
def get_device_name(self, mac):
|
def get_device_name(self, device):
|
||||||
"""Return the name of the given device or None if we don't know."""
|
"""Return the name of the given device or None if we don't know."""
|
||||||
try:
|
try:
|
||||||
return next(device.name for device in self.last_results
|
return next(result.name for result in self.last_results
|
||||||
if device.mac == mac)
|
if result.mac == device)
|
||||||
except StopIteration:
|
except StopIteration:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
|
@ -85,10 +85,10 @@ class NmapDeviceScanner(DeviceScanner):
|
||||||
|
|
||||||
return [device.mac for device in self.last_results]
|
return [device.mac for device in self.last_results]
|
||||||
|
|
||||||
def get_device_name(self, mac):
|
def get_device_name(self, device):
|
||||||
"""Return the name of the given device or None if we don't know."""
|
"""Return the name of the given device or None if we don't know."""
|
||||||
filter_named = [device.name for device in self.last_results
|
filter_named = [result.name for result in self.last_results
|
||||||
if device.mac == mac]
|
if result.mac == device]
|
||||||
|
|
||||||
if filter_named:
|
if filter_named:
|
||||||
return filter_named[0]
|
return filter_named[0]
|
||||||
|
|
|
@ -83,10 +83,10 @@ class TadoDeviceScanner(DeviceScanner):
|
||||||
return [device.mac for device in self.last_results]
|
return [device.mac for device in self.last_results]
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_get_device_name(self, mac):
|
def async_get_device_name(self, device):
|
||||||
"""Return the name of the given device or None if we don't know."""
|
"""Return the name of the given device or None if we don't know."""
|
||||||
filter_named = [device.name for device in self.last_results
|
filter_named = [result.name for result in self.last_results
|
||||||
if device.mac == mac]
|
if result.mac == device]
|
||||||
|
|
||||||
if filter_named:
|
if filter_named:
|
||||||
return filter_named[0]
|
return filter_named[0]
|
||||||
|
|
|
@ -96,11 +96,11 @@ class UbusDeviceScanner(DeviceScanner):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
@_refresh_on_access_denied
|
@_refresh_on_access_denied
|
||||||
def get_device_name(self, mac):
|
def get_device_name(self, device):
|
||||||
"""Return the name of the given device or None if we don't know."""
|
"""Return the name of the given device or None if we don't know."""
|
||||||
if self.mac2name is None:
|
if self.mac2name is None:
|
||||||
self._generate_mac2name()
|
self._generate_mac2name()
|
||||||
name = self.mac2name.get(mac.upper(), None)
|
name = self.mac2name.get(device.upper(), None)
|
||||||
return name
|
return name
|
||||||
|
|
||||||
@_refresh_on_access_denied
|
@_refresh_on_access_denied
|
||||||
|
|
|
@ -101,13 +101,13 @@ class UnifiScanner(DeviceScanner):
|
||||||
self._update()
|
self._update()
|
||||||
return self._clients.keys()
|
return self._clients.keys()
|
||||||
|
|
||||||
def get_device_name(self, mac):
|
def get_device_name(self, device):
|
||||||
"""Return the name (if known) of the device.
|
"""Return the name (if known) of the device.
|
||||||
|
|
||||||
If a name has been set in Unifi, then return that, else
|
If a name has been set in Unifi, then return that, else
|
||||||
return the hostname if it has been detected.
|
return the hostname if it has been detected.
|
||||||
"""
|
"""
|
||||||
client = self._clients.get(mac, {})
|
client = self._clients.get(device, {})
|
||||||
name = client.get('name') or client.get('hostname')
|
name = client.get('name') or client.get('hostname')
|
||||||
_LOGGER.debug("Device mac %s name %s", mac, name)
|
_LOGGER.debug("Device mac %s name %s", device, name)
|
||||||
return name
|
return name
|
||||||
|
|
|
@ -140,7 +140,6 @@ class Dominos():
|
||||||
if self.closest_store is None:
|
if self.closest_store is None:
|
||||||
_LOGGER.warning('Cannot get menu. Store may be closed')
|
_LOGGER.warning('Cannot get menu. Store may be closed')
|
||||||
return []
|
return []
|
||||||
else:
|
|
||||||
menu = self.closest_store.get_menu()
|
menu = self.closest_store.get_menu()
|
||||||
product_entries = []
|
product_entries = []
|
||||||
|
|
||||||
|
@ -203,7 +202,6 @@ class DominosOrder(Entity):
|
||||||
"""Return the state either closed, orderable or unorderable."""
|
"""Return the state either closed, orderable or unorderable."""
|
||||||
if self.dominos.closest_store is None:
|
if self.dominos.closest_store is None:
|
||||||
return 'closed'
|
return 'closed'
|
||||||
else:
|
|
||||||
return 'orderable' if self._orderable else 'unorderable'
|
return 'orderable' if self._orderable else 'unorderable'
|
||||||
|
|
||||||
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
||||||
|
|
|
@ -157,7 +157,8 @@ def toggle(hass, entity_id: str=None) -> None:
|
||||||
|
|
||||||
|
|
||||||
@bind_hass
|
@bind_hass
|
||||||
def oscillate(hass, entity_id: str=None, should_oscillate: bool=True) -> None:
|
def oscillate(hass, entity_id: str = None,
|
||||||
|
should_oscillate: bool = True) -> None:
|
||||||
"""Set oscillation on all or specified fan."""
|
"""Set oscillation on all or specified fan."""
|
||||||
data = {
|
data = {
|
||||||
key: value for key, value in [
|
key: value for key, value in [
|
||||||
|
@ -258,10 +259,12 @@ class FanEntity(ToggleEntity):
|
||||||
"""
|
"""
|
||||||
return self.hass.async_add_job(self.set_direction, direction)
|
return self.hass.async_add_job(self.set_direction, direction)
|
||||||
|
|
||||||
|
# pylint: disable=arguments-differ
|
||||||
def turn_on(self: ToggleEntity, speed: str = None, **kwargs) -> None:
|
def turn_on(self: ToggleEntity, speed: str = None, **kwargs) -> None:
|
||||||
"""Turn on the fan."""
|
"""Turn on the fan."""
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
|
# pylint: disable=arguments-differ
|
||||||
def async_turn_on(self: ToggleEntity, speed: str = None, **kwargs):
|
def async_turn_on(self: ToggleEntity, speed: str = None, **kwargs):
|
||||||
"""Turn on the fan.
|
"""Turn on the fan.
|
||||||
|
|
||||||
|
|
|
@ -97,21 +97,21 @@ class ComfoConnectFan(FanEntity):
|
||||||
"""Turn off the fan (to away)."""
|
"""Turn off the fan (to away)."""
|
||||||
self.set_speed(SPEED_OFF)
|
self.set_speed(SPEED_OFF)
|
||||||
|
|
||||||
def set_speed(self, mode):
|
def set_speed(self, speed: str):
|
||||||
"""Set fan speed."""
|
"""Set fan speed."""
|
||||||
_LOGGER.debug('Changing fan mode to %s.', mode)
|
_LOGGER.debug('Changing fan speed to %s.', speed)
|
||||||
|
|
||||||
from pycomfoconnect import (
|
from pycomfoconnect import (
|
||||||
CMD_FAN_MODE_AWAY, CMD_FAN_MODE_LOW, CMD_FAN_MODE_MEDIUM,
|
CMD_FAN_MODE_AWAY, CMD_FAN_MODE_LOW, CMD_FAN_MODE_MEDIUM,
|
||||||
CMD_FAN_MODE_HIGH)
|
CMD_FAN_MODE_HIGH)
|
||||||
|
|
||||||
if mode == SPEED_OFF:
|
if speed == SPEED_OFF:
|
||||||
self._ccb.comfoconnect.cmd_rmi_request(CMD_FAN_MODE_AWAY)
|
self._ccb.comfoconnect.cmd_rmi_request(CMD_FAN_MODE_AWAY)
|
||||||
elif mode == SPEED_LOW:
|
elif speed == SPEED_LOW:
|
||||||
self._ccb.comfoconnect.cmd_rmi_request(CMD_FAN_MODE_LOW)
|
self._ccb.comfoconnect.cmd_rmi_request(CMD_FAN_MODE_LOW)
|
||||||
elif mode == SPEED_MEDIUM:
|
elif speed == SPEED_MEDIUM:
|
||||||
self._ccb.comfoconnect.cmd_rmi_request(CMD_FAN_MODE_MEDIUM)
|
self._ccb.comfoconnect.cmd_rmi_request(CMD_FAN_MODE_MEDIUM)
|
||||||
elif mode == SPEED_HIGH:
|
elif speed == SPEED_HIGH:
|
||||||
self._ccb.comfoconnect.cmd_rmi_request(CMD_FAN_MODE_HIGH)
|
self._ccb.comfoconnect.cmd_rmi_request(CMD_FAN_MODE_HIGH)
|
||||||
|
|
||||||
# Update current mode
|
# Update current mode
|
||||||
|
|
|
@ -59,13 +59,13 @@ class DemoFan(FanEntity):
|
||||||
"""Get the list of available speeds."""
|
"""Get the list of available speeds."""
|
||||||
return [STATE_OFF, SPEED_LOW, SPEED_MEDIUM, SPEED_HIGH]
|
return [STATE_OFF, SPEED_LOW, SPEED_MEDIUM, SPEED_HIGH]
|
||||||
|
|
||||||
def turn_on(self, speed: str=None) -> None:
|
def turn_on(self, speed: str = None, **kwargs) -> None:
|
||||||
"""Turn on the entity."""
|
"""Turn on the entity."""
|
||||||
if speed is None:
|
if speed is None:
|
||||||
speed = SPEED_MEDIUM
|
speed = SPEED_MEDIUM
|
||||||
self.set_speed(speed)
|
self.set_speed(speed)
|
||||||
|
|
||||||
def turn_off(self) -> None:
|
def turn_off(self, **kwargs) -> None:
|
||||||
"""Turn off the entity."""
|
"""Turn off the entity."""
|
||||||
self.oscillate(False)
|
self.oscillate(False)
|
||||||
self.set_speed(STATE_OFF)
|
self.set_speed(STATE_OFF)
|
||||||
|
|
|
@ -48,10 +48,6 @@ def setup_platform(hass, config: ConfigType,
|
||||||
class ISYFanDevice(ISYDevice, FanEntity):
|
class ISYFanDevice(ISYDevice, FanEntity):
|
||||||
"""Representation of an ISY994 fan device."""
|
"""Representation of an ISY994 fan device."""
|
||||||
|
|
||||||
def __init__(self, node) -> None:
|
|
||||||
"""Initialize the ISY994 fan device."""
|
|
||||||
super().__init__(node)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def speed(self) -> str:
|
def speed(self) -> str:
|
||||||
"""Return the current speed."""
|
"""Return the current speed."""
|
||||||
|
@ -99,7 +95,7 @@ class ISYFanProgram(ISYFanDevice):
|
||||||
if not self._actions.runThen():
|
if not self._actions.runThen():
|
||||||
_LOGGER.error("Unable to turn off the fan")
|
_LOGGER.error("Unable to turn off the fan")
|
||||||
|
|
||||||
def turn_on(self, **kwargs) -> None:
|
def turn_on(self, speed: str = None, **kwargs) -> None:
|
||||||
"""Send the turn off command to ISY994 fan program."""
|
"""Send the turn off command to ISY994 fan program."""
|
||||||
if not self._actions.runElse():
|
if not self._actions.runElse():
|
||||||
_LOGGER.error("Unable to turn on the fan")
|
_LOGGER.error("Unable to turn on the fan")
|
||||||
|
|
|
@ -252,7 +252,7 @@ class MqttFan(MqttAvailability, FanEntity):
|
||||||
return self._oscillation
|
return self._oscillation
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_turn_on(self, speed: str=None) -> None:
|
def async_turn_on(self, speed: str = None, **kwargs) -> None:
|
||||||
"""Turn on the entity.
|
"""Turn on the entity.
|
||||||
|
|
||||||
This method is a coroutine.
|
This method is a coroutine.
|
||||||
|
@ -264,7 +264,7 @@ class MqttFan(MqttAvailability, FanEntity):
|
||||||
yield from self.async_set_speed(speed)
|
yield from self.async_set_speed(speed)
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_turn_off(self) -> None:
|
def async_turn_off(self, **kwargs) -> None:
|
||||||
"""Turn off the entity.
|
"""Turn off the entity.
|
||||||
|
|
||||||
This method is a coroutine.
|
This method is a coroutine.
|
||||||
|
|
|
@ -128,13 +128,13 @@ class VelbusFan(FanEntity):
|
||||||
"""Get the list of available speeds."""
|
"""Get the list of available speeds."""
|
||||||
return [STATE_OFF, SPEED_LOW, SPEED_MEDIUM, SPEED_HIGH]
|
return [STATE_OFF, SPEED_LOW, SPEED_MEDIUM, SPEED_HIGH]
|
||||||
|
|
||||||
def turn_on(self, speed, **kwargs):
|
def turn_on(self, speed=None, **kwargs):
|
||||||
"""Turn on the entity."""
|
"""Turn on the entity."""
|
||||||
if speed is None:
|
if speed is None:
|
||||||
speed = SPEED_MEDIUM
|
speed = SPEED_MEDIUM
|
||||||
self.set_speed(speed)
|
self.set_speed(speed)
|
||||||
|
|
||||||
def turn_off(self):
|
def turn_off(self, **kwargs):
|
||||||
"""Turn off the entity."""
|
"""Turn off the entity."""
|
||||||
self.set_speed(STATE_OFF)
|
self.set_speed(STATE_OFF)
|
||||||
|
|
||||||
|
|
|
@ -283,7 +283,7 @@ class XiaomiAirPurifier(FanEntity):
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_set_speed(self: ToggleEntity, speed: str) -> None:
|
def async_set_speed(self: ToggleEntity, speed: str) -> None:
|
||||||
"""Set the speed of the fan."""
|
"""Set the speed of the fan."""
|
||||||
_LOGGER.debug("Setting the operation mode to: " + speed)
|
_LOGGER.debug("Setting the operation mode to: %s", speed)
|
||||||
from miio.airpurifier import OperationMode
|
from miio.airpurifier import OperationMode
|
||||||
|
|
||||||
yield from self._try_command(
|
yield from self._try_command(
|
||||||
|
|
|
@ -180,7 +180,8 @@ def _check_for_insteon_type(hass: HomeAssistant, node,
|
||||||
|
|
||||||
|
|
||||||
def _check_for_uom_id(hass: HomeAssistant, node,
|
def _check_for_uom_id(hass: HomeAssistant, node,
|
||||||
single_domain: str=None, uom_list: list=None) -> bool:
|
single_domain: str = None,
|
||||||
|
uom_list: list = None) -> bool:
|
||||||
"""Check if a node's uom matches any of the domains uom filter.
|
"""Check if a node's uom matches any of the domains uom filter.
|
||||||
|
|
||||||
This is used for versions of the ISY firmware that report uoms as a single
|
This is used for versions of the ISY firmware that report uoms as a single
|
||||||
|
@ -302,7 +303,8 @@ def _categorize_programs(hass: HomeAssistant, programs: dict) -> None:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
for dtype, _, node_id in folder.children:
|
for dtype, _, node_id in folder.children:
|
||||||
if dtype == KEY_FOLDER:
|
if dtype != KEY_FOLDER:
|
||||||
|
continue
|
||||||
entity_folder = folder[node_id]
|
entity_folder = folder[node_id]
|
||||||
try:
|
try:
|
||||||
status = entity_folder[KEY_STATUS]
|
status = entity_folder[KEY_STATUS]
|
||||||
|
@ -461,7 +463,6 @@ class ISYDevice(Entity):
|
||||||
"""Return the state of the ISY device."""
|
"""Return the state of the ISY device."""
|
||||||
if self.is_unknown():
|
if self.is_unknown():
|
||||||
return None
|
return None
|
||||||
else:
|
|
||||||
return super().state
|
return super().state
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -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_devices, discovery_info=None):
|
||||||
"""Set up an Avion switch."""
|
"""Set up an Avion switch."""
|
||||||
# pylint: disable=import-error
|
# pylint: disable=import-error, no-member
|
||||||
import avion
|
import avion
|
||||||
|
|
||||||
lights = []
|
lights = []
|
||||||
|
@ -70,7 +70,7 @@ class AvionLight(Light):
|
||||||
|
|
||||||
def __init__(self, device):
|
def __init__(self, device):
|
||||||
"""Initialize the light."""
|
"""Initialize the light."""
|
||||||
# pylint: disable=import-error
|
# pylint: disable=import-error, no-member
|
||||||
import avion
|
import avion
|
||||||
|
|
||||||
self._name = device['name']
|
self._name = device['name']
|
||||||
|
@ -117,7 +117,7 @@ class AvionLight(Light):
|
||||||
|
|
||||||
def set_state(self, brightness):
|
def set_state(self, brightness):
|
||||||
"""Set the state of this lamp to the provided brightness."""
|
"""Set the state of this lamp to the provided brightness."""
|
||||||
# pylint: disable=import-error
|
# pylint: disable=import-error, no-member
|
||||||
import avion
|
import avion
|
||||||
|
|
||||||
# Bluetooth LE is unreliable, and the connection may drop at any
|
# Bluetooth LE is unreliable, and the connection may drop at any
|
||||||
|
|
|
@ -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_devices, discovery_info=None):
|
||||||
"""Set up the Blinkt Light platform."""
|
"""Set up the Blinkt Light platform."""
|
||||||
# pylint: disable=import-error
|
# pylint: disable=import-error, no-member
|
||||||
import blinkt
|
import blinkt
|
||||||
|
|
||||||
# ensure that the lights are off when exiting
|
# ensure that the lights are off when exiting
|
||||||
|
|
|
@ -37,7 +37,7 @@ def retry(method):
|
||||||
@wraps(method)
|
@wraps(method)
|
||||||
def wrapper_retry(device, *args, **kwargs):
|
def wrapper_retry(device, *args, **kwargs):
|
||||||
"""Try send command and retry on error."""
|
"""Try send command and retry on error."""
|
||||||
# pylint: disable=import-error
|
# pylint: disable=import-error, no-member
|
||||||
import decora
|
import decora
|
||||||
import bluepy
|
import bluepy
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ class DecoraLight(Light):
|
||||||
|
|
||||||
def __init__(self, device):
|
def __init__(self, device):
|
||||||
"""Initialize the light."""
|
"""Initialize the light."""
|
||||||
# pylint: disable=import-error
|
# pylint: disable=import-error, no-member
|
||||||
import decora
|
import decora
|
||||||
|
|
||||||
self._name = device['name']
|
self._name = device['name']
|
||||||
|
|
|
@ -36,7 +36,7 @@ NOTIFICATION_TITLE = 'myLeviton Decora Setup'
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
"""Set up the Decora WiFi platform."""
|
"""Set up the Decora WiFi platform."""
|
||||||
# pylint: disable=import-error
|
# pylint: disable=import-error, no-member, no-name-in-module
|
||||||
from decora_wifi import DecoraWiFiSession
|
from decora_wifi import DecoraWiFiSession
|
||||||
from decora_wifi.models.person import Person
|
from decora_wifi.models.person import Person
|
||||||
from decora_wifi.models.residential_account import ResidentialAccount
|
from decora_wifi.models.residential_account import ResidentialAccount
|
||||||
|
@ -93,7 +93,6 @@ class DecoraWifiLight(Light):
|
||||||
"""Return supported features."""
|
"""Return supported features."""
|
||||||
if self._switch.canSetLevel:
|
if self._switch.canSetLevel:
|
||||||
return SUPPORT_BRIGHTNESS | SUPPORT_TRANSITION
|
return SUPPORT_BRIGHTNESS | SUPPORT_TRANSITION
|
||||||
else:
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -116,7 +116,7 @@ class HiveDeviceLight(Light):
|
||||||
for entity in self.session.entities:
|
for entity in self.session.entities:
|
||||||
entity.handle_update(self.data_updatesource)
|
entity.handle_update(self.data_updatesource)
|
||||||
|
|
||||||
def turn_off(self):
|
def turn_off(self, **kwargs):
|
||||||
"""Instruct the light to turn off."""
|
"""Instruct the light to turn off."""
|
||||||
self.session.light.turn_off(self.node_id)
|
self.session.light.turn_off(self.node_id)
|
||||||
for entity in self.session.entities:
|
for entity in self.session.entities:
|
||||||
|
|
|
@ -91,7 +91,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
if discovery_info is None or 'bridge_id' not in discovery_info:
|
if discovery_info is None or 'bridge_id' not in discovery_info:
|
||||||
return
|
return
|
||||||
|
|
||||||
if config is not None and len(config) > 0:
|
if config is not None and config:
|
||||||
# Legacy configuration, will be removed in 0.60
|
# Legacy configuration, will be removed in 0.60
|
||||||
config_str = yaml.dump([config])
|
config_str = yaml.dump([config])
|
||||||
# Indent so it renders in a fixed-width font
|
# Indent so it renders in a fixed-width font
|
||||||
|
|
|
@ -29,10 +29,6 @@ def setup_platform(hass, config: ConfigType,
|
||||||
class ISYLightDevice(ISYDevice, Light):
|
class ISYLightDevice(ISYDevice, Light):
|
||||||
"""Representation of an ISY994 light device."""
|
"""Representation of an ISY994 light device."""
|
||||||
|
|
||||||
def __init__(self, node: object) -> None:
|
|
||||||
"""Initialize the ISY994 light device."""
|
|
||||||
super().__init__(node)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self) -> bool:
|
def is_on(self) -> bool:
|
||||||
"""Get whether the ISY994 light is on."""
|
"""Get whether the ISY994 light is on."""
|
||||||
|
@ -48,6 +44,7 @@ class ISYLightDevice(ISYDevice, Light):
|
||||||
if not self._node.off():
|
if not self._node.off():
|
||||||
_LOGGER.debug("Unable to turn off light")
|
_LOGGER.debug("Unable to turn off light")
|
||||||
|
|
||||||
|
# pylint: disable=arguments-differ
|
||||||
def turn_on(self, brightness=None, **kwargs) -> None:
|
def turn_on(self, brightness=None, **kwargs) -> None:
|
||||||
"""Send the turn on command to the ISY994 light device."""
|
"""Send the turn on command to the ISY994 light device."""
|
||||||
if not self._node.on(val=brightness):
|
if not self._node.on(val=brightness):
|
||||||
|
|
|
@ -198,6 +198,7 @@ class LimitlessLEDGroup(Light):
|
||||||
"""Return the brightness property."""
|
"""Return the brightness property."""
|
||||||
return self._brightness
|
return self._brightness
|
||||||
|
|
||||||
|
# pylint: disable=arguments-differ
|
||||||
@state(False)
|
@state(False)
|
||||||
def turn_off(self, transition_time, pipeline, **kwargs):
|
def turn_off(self, transition_time, pipeline, **kwargs):
|
||||||
"""Turn off a group."""
|
"""Turn off a group."""
|
||||||
|
@ -231,6 +232,7 @@ class LimitlessLEDWhiteGroup(LimitlessLEDGroup):
|
||||||
"""Flag supported features."""
|
"""Flag supported features."""
|
||||||
return SUPPORT_LIMITLESSLED_WHITE
|
return SUPPORT_LIMITLESSLED_WHITE
|
||||||
|
|
||||||
|
# pylint: disable=arguments-differ
|
||||||
@state(True)
|
@state(True)
|
||||||
def turn_on(self, transition_time, pipeline, **kwargs):
|
def turn_on(self, transition_time, pipeline, **kwargs):
|
||||||
"""Turn on (or adjust property of) a group."""
|
"""Turn on (or adjust property of) a group."""
|
||||||
|
@ -271,6 +273,7 @@ class LimitlessLEDRGBWGroup(LimitlessLEDGroup):
|
||||||
"""Flag supported features."""
|
"""Flag supported features."""
|
||||||
return SUPPORT_LIMITLESSLED_RGB
|
return SUPPORT_LIMITLESSLED_RGB
|
||||||
|
|
||||||
|
# pylint: disable=arguments-differ
|
||||||
@state(True)
|
@state(True)
|
||||||
def turn_on(self, transition_time, pipeline, **kwargs):
|
def turn_on(self, transition_time, pipeline, **kwargs):
|
||||||
"""Turn on (or adjust property of) a group."""
|
"""Turn on (or adjust property of) a group."""
|
||||||
|
@ -337,6 +340,7 @@ class LimitlessLEDRGBWWGroup(LimitlessLEDGroup):
|
||||||
"""Flag supported features."""
|
"""Flag supported features."""
|
||||||
return SUPPORT_LIMITLESSLED_RGBWW
|
return SUPPORT_LIMITLESSLED_RGBWW
|
||||||
|
|
||||||
|
# pylint: disable=arguments-differ
|
||||||
@state(True)
|
@state(True)
|
||||||
def turn_on(self, transition_time, pipeline, **kwargs):
|
def turn_on(self, transition_time, pipeline, **kwargs):
|
||||||
"""Turn on (or adjust property of) a group."""
|
"""Turn on (or adjust property of) a group."""
|
||||||
|
|
|
@ -130,7 +130,7 @@ class MySensorsLight(mysensors.MySensorsEntity, Light):
|
||||||
self._white = white
|
self._white = white
|
||||||
self._values[self.value_type] = hex_color
|
self._values[self.value_type] = hex_color
|
||||||
|
|
||||||
def turn_off(self):
|
def turn_off(self, **kwargs):
|
||||||
"""Turn the device off."""
|
"""Turn the device off."""
|
||||||
value_type = self.gateway.const.SetReq.V_LIGHT
|
value_type = self.gateway.const.SetReq.V_LIGHT
|
||||||
self.gateway.set_child_value(
|
self.gateway.set_child_value(
|
||||||
|
|
|
@ -118,7 +118,7 @@ class TPLinkSmartBulb(Light):
|
||||||
rgb = kwargs.get(ATTR_RGB_COLOR)
|
rgb = kwargs.get(ATTR_RGB_COLOR)
|
||||||
self.smartbulb.hsv = rgb_to_hsv(rgb)
|
self.smartbulb.hsv = rgb_to_hsv(rgb)
|
||||||
|
|
||||||
def turn_off(self):
|
def turn_off(self, **kwargs):
|
||||||
"""Turn the light off."""
|
"""Turn the light off."""
|
||||||
self.smartbulb.state = self.smartbulb.BULB_STATE_OFF
|
self.smartbulb.state = self.smartbulb.BULB_STATE_OFF
|
||||||
|
|
||||||
|
|
|
@ -118,6 +118,6 @@ class WinkLight(WinkDevice, Light):
|
||||||
|
|
||||||
self.wink.set_state(True, **state_kwargs)
|
self.wink.set_state(True, **state_kwargs)
|
||||||
|
|
||||||
def turn_off(self):
|
def turn_off(self, **kwargs):
|
||||||
"""Turn the switch off."""
|
"""Turn the switch off."""
|
||||||
self.wink.set_state(False)
|
self.wink.set_state(False)
|
||||||
|
|
|
@ -260,10 +260,6 @@ class XiaomiPhilipsGenericLight(Light):
|
||||||
class XiaomiPhilipsLightBall(XiaomiPhilipsGenericLight, Light):
|
class XiaomiPhilipsLightBall(XiaomiPhilipsGenericLight, Light):
|
||||||
"""Representation of a Xiaomi Philips Light Ball."""
|
"""Representation of a Xiaomi Philips Light Ball."""
|
||||||
|
|
||||||
def __init__(self, name, light, device_info):
|
|
||||||
"""Initialize the light device."""
|
|
||||||
super().__init__(name, light, device_info)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def color_temp(self):
|
def color_temp(self):
|
||||||
"""Return the color temperature."""
|
"""Return the color temperature."""
|
||||||
|
@ -345,10 +341,6 @@ class XiaomiPhilipsLightBall(XiaomiPhilipsGenericLight, Light):
|
||||||
class XiaomiPhilipsCeilingLamp(XiaomiPhilipsLightBall, Light):
|
class XiaomiPhilipsCeilingLamp(XiaomiPhilipsLightBall, Light):
|
||||||
"""Representation of a Xiaomi Philips Ceiling Lamp."""
|
"""Representation of a Xiaomi Philips Ceiling Lamp."""
|
||||||
|
|
||||||
def __init__(self, name, light, device_info):
|
|
||||||
"""Initialize the light device."""
|
|
||||||
super().__init__(name, light, device_info)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def min_mireds(self):
|
def min_mireds(self):
|
||||||
"""Return the coldest color_temp that this light supports."""
|
"""Return the coldest color_temp that this light supports."""
|
||||||
|
@ -363,6 +355,4 @@ class XiaomiPhilipsCeilingLamp(XiaomiPhilipsLightBall, Light):
|
||||||
class XiaomiPhilipsEyecareLamp(XiaomiPhilipsGenericLight, Light):
|
class XiaomiPhilipsEyecareLamp(XiaomiPhilipsGenericLight, Light):
|
||||||
"""Representation of a Xiaomi Philips Eyecare Lamp 2."""
|
"""Representation of a Xiaomi Philips Eyecare Lamp 2."""
|
||||||
|
|
||||||
def __init__(self, name, light, device_info):
|
pass
|
||||||
"""Initialize the light device."""
|
|
||||||
super().__init__(name, light, device_info)
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ LIRC interface to receive signals from an infrared remote control.
|
||||||
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/lirc/
|
https://home-assistant.io/components/lirc/
|
||||||
"""
|
"""
|
||||||
# pylint: disable=import-error
|
# pylint: disable=import-error,no-member
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
import logging
|
import logging
|
||||||
|
|
|
@ -53,7 +53,6 @@ class ISYLockDevice(ISYDevice, LockDevice):
|
||||||
"""Get the state of the lock."""
|
"""Get the state of the lock."""
|
||||||
if self.is_unknown():
|
if self.is_unknown():
|
||||||
return None
|
return None
|
||||||
else:
|
|
||||||
return VALUE_TO_STATE.get(self.value, STATE_UNKNOWN)
|
return VALUE_TO_STATE.get(self.value, STATE_UNKNOWN)
|
||||||
|
|
||||||
def lock(self, **kwargs) -> None:
|
def lock(self, **kwargs) -> None:
|
||||||
|
|
|
@ -85,7 +85,7 @@ class MediaExtractor(object):
|
||||||
else:
|
else:
|
||||||
entities = self.get_entities()
|
entities = self.get_entities()
|
||||||
|
|
||||||
if len(entities) == 0:
|
if not entities:
|
||||||
self.call_media_player_service(stream_selector, None)
|
self.call_media_player_service(stream_selector, None)
|
||||||
|
|
||||||
for entity_id in entities:
|
for entity_id in entities:
|
||||||
|
@ -108,7 +108,7 @@ class MediaExtractor(object):
|
||||||
_LOGGER.warning(
|
_LOGGER.warning(
|
||||||
"Playlists are not supported, looking for the first video")
|
"Playlists are not supported, looking for the first video")
|
||||||
entries = list(all_media['entries'])
|
entries = list(all_media['entries'])
|
||||||
if len(entries) > 0:
|
if entries:
|
||||||
selected_media = entries[0]
|
selected_media = entries[0]
|
||||||
else:
|
else:
|
||||||
_LOGGER.error("Playlist is empty")
|
_LOGGER.error("Playlist is empty")
|
||||||
|
|
|
@ -201,9 +201,9 @@ class SharpAquosTVDevice(MediaPlayerDevice):
|
||||||
self._remote.volume(int(self._volume * 60) - 2)
|
self._remote.volume(int(self._volume * 60) - 2)
|
||||||
|
|
||||||
@_retry
|
@_retry
|
||||||
def set_volume_level(self, level):
|
def set_volume_level(self, volume):
|
||||||
"""Set Volume media player."""
|
"""Set Volume media player."""
|
||||||
self._remote.volume(int(level * 60))
|
self._remote.volume(int(volume * 60))
|
||||||
|
|
||||||
@_retry
|
@_retry
|
||||||
def mute_volume(self, mute):
|
def mute_volume(self, mute):
|
||||||
|
|
|
@ -440,7 +440,6 @@ class BluesoundPlayer(MediaPlayerDevice):
|
||||||
return STATE_PAUSED
|
return STATE_PAUSED
|
||||||
elif status == 'stream' or status == 'play':
|
elif status == 'stream' or status == 'play':
|
||||||
return STATE_PLAYING
|
return STATE_PLAYING
|
||||||
else:
|
|
||||||
return STATE_IDLE
|
return STATE_IDLE
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -595,7 +594,7 @@ class BluesoundPlayer(MediaPlayerDevice):
|
||||||
# But it works with radio service_items will catch playlists.
|
# But it works with radio service_items will catch playlists.
|
||||||
items = [x for x in self._preset_items if 'url2' in x and
|
items = [x for x in self._preset_items if 'url2' in x and
|
||||||
parse.unquote(x['url2']) == stream_url]
|
parse.unquote(x['url2']) == stream_url]
|
||||||
if len(items) > 0:
|
if items:
|
||||||
return items[0]['title']
|
return items[0]['title']
|
||||||
|
|
||||||
# This could be a bit difficult to detect. Bluetooth could be named
|
# This could be a bit difficult to detect. Bluetooth could be named
|
||||||
|
@ -606,11 +605,11 @@ class BluesoundPlayer(MediaPlayerDevice):
|
||||||
if title == 'bluetooth' or stream_url == 'Capture:hw:2,0/44100/16/2':
|
if title == 'bluetooth' or stream_url == 'Capture:hw:2,0/44100/16/2':
|
||||||
items = [x for x in self._capture_items
|
items = [x for x in self._capture_items
|
||||||
if x['url'] == "Capture%3Abluez%3Abluetooth"]
|
if x['url'] == "Capture%3Abluez%3Abluetooth"]
|
||||||
if len(items) > 0:
|
if items:
|
||||||
return items[0]['title']
|
return items[0]['title']
|
||||||
|
|
||||||
items = [x for x in self._capture_items if x['url'] == stream_url]
|
items = [x for x in self._capture_items if x['url'] == stream_url]
|
||||||
if len(items) > 0:
|
if items:
|
||||||
return items[0]['title']
|
return items[0]['title']
|
||||||
|
|
||||||
if stream_url[:8] == 'Capture:':
|
if stream_url[:8] == 'Capture:':
|
||||||
|
@ -631,12 +630,12 @@ class BluesoundPlayer(MediaPlayerDevice):
|
||||||
|
|
||||||
items = [x for x in self._capture_items
|
items = [x for x in self._capture_items
|
||||||
if x['name'] == current_service]
|
if x['name'] == current_service]
|
||||||
if len(items) > 0:
|
if items:
|
||||||
return items[0]['title']
|
return items[0]['title']
|
||||||
|
|
||||||
items = [x for x in self._services_items
|
items = [x for x in self._services_items
|
||||||
if x['name'] == current_service]
|
if x['name'] == current_service]
|
||||||
if len(items) > 0:
|
if items:
|
||||||
return items[0]['title']
|
return items[0]['title']
|
||||||
|
|
||||||
if self._status.get('streamUrl', '') != '':
|
if self._status.get('streamUrl', '') != '':
|
||||||
|
|
|
@ -87,7 +87,7 @@ class CecPlayerDevice(CecDevice, MediaPlayerDevice):
|
||||||
self.send_keypress(KEY_STOP)
|
self.send_keypress(KEY_STOP)
|
||||||
self._state = STATE_IDLE
|
self._state = STATE_IDLE
|
||||||
|
|
||||||
def play_media(self, media_type, media_id):
|
def play_media(self, media_type, media_id, **kwargs):
|
||||||
"""Not supported."""
|
"""Not supported."""
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
|
|
|
@ -182,7 +182,6 @@ class MpdDevice(MediaPlayerDevice):
|
||||||
if name is None and title is None:
|
if name is None and title is None:
|
||||||
if file_name is None:
|
if file_name is None:
|
||||||
return "None"
|
return "None"
|
||||||
else:
|
|
||||||
return os.path.basename(file_name)
|
return os.path.basename(file_name)
|
||||||
elif name is None:
|
elif name is None:
|
||||||
return title
|
return title
|
||||||
|
|
|
@ -296,7 +296,7 @@ class SoundTouchDevice(MediaPlayerDevice):
|
||||||
|
|
||||||
def play_media(self, media_type, media_id, **kwargs):
|
def play_media(self, media_type, media_id, **kwargs):
|
||||||
"""Play a piece of media."""
|
"""Play a piece of media."""
|
||||||
_LOGGER.debug("Starting media with media_id: " + str(media_id))
|
_LOGGER.debug("Starting media with media_id: %s", media_id)
|
||||||
if re.match(r'http://', str(media_id)):
|
if re.match(r'http://', str(media_id)):
|
||||||
# URL
|
# URL
|
||||||
_LOGGER.debug("Playing URL %s", str(media_id))
|
_LOGGER.debug("Playing URL %s", str(media_id))
|
||||||
|
@ -307,11 +307,10 @@ class SoundTouchDevice(MediaPlayerDevice):
|
||||||
preset = next([preset for preset in presets if
|
preset = next([preset for preset in presets if
|
||||||
preset.preset_id == str(media_id)].__iter__(), None)
|
preset.preset_id == str(media_id)].__iter__(), None)
|
||||||
if preset is not None:
|
if preset is not None:
|
||||||
_LOGGER.debug("Playing preset: " + preset.name)
|
_LOGGER.debug("Playing preset: %s", preset.name)
|
||||||
self._device.select_preset(preset)
|
self._device.select_preset(preset)
|
||||||
else:
|
else:
|
||||||
_LOGGER.warning(
|
_LOGGER.warning("Unable to find preset with id %s", media_id)
|
||||||
"Unable to find preset with id " + str(media_id))
|
|
||||||
|
|
||||||
def create_zone(self, slaves):
|
def create_zone(self, slaves):
|
||||||
"""
|
"""
|
||||||
|
@ -323,8 +322,8 @@ class SoundTouchDevice(MediaPlayerDevice):
|
||||||
if not slaves:
|
if not slaves:
|
||||||
_LOGGER.warning("Unable to create zone without slaves")
|
_LOGGER.warning("Unable to create zone without slaves")
|
||||||
else:
|
else:
|
||||||
_LOGGER.info(
|
_LOGGER.info("Creating zone with master %s",
|
||||||
"Creating zone with master " + str(self.device.config.name))
|
self.device.config.name)
|
||||||
self.device.create_zone([slave.device for slave in slaves])
|
self.device.create_zone([slave.device for slave in slaves])
|
||||||
|
|
||||||
def remove_zone_slave(self, slaves):
|
def remove_zone_slave(self, slaves):
|
||||||
|
@ -341,8 +340,8 @@ class SoundTouchDevice(MediaPlayerDevice):
|
||||||
if not slaves:
|
if not slaves:
|
||||||
_LOGGER.warning("Unable to find slaves to remove")
|
_LOGGER.warning("Unable to find slaves to remove")
|
||||||
else:
|
else:
|
||||||
_LOGGER.info("Removing slaves from zone with master " +
|
_LOGGER.info("Removing slaves from zone with master %s",
|
||||||
str(self.device.config.name))
|
self.device.config.name)
|
||||||
self.device.remove_zone_slave([slave.device for slave in slaves])
|
self.device.remove_zone_slave([slave.device for slave in slaves])
|
||||||
|
|
||||||
def add_zone_slave(self, slaves):
|
def add_zone_slave(self, slaves):
|
||||||
|
@ -357,7 +356,6 @@ class SoundTouchDevice(MediaPlayerDevice):
|
||||||
if not slaves:
|
if not slaves:
|
||||||
_LOGGER.warning("Unable to find slaves to add")
|
_LOGGER.warning("Unable to find slaves to add")
|
||||||
else:
|
else:
|
||||||
_LOGGER.info(
|
_LOGGER.info("Adding slaves to zone with master %s",
|
||||||
"Adding slaves to zone with master " + str(
|
self.device.config.name)
|
||||||
self.device.config.name))
|
|
||||||
self.device.add_zone_slave([slave.device for slave in slaves])
|
self.device.add_zone_slave([slave.device for slave in slaves])
|
||||||
|
|
|
@ -270,7 +270,6 @@ class LgWebOSDevice(MediaPlayerDevice):
|
||||||
"""Title of current playing media."""
|
"""Title of current playing media."""
|
||||||
if (self._channel is not None) and ('channelName' in self._channel):
|
if (self._channel is not None) and ('channelName' in self._channel):
|
||||||
return self._channel['channelName']
|
return self._channel['channelName']
|
||||||
else:
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -136,7 +136,7 @@ def _load_config(filename):
|
||||||
class JSONBytesDecoder(json.JSONEncoder):
|
class JSONBytesDecoder(json.JSONEncoder):
|
||||||
"""JSONEncoder to decode bytes objects to unicode."""
|
"""JSONEncoder to decode bytes objects to unicode."""
|
||||||
|
|
||||||
# pylint: disable=method-hidden
|
# pylint: disable=method-hidden, arguments-differ
|
||||||
def default(self, obj):
|
def default(self, obj):
|
||||||
"""Decode object if it's a bytes object, else defer to base class."""
|
"""Decode object if it's a bytes object, else defer to base class."""
|
||||||
if isinstance(obj, bytes):
|
if isinstance(obj, bytes):
|
||||||
|
|
|
@ -56,4 +56,4 @@ class AutomateNotificationService(BaseNotificationService):
|
||||||
|
|
||||||
response = requests.post(_RESOURCE, json=data)
|
response = requests.post(_RESOURCE, json=data)
|
||||||
if response.status_code != 200:
|
if response.status_code != 200:
|
||||||
_LOGGER.error("Error sending message: " + str(response))
|
_LOGGER.error("Error sending message: %s", response)
|
||||||
|
|
|
@ -9,6 +9,7 @@ from datetime import datetime, timedelta
|
||||||
from collections import deque
|
from collections import deque
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
|
from homeassistant.exceptions import HomeAssistantError
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
STATE_OK, STATE_PROBLEM, STATE_UNKNOWN, TEMP_CELSIUS, ATTR_TEMPERATURE,
|
STATE_OK, STATE_PROBLEM, STATE_UNKNOWN, TEMP_CELSIUS, ATTR_TEMPERATURE,
|
||||||
CONF_SENSORS, ATTR_UNIT_OF_MEASUREMENT)
|
CONF_SENSORS, ATTR_UNIT_OF_MEASUREMENT)
|
||||||
|
@ -198,8 +199,8 @@ class Plant(Entity):
|
||||||
self._brightness_history.add_measurement(self._brightness,
|
self._brightness_history.add_measurement(self._brightness,
|
||||||
new_state.last_updated)
|
new_state.last_updated)
|
||||||
else:
|
else:
|
||||||
raise _LOGGER.error("Unknown reading from sensor %s: %s",
|
raise HomeAssistantError(
|
||||||
entity_id, value)
|
"Unknown reading from sensor {}: {}".format(entity_id, value))
|
||||||
if ATTR_UNIT_OF_MEASUREMENT in new_state.attributes:
|
if ATTR_UNIT_OF_MEASUREMENT in new_state.attributes:
|
||||||
self._unit_of_measurement[reading] = \
|
self._unit_of_measurement[reading] = \
|
||||||
new_state.attributes.get(ATTR_UNIT_OF_MEASUREMENT)
|
new_state.attributes.get(ATTR_UNIT_OF_MEASUREMENT)
|
||||||
|
|
|
@ -208,5 +208,4 @@ class TimeWrapper:
|
||||||
"""Wrap to return callable method if callable."""
|
"""Wrap to return callable method if callable."""
|
||||||
return attribute(*args, **kw)
|
return attribute(*args, **kw)
|
||||||
return wrapper
|
return wrapper
|
||||||
else:
|
|
||||||
return attribute
|
return attribute
|
||||||
|
|
|
@ -4,6 +4,7 @@ Support for controlling raspihats boards.
|
||||||
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/raspihats/
|
https://home-assistant.io/components/raspihats/
|
||||||
"""
|
"""
|
||||||
|
# pylint: disable=import-error,no-name-in-module
|
||||||
import logging
|
import logging
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
|
@ -143,7 +144,6 @@ class I2CHatsManager(threading.Thread):
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
"""Keep alive for I2C-HATs."""
|
"""Keep alive for I2C-HATs."""
|
||||||
# pylint: disable=import-error
|
|
||||||
from raspihats.i2c_hats import ResponseException
|
from raspihats.i2c_hats import ResponseException
|
||||||
|
|
||||||
_LOGGER.info(log_message(self, "starting"))
|
_LOGGER.info(log_message(self, "starting"))
|
||||||
|
@ -206,7 +206,6 @@ class I2CHatsManager(threading.Thread):
|
||||||
|
|
||||||
def read_di(self, address, channel):
|
def read_di(self, address, channel):
|
||||||
"""Read a value from a I2C-HAT digital input."""
|
"""Read a value from a I2C-HAT digital input."""
|
||||||
# pylint: disable=import-error
|
|
||||||
from raspihats.i2c_hats import ResponseException
|
from raspihats.i2c_hats import ResponseException
|
||||||
|
|
||||||
with self._lock:
|
with self._lock:
|
||||||
|
@ -219,7 +218,6 @@ class I2CHatsManager(threading.Thread):
|
||||||
|
|
||||||
def write_dq(self, address, channel, value):
|
def write_dq(self, address, channel, value):
|
||||||
"""Write a value to a I2C-HAT digital output."""
|
"""Write a value to a I2C-HAT digital output."""
|
||||||
# pylint: disable=import-error
|
|
||||||
from raspihats.i2c_hats import ResponseException
|
from raspihats.i2c_hats import ResponseException
|
||||||
|
|
||||||
with self._lock:
|
with self._lock:
|
||||||
|
@ -231,7 +229,6 @@ class I2CHatsManager(threading.Thread):
|
||||||
|
|
||||||
def read_dq(self, address, channel):
|
def read_dq(self, address, channel):
|
||||||
"""Read a value from a I2C-HAT digital output."""
|
"""Read a value from a I2C-HAT digital output."""
|
||||||
# pylint: disable=import-error
|
|
||||||
from raspihats.i2c_hats import ResponseException
|
from raspihats.i2c_hats import ResponseException
|
||||||
|
|
||||||
with self._lock:
|
with self._lock:
|
||||||
|
|
|
@ -207,6 +207,7 @@ class HarmonyRemote(remote.RemoteDevice):
|
||||||
"""Start the PowerOff activity."""
|
"""Start the PowerOff activity."""
|
||||||
self._client.power_off()
|
self._client.power_off()
|
||||||
|
|
||||||
|
# pylint: disable=arguments-differ
|
||||||
def send_command(self, commands, **kwargs):
|
def send_command(self, commands, **kwargs):
|
||||||
"""Send a list of commands to one device."""
|
"""Send a list of commands to one device."""
|
||||||
device = kwargs.get(ATTR_DEVICE)
|
device = kwargs.get(ATTR_DEVICE)
|
||||||
|
|
|
@ -210,7 +210,6 @@ class XiaomiMiioRemote(RemoteDevice):
|
||||||
"""Hide remote by default."""
|
"""Hide remote by default."""
|
||||||
if self._is_hidden:
|
if self._is_hidden:
|
||||||
return {'hidden': 'true'}
|
return {'hidden': 'true'}
|
||||||
else:
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# pylint: disable=R0201
|
# pylint: disable=R0201
|
||||||
|
|
|
@ -8,9 +8,10 @@ import asyncio
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
import functools as ft
|
import functools as ft
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import async_timeout
|
import async_timeout
|
||||||
|
|
||||||
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_ENTITY_ID, CONF_COMMAND, CONF_HOST, CONF_PORT,
|
ATTR_ENTITY_ID, CONF_COMMAND, CONF_HOST, CONF_PORT,
|
||||||
EVENT_HOMEASSISTANT_STOP, STATE_UNKNOWN)
|
EVENT_HOMEASSISTANT_STOP, STATE_UNKNOWN)
|
||||||
|
@ -19,7 +20,6 @@ from homeassistant.exceptions import HomeAssistantError
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.deprecation import get_deprecated
|
from homeassistant.helpers.deprecation import get_deprecated
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
import voluptuous as vol
|
|
||||||
|
|
||||||
|
|
||||||
REQUIREMENTS = ['rflink==0.0.34']
|
REQUIREMENTS = ['rflink==0.0.34']
|
||||||
|
|
|
@ -188,8 +188,8 @@ def find_possible_pt2262_device(device_id):
|
||||||
for dev_id, device in RFX_DEVICES.items():
|
for dev_id, device in RFX_DEVICES.items():
|
||||||
if hasattr(device, 'is_lighting4') and len(dev_id) == len(device_id):
|
if hasattr(device, 'is_lighting4') and len(dev_id) == len(device_id):
|
||||||
size = None
|
size = None
|
||||||
for i in range(0, len(dev_id)):
|
for i, (char1, char2) in enumerate(zip(dev_id, device_id)):
|
||||||
if dev_id[i] != device_id[i]:
|
if char1 != char2:
|
||||||
break
|
break
|
||||||
size = i
|
size = i
|
||||||
|
|
||||||
|
|
|
@ -5,13 +5,13 @@ For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/ring/
|
https://home-assistant.io/components/ring/
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
import voluptuous as vol
|
|
||||||
import homeassistant.helpers.config_validation as cv
|
|
||||||
|
|
||||||
from homeassistant.const import CONF_USERNAME, CONF_PASSWORD
|
|
||||||
|
|
||||||
from requests.exceptions import HTTPError, ConnectTimeout
|
from requests.exceptions import HTTPError, ConnectTimeout
|
||||||
|
|
||||||
|
import voluptuous as vol
|
||||||
|
|
||||||
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
from homeassistant.const import CONF_USERNAME, CONF_PASSWORD
|
||||||
|
|
||||||
REQUIREMENTS = ['ring_doorbell==0.1.8']
|
REQUIREMENTS = ['ring_doorbell==0.1.8']
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
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