More pylint 2 fixes (#15516)
* Pylint 2 useless-import-alias fixes * Pylint 2 chained-comparison fixes * Pylint 2 consider-using-get fixes * Pylint 2 len-as-condition fixes
This commit is contained in:
parent
058081b1f5
commit
bf17ed0917
104 changed files with 126 additions and 137 deletions
|
@ -5,7 +5,7 @@ For more details about this platform, please refer to the documentation
|
||||||
https://home-assistant.io/components/demo/
|
https://home-assistant.io/components/demo/
|
||||||
"""
|
"""
|
||||||
import datetime
|
import datetime
|
||||||
import homeassistant.components.alarm_control_panel.manual as manual
|
from homeassistant.components.alarm_control_panel import manual
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_CUSTOM_BYPASS,
|
STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_CUSTOM_BYPASS,
|
||||||
STATE_ALARM_ARMED_HOME, STATE_ALARM_ARMED_NIGHT,
|
STATE_ALARM_ARMED_HOME, STATE_ALARM_ARMED_NIGHT,
|
||||||
|
|
|
@ -19,7 +19,7 @@ from homeassistant.const import (
|
||||||
STATE_ALARM_DISARMED, STATE_ALARM_PENDING, STATE_ALARM_TRIGGERED,
|
STATE_ALARM_DISARMED, STATE_ALARM_PENDING, STATE_ALARM_TRIGGERED,
|
||||||
CONF_PLATFORM, CONF_NAME, CONF_CODE, CONF_DELAY_TIME, CONF_PENDING_TIME,
|
CONF_PLATFORM, CONF_NAME, CONF_CODE, CONF_DELAY_TIME, CONF_PENDING_TIME,
|
||||||
CONF_TRIGGER_TIME, CONF_DISARM_AFTER_TRIGGER)
|
CONF_TRIGGER_TIME, CONF_DISARM_AFTER_TRIGGER)
|
||||||
import homeassistant.components.mqtt as mqtt
|
from homeassistant.components import mqtt
|
||||||
|
|
||||||
from homeassistant.helpers.event import async_track_state_change
|
from homeassistant.helpers.event import async_track_state_change
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
|
|
|
@ -12,7 +12,7 @@ import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
import homeassistant.components.alarm_control_panel as alarm
|
import homeassistant.components.alarm_control_panel as alarm
|
||||||
import homeassistant.components.mqtt as mqtt
|
from homeassistant.components import mqtt
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME, STATE_ALARM_DISARMED,
|
STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME, STATE_ALARM_DISARMED,
|
||||||
STATE_ALARM_PENDING, STATE_ALARM_TRIGGERED, STATE_UNKNOWN,
|
STATE_ALARM_PENDING, STATE_ALARM_TRIGGERED, STATE_UNKNOWN,
|
||||||
|
|
|
@ -10,7 +10,7 @@ import json
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
import homeassistant.components.mqtt as mqtt
|
from homeassistant.components import mqtt
|
||||||
from homeassistant.const import (CONF_PLATFORM, CONF_PAYLOAD)
|
from homeassistant.const import (CONF_PLATFORM, CONF_PAYLOAD)
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ DOMAIN = 'bbb_gpio'
|
||||||
def setup(hass, config):
|
def setup(hass, config):
|
||||||
"""Set up the BeagleBone Black GPIO component."""
|
"""Set up the BeagleBone Black GPIO component."""
|
||||||
# pylint: disable=import-error
|
# pylint: disable=import-error
|
||||||
import Adafruit_BBIO.GPIO as GPIO
|
from Adafruit_BBIO import GPIO
|
||||||
|
|
||||||
def cleanup_gpio(event):
|
def cleanup_gpio(event):
|
||||||
"""Stuff to do before stopping."""
|
"""Stuff to do before stopping."""
|
||||||
|
@ -36,14 +36,14 @@ def setup(hass, config):
|
||||||
def setup_output(pin):
|
def setup_output(pin):
|
||||||
"""Set up a GPIO as output."""
|
"""Set up a GPIO as output."""
|
||||||
# pylint: disable=import-error
|
# pylint: disable=import-error
|
||||||
import Adafruit_BBIO.GPIO as GPIO
|
from Adafruit_BBIO import GPIO
|
||||||
GPIO.setup(pin, GPIO.OUT)
|
GPIO.setup(pin, GPIO.OUT)
|
||||||
|
|
||||||
|
|
||||||
def setup_input(pin, pull_mode):
|
def setup_input(pin, pull_mode):
|
||||||
"""Set up a GPIO as input."""
|
"""Set up a GPIO as input."""
|
||||||
# pylint: disable=import-error
|
# pylint: disable=import-error
|
||||||
import Adafruit_BBIO.GPIO as GPIO
|
from Adafruit_BBIO import GPIO
|
||||||
GPIO.setup(pin, GPIO.IN,
|
GPIO.setup(pin, GPIO.IN,
|
||||||
GPIO.PUD_DOWN if pull_mode == 'DOWN'
|
GPIO.PUD_DOWN if pull_mode == 'DOWN'
|
||||||
else GPIO.PUD_UP)
|
else GPIO.PUD_UP)
|
||||||
|
@ -52,20 +52,20 @@ def setup_input(pin, pull_mode):
|
||||||
def write_output(pin, value):
|
def write_output(pin, value):
|
||||||
"""Write a value to a GPIO."""
|
"""Write a value to a GPIO."""
|
||||||
# pylint: disable=import-error
|
# pylint: disable=import-error
|
||||||
import Adafruit_BBIO.GPIO as GPIO
|
from Adafruit_BBIO import GPIO
|
||||||
GPIO.output(pin, value)
|
GPIO.output(pin, value)
|
||||||
|
|
||||||
|
|
||||||
def read_input(pin):
|
def read_input(pin):
|
||||||
"""Read a value from a GPIO."""
|
"""Read a value from a GPIO."""
|
||||||
# pylint: disable=import-error
|
# pylint: disable=import-error
|
||||||
import Adafruit_BBIO.GPIO as GPIO
|
from Adafruit_BBIO import GPIO
|
||||||
return GPIO.input(pin) is GPIO.HIGH
|
return GPIO.input(pin) is GPIO.HIGH
|
||||||
|
|
||||||
|
|
||||||
def edge_detect(pin, event_callback, bounce):
|
def edge_detect(pin, event_callback, bounce):
|
||||||
"""Add detection for RISING and FALLING events."""
|
"""Add detection for RISING and FALLING events."""
|
||||||
# pylint: disable=import-error
|
# pylint: disable=import-error
|
||||||
import Adafruit_BBIO.GPIO as GPIO
|
from Adafruit_BBIO import GPIO
|
||||||
GPIO.add_event_detect(
|
GPIO.add_event_detect(
|
||||||
pin, GPIO.BOTH, callback=event_callback, bouncetime=bounce)
|
pin, GPIO.BOTH, callback=event_callback, bouncetime=bounce)
|
||||||
|
|
|
@ -8,7 +8,7 @@ import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
import homeassistant.components.bbb_gpio as bbb_gpio
|
from homeassistant.components import bbb_gpio
|
||||||
from homeassistant.components.binary_sensor import (
|
from homeassistant.components.binary_sensor import (
|
||||||
BinarySensorDevice, PLATFORM_SCHEMA)
|
BinarySensorDevice, PLATFORM_SCHEMA)
|
||||||
from homeassistant.const import (DEVICE_DEFAULT_NAME, CONF_NAME)
|
from homeassistant.const import (DEVICE_DEFAULT_NAME, CONF_NAME)
|
||||||
|
|
|
@ -7,7 +7,7 @@ https://home-assistant.io/components/binary_sensor.modbus/
|
||||||
import logging
|
import logging
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
import homeassistant.components.modbus as modbus
|
from homeassistant.components import modbus
|
||||||
from homeassistant.const import CONF_NAME, CONF_SLAVE
|
from homeassistant.const import CONF_NAME, CONF_SLAVE
|
||||||
from homeassistant.components.binary_sensor import BinarySensorDevice
|
from homeassistant.components.binary_sensor import BinarySensorDevice
|
||||||
from homeassistant.helpers import config_validation as cv
|
from homeassistant.helpers import config_validation as cv
|
||||||
|
|
|
@ -11,7 +11,7 @@ from typing import Optional
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
import homeassistant.components.mqtt as mqtt
|
from homeassistant.components import mqtt
|
||||||
from homeassistant.components.binary_sensor import (
|
from homeassistant.components.binary_sensor import (
|
||||||
BinarySensorDevice, DEVICE_CLASSES_SCHEMA)
|
BinarySensorDevice, DEVICE_CLASSES_SCHEMA)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
|
|
|
@ -8,7 +8,7 @@ import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
import homeassistant.components.rpi_gpio as rpi_gpio
|
from homeassistant.components import rpi_gpio
|
||||||
from homeassistant.components.binary_sensor import (
|
from homeassistant.components.binary_sensor import (
|
||||||
BinarySensorDevice, PLATFORM_SCHEMA)
|
BinarySensorDevice, PLATFORM_SCHEMA)
|
||||||
from homeassistant.const import DEVICE_DEFAULT_NAME
|
from homeassistant.const import DEVICE_DEFAULT_NAME
|
||||||
|
|
|
@ -10,7 +10,7 @@ import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import (
|
from homeassistant.components.binary_sensor import (
|
||||||
PLATFORM_SCHEMA, BinarySensorDevice)
|
PLATFORM_SCHEMA, BinarySensorDevice)
|
||||||
import homeassistant.components.rpi_pfio as rpi_pfio
|
from homeassistant.components import rpi_pfio
|
||||||
from homeassistant.const import CONF_NAME, DEVICE_DEFAULT_NAME
|
from homeassistant.const import CONF_NAME, DEVICE_DEFAULT_NAME
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ _LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices_callback, discovery_info=None):
|
def setup_platform(hass, config, add_devices_callback, discovery_info=None):
|
||||||
"""Register discovered WeMo binary sensors."""
|
"""Register discovered WeMo binary sensors."""
|
||||||
import pywemo.discovery as discovery
|
from pywemo import discovery
|
||||||
|
|
||||||
if discovery_info is not None:
|
if discovery_info is not None:
|
||||||
location = discovery_info['ssdp_description']
|
location = discovery_info['ssdp_description']
|
||||||
|
|
|
@ -130,7 +130,7 @@ class CalendarEventDevice(Entity):
|
||||||
|
|
||||||
now = dt.now()
|
now = dt.now()
|
||||||
|
|
||||||
if start <= now and end > now:
|
if start <= now < end:
|
||||||
return STATE_ON
|
return STATE_ON
|
||||||
|
|
||||||
if now >= end:
|
if now >= end:
|
||||||
|
|
|
@ -503,7 +503,7 @@ class TodoistProjectData(object):
|
||||||
time_format = '%a %d %b %Y %H:%M:%S %z'
|
time_format = '%a %d %b %Y %H:%M:%S %z'
|
||||||
for task in project_task_data:
|
for task in project_task_data:
|
||||||
due_date = datetime.strptime(task['due_date_utc'], time_format)
|
due_date = datetime.strptime(task['due_date_utc'], time_format)
|
||||||
if due_date > start_date and due_date < end_date:
|
if start_date < due_date < end_date:
|
||||||
event = {
|
event = {
|
||||||
'uid': task['id'],
|
'uid': task['id'],
|
||||||
'title': task['content'],
|
'title': task['content'],
|
||||||
|
|
|
@ -11,7 +11,7 @@ import logging
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
import homeassistant.components.mqtt as mqtt
|
from homeassistant.components import mqtt
|
||||||
from homeassistant.const import CONF_NAME
|
from homeassistant.const import CONF_NAME
|
||||||
from homeassistant.components.camera import Camera, PLATFORM_SCHEMA
|
from homeassistant.components.camera import Camera, PLATFORM_SCHEMA
|
||||||
from homeassistant.helpers import config_validation as cv
|
from homeassistant.helpers import config_validation as cv
|
||||||
|
|
|
@ -9,7 +9,7 @@ from datetime import timedelta
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
import homeassistant.components.nest as nest
|
from homeassistant.components import nest
|
||||||
from homeassistant.components.camera import (PLATFORM_SCHEMA, Camera)
|
from homeassistant.components.camera import (PLATFORM_SCHEMA, Camera)
|
||||||
from homeassistant.util.dt import utcnow
|
from homeassistant.util.dt import utcnow
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ from homeassistant.const import CONF_NAME
|
||||||
from homeassistant.components.camera.mjpeg import (
|
from homeassistant.components.camera.mjpeg import (
|
||||||
CONF_MJPEG_URL, CONF_STILL_IMAGE_URL, MjpegCamera)
|
CONF_MJPEG_URL, CONF_STILL_IMAGE_URL, MjpegCamera)
|
||||||
|
|
||||||
import homeassistant.components.zoneminder as zoneminder
|
from homeassistant.components import zoneminder
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ from homeassistant.const import (
|
||||||
from homeassistant.components.climate import (
|
from homeassistant.components.climate import (
|
||||||
ClimateDevice, PLATFORM_SCHEMA, SUPPORT_TARGET_TEMPERATURE,
|
ClimateDevice, PLATFORM_SCHEMA, SUPPORT_TARGET_TEMPERATURE,
|
||||||
SUPPORT_FAN_MODE)
|
SUPPORT_FAN_MODE)
|
||||||
import homeassistant.components.modbus as modbus
|
from homeassistant.components import modbus
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
REQUIREMENTS = ['pyflexit==0.3']
|
REQUIREMENTS = ['pyflexit==0.3']
|
||||||
|
|
|
@ -18,7 +18,7 @@ from homeassistant.const import (
|
||||||
from homeassistant.components.climate import (
|
from homeassistant.components.climate import (
|
||||||
ClimateDevice, PLATFORM_SCHEMA, SUPPORT_TARGET_TEMPERATURE)
|
ClimateDevice, PLATFORM_SCHEMA, SUPPORT_TARGET_TEMPERATURE)
|
||||||
|
|
||||||
import homeassistant.components.modbus as modbus
|
from homeassistant.components import modbus
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
DEPENDENCIES = ['modbus']
|
DEPENDENCIES = ['modbus']
|
||||||
|
|
|
@ -10,7 +10,7 @@ import logging
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
import homeassistant.components.mqtt as mqtt
|
from homeassistant.components import mqtt
|
||||||
|
|
||||||
from homeassistant.components.climate import (
|
from homeassistant.components.climate import (
|
||||||
STATE_HEAT, STATE_COOL, STATE_DRY, STATE_FAN_ONLY, ClimateDevice,
|
STATE_HEAT, STATE_COOL, STATE_DRY, STATE_FAN_ONLY, ClimateDevice,
|
||||||
|
|
|
@ -9,7 +9,7 @@ import logging
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
import homeassistant.components.mqtt as mqtt
|
from homeassistant.components import mqtt
|
||||||
from homeassistant.components.cover import (
|
from homeassistant.components.cover import (
|
||||||
CoverDevice, ATTR_TILT_POSITION, SUPPORT_OPEN_TILT,
|
CoverDevice, ATTR_TILT_POSITION, SUPPORT_OPEN_TILT,
|
||||||
SUPPORT_CLOSE_TILT, SUPPORT_STOP_TILT, SUPPORT_SET_TILT_POSITION,
|
SUPPORT_CLOSE_TILT, SUPPORT_STOP_TILT, SUPPORT_SET_TILT_POSITION,
|
||||||
|
|
|
@ -6,7 +6,7 @@ https://home-assistant.io/components/cover.rfxtrx/
|
||||||
"""
|
"""
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
import homeassistant.components.rfxtrx as rfxtrx
|
from homeassistant.components import rfxtrx
|
||||||
from homeassistant.components.cover import CoverDevice, PLATFORM_SCHEMA
|
from homeassistant.components.cover import CoverDevice, PLATFORM_SCHEMA
|
||||||
from homeassistant.const import CONF_NAME
|
from homeassistant.const import CONF_NAME
|
||||||
from homeassistant.components.rfxtrx import (
|
from homeassistant.components.rfxtrx import (
|
||||||
|
|
|
@ -14,7 +14,7 @@ import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.cover import CoverDevice, PLATFORM_SCHEMA
|
from homeassistant.components.cover import CoverDevice, PLATFORM_SCHEMA
|
||||||
from homeassistant.const import CONF_NAME
|
from homeassistant.const import CONF_NAME
|
||||||
import homeassistant.components.rpi_gpio as rpi_gpio
|
from homeassistant.components import rpi_gpio
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
|
@ -8,7 +8,7 @@ import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
import homeassistant.components.scsgate as scsgate
|
from homeassistant.components import scsgate
|
||||||
from homeassistant.components.cover import (CoverDevice, PLATFORM_SCHEMA)
|
from homeassistant.components.cover import (CoverDevice, PLATFORM_SCHEMA)
|
||||||
from homeassistant.const import (CONF_DEVICES, CONF_NAME)
|
from homeassistant.const import (CONF_DEVICES, CONF_NAME)
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
|
@ -7,7 +7,7 @@ https://home-assistant.io/components/demo/
|
||||||
import asyncio
|
import asyncio
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import homeassistant.bootstrap as bootstrap
|
from homeassistant import bootstrap
|
||||||
import homeassistant.core as ha
|
import homeassistant.core as ha
|
||||||
from homeassistant.const import ATTR_ENTITY_ID, CONF_PLATFORM
|
from homeassistant.const import ATTR_ENTITY_ID, CONF_PLATFORM
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ from homeassistant.helpers.event import async_track_time_interval
|
||||||
from homeassistant.helpers.restore_state import async_get_last_state
|
from homeassistant.helpers.restore_state import async_get_last_state
|
||||||
from homeassistant.helpers.typing import GPSType, ConfigType, HomeAssistantType
|
from homeassistant.helpers.typing import GPSType, ConfigType, HomeAssistantType
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
import homeassistant.util as util
|
from homeassistant import util
|
||||||
from homeassistant.util.async_ import run_coroutine_threadsafe
|
from homeassistant.util.async_ import run_coroutine_threadsafe
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
from homeassistant.util.yaml import dump
|
from homeassistant.util.yaml import dump
|
||||||
|
|
|
@ -9,7 +9,7 @@ import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
import homeassistant.components.mqtt as mqtt
|
from homeassistant.components import mqtt
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.const import CONF_DEVICES
|
from homeassistant.const import CONF_DEVICES
|
||||||
from homeassistant.components.mqtt import CONF_QOS
|
from homeassistant.components.mqtt import CONF_QOS
|
||||||
|
|
|
@ -10,7 +10,7 @@ import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
import homeassistant.components.mqtt as mqtt
|
from homeassistant.components import mqtt
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.components.mqtt import CONF_QOS
|
from homeassistant.components.mqtt import CONF_QOS
|
||||||
from homeassistant.components.device_tracker import PLATFORM_SCHEMA
|
from homeassistant.components.device_tracker import PLATFORM_SCHEMA
|
||||||
|
|
|
@ -12,7 +12,7 @@ from collections import defaultdict
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
import homeassistant.components.mqtt as mqtt
|
from homeassistant.components import mqtt
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.components import zone as zone_comp
|
from homeassistant.components import zone as zone_comp
|
||||||
from homeassistant.components.device_tracker import (
|
from homeassistant.components.device_tracker import (
|
||||||
|
|
|
@ -237,11 +237,11 @@ class HueOneLightChangeView(HomeAssistantView):
|
||||||
# Convert 0-100 to a fan speed
|
# Convert 0-100 to a fan speed
|
||||||
if brightness == 0:
|
if brightness == 0:
|
||||||
data[ATTR_SPEED] = SPEED_OFF
|
data[ATTR_SPEED] = SPEED_OFF
|
||||||
elif brightness <= 33.3 and brightness > 0:
|
elif 0 < brightness <= 33.3:
|
||||||
data[ATTR_SPEED] = SPEED_LOW
|
data[ATTR_SPEED] = SPEED_LOW
|
||||||
elif brightness <= 66.6 and brightness > 33.3:
|
elif 33.3 < brightness <= 66.6:
|
||||||
data[ATTR_SPEED] = SPEED_MEDIUM
|
data[ATTR_SPEED] = SPEED_MEDIUM
|
||||||
elif brightness <= 100 and brightness > 66.6:
|
elif 66.6 < brightness <= 100:
|
||||||
data[ATTR_SPEED] = SPEED_HIGH
|
data[ATTR_SPEED] = SPEED_HIGH
|
||||||
|
|
||||||
if entity.domain in config.off_maps_to_on_domains:
|
if entity.domain in config.off_maps_to_on_domains:
|
||||||
|
|
|
@ -11,7 +11,7 @@ from homeassistant.components.fan import (
|
||||||
ATTR_SPEED, SPEED_OFF, SPEED_LOW, SPEED_MEDIUM, SPEED_HIGH,
|
ATTR_SPEED, SPEED_OFF, SPEED_LOW, SPEED_MEDIUM, SPEED_HIGH,
|
||||||
SUPPORT_SET_SPEED, FanEntity)
|
SUPPORT_SET_SPEED, FanEntity)
|
||||||
from homeassistant.helpers.entity import ToggleEntity
|
from homeassistant.helpers.entity import ToggleEntity
|
||||||
import homeassistant.util as util
|
from homeassistant import util
|
||||||
|
|
||||||
_CONFIGURING = {}
|
_CONFIGURING = {}
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
@ -94,10 +94,7 @@ class InsteonLocalFanDevice(FanEntity):
|
||||||
def turn_on(self: ToggleEntity, speed: str = None, **kwargs) -> None:
|
def turn_on(self: ToggleEntity, speed: str = None, **kwargs) -> None:
|
||||||
"""Turn device on."""
|
"""Turn device on."""
|
||||||
if speed is None:
|
if speed is None:
|
||||||
if ATTR_SPEED in kwargs:
|
speed = kwargs.get(ATTR_SPEED, SPEED_MEDIUM)
|
||||||
speed = kwargs[ATTR_SPEED]
|
|
||||||
else:
|
|
||||||
speed = SPEED_MEDIUM
|
|
||||||
|
|
||||||
self.set_speed(speed)
|
self.set_speed(speed)
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ import logging
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
import homeassistant.components.mqtt as mqtt
|
from homeassistant.components import mqtt
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_NAME, CONF_OPTIMISTIC, CONF_STATE, STATE_ON, STATE_OFF,
|
CONF_NAME, CONF_OPTIMISTIC, CONF_STATE, STATE_ON, STATE_OFF,
|
||||||
CONF_PAYLOAD_OFF, CONF_PAYLOAD_ON)
|
CONF_PAYLOAD_OFF, CONF_PAYLOAD_ON)
|
||||||
|
|
|
@ -9,7 +9,7 @@ from zlib import adler32
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
import homeassistant.components.cover as cover
|
from homeassistant.components import cover
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_DEVICE_CLASS, ATTR_SUPPORTED_FEATURES, ATTR_UNIT_OF_MEASUREMENT,
|
ATTR_DEVICE_CLASS, ATTR_SUPPORTED_FEATURES, ATTR_UNIT_OF_MEASUREMENT,
|
||||||
CONF_IP_ADDRESS, CONF_NAME, CONF_PORT, CONF_TYPE, DEVICE_CLASS_HUMIDITY,
|
CONF_IP_ADDRESS, CONF_NAME, CONF_PORT, CONF_TYPE, DEVICE_CLASS_HUMIDITY,
|
||||||
|
|
|
@ -3,7 +3,7 @@ import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
import homeassistant.components.media_player as media_player
|
from homeassistant.components import media_player
|
||||||
from homeassistant.core import split_entity_id
|
from homeassistant.core import split_entity_id
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_CODE, ATTR_SUPPORTED_FEATURES, CONF_NAME, CONF_TYPE, TEMP_CELSIUS)
|
ATTR_CODE, ATTR_SUPPORTED_FEATURES, CONF_NAME, CONF_TYPE, TEMP_CELSIUS)
|
||||||
|
|
|
@ -63,7 +63,7 @@ def setup(hass, config):
|
||||||
value3 = call.data.get(ATTR_VALUE3)
|
value3 = call.data.get(ATTR_VALUE3)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import pyfttt as pyfttt
|
import pyfttt
|
||||||
pyfttt.send_event(key, event, value1, value2, value3)
|
pyfttt.send_event(key, event, value1, value2, value3)
|
||||||
except requests.exceptions.RequestException:
|
except requests.exceptions.RequestException:
|
||||||
_LOGGER.exception("Error communicating with IFTTT")
|
_LOGGER.exception("Error communicating with IFTTT")
|
||||||
|
|
|
@ -103,7 +103,7 @@ class MicrosoftFaceDetectEntity(ImageProcessingFaceEntity):
|
||||||
_LOGGER.error("Can't process image on microsoft face: %s", err)
|
_LOGGER.error("Can't process image on microsoft face: %s", err)
|
||||||
return
|
return
|
||||||
|
|
||||||
if face_data is None or len(face_data) < 1:
|
if not face_data:
|
||||||
return
|
return
|
||||||
|
|
||||||
faces = []
|
faces = []
|
||||||
|
|
|
@ -90,7 +90,7 @@ class MicrosoftFaceIdentifyEntity(ImageProcessingFaceEntity):
|
||||||
face_data = yield from self._api.call_api(
|
face_data = yield from self._api.call_api(
|
||||||
'post', 'detect', image, binary=True)
|
'post', 'detect', image, binary=True)
|
||||||
|
|
||||||
if face_data is None or len(face_data) < 1:
|
if not face_data:
|
||||||
return
|
return
|
||||||
|
|
||||||
face_ids = [data['faceId'] for data in face_data]
|
face_ids = [data['faceId'] for data in face_data]
|
||||||
|
|
|
@ -11,7 +11,7 @@ import random
|
||||||
|
|
||||||
import async_timeout
|
import async_timeout
|
||||||
|
|
||||||
import homeassistant.components.hue as hue
|
from homeassistant.components import hue
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_EFFECT, ATTR_FLASH,
|
ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_EFFECT, ATTR_FLASH,
|
||||||
ATTR_TRANSITION, ATTR_HS_COLOR, EFFECT_COLORLOOP, EFFECT_RANDOM,
|
ATTR_TRANSITION, ATTR_HS_COLOR, EFFECT_COLORLOOP, EFFECT_RANDOM,
|
||||||
|
|
|
@ -146,10 +146,7 @@ class Hyperion(Light):
|
||||||
else:
|
else:
|
||||||
rgb_color = self._rgb_mem
|
rgb_color = self._rgb_mem
|
||||||
|
|
||||||
if ATTR_BRIGHTNESS in kwargs:
|
brightness = kwargs.get(ATTR_BRIGHTNESS, self._brightness)
|
||||||
brightness = kwargs[ATTR_BRIGHTNESS]
|
|
||||||
else:
|
|
||||||
brightness = self._brightness
|
|
||||||
|
|
||||||
if ATTR_EFFECT in kwargs:
|
if ATTR_EFFECT in kwargs:
|
||||||
self._skip_update = True
|
self._skip_update = True
|
||||||
|
|
|
@ -9,7 +9,7 @@ from datetime import timedelta
|
||||||
|
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
ATTR_BRIGHTNESS, SUPPORT_BRIGHTNESS, Light)
|
ATTR_BRIGHTNESS, SUPPORT_BRIGHTNESS, Light)
|
||||||
import homeassistant.util as util
|
from homeassistant import util
|
||||||
|
|
||||||
_CONFIGURING = {}
|
_CONFIGURING = {}
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
|
@ -6,7 +6,7 @@ https://home-assistant.io/components/light.litejet/
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import homeassistant.components.litejet as litejet
|
from homeassistant.components import litejet
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
ATTR_BRIGHTNESS, SUPPORT_BRIGHTNESS, Light)
|
ATTR_BRIGHTNESS, SUPPORT_BRIGHTNESS, Light)
|
||||||
|
|
||||||
|
|
|
@ -48,10 +48,7 @@ class LutronCasetaLight(LutronCasetaDevice, Light):
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_turn_on(self, **kwargs):
|
def async_turn_on(self, **kwargs):
|
||||||
"""Turn the light on."""
|
"""Turn the light on."""
|
||||||
if ATTR_BRIGHTNESS in kwargs:
|
brightness = kwargs.get(ATTR_BRIGHTNESS, 255)
|
||||||
brightness = kwargs[ATTR_BRIGHTNESS]
|
|
||||||
else:
|
|
||||||
brightness = 255
|
|
||||||
self._smartbridge.set_value(self._device_id,
|
self._smartbridge.set_value(self._device_id,
|
||||||
to_lutron_level(brightness))
|
to_lutron_level(brightness))
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ import logging
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
import homeassistant.components.mqtt as mqtt
|
from homeassistant.components import mqtt
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_EFFECT, ATTR_HS_COLOR,
|
ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_EFFECT, ATTR_HS_COLOR,
|
||||||
ATTR_WHITE_VALUE, Light, SUPPORT_BRIGHTNESS, SUPPORT_COLOR_TEMP,
|
ATTR_WHITE_VALUE, Light, SUPPORT_BRIGHTNESS, SUPPORT_COLOR_TEMP,
|
||||||
|
|
|
@ -9,7 +9,7 @@ import json
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
import homeassistant.components.mqtt as mqtt
|
from homeassistant.components import mqtt
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_EFFECT, ATTR_FLASH,
|
ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_EFFECT, ATTR_FLASH,
|
||||||
ATTR_TRANSITION, ATTR_WHITE_VALUE, ATTR_HS_COLOR,
|
ATTR_TRANSITION, ATTR_WHITE_VALUE, ATTR_HS_COLOR,
|
||||||
|
|
|
@ -8,7 +8,7 @@ import logging
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
import homeassistant.components.mqtt as mqtt
|
from homeassistant.components import mqtt
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_EFFECT, ATTR_FLASH,
|
ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_EFFECT, ATTR_FLASH,
|
||||||
ATTR_HS_COLOR, ATTR_TRANSITION, ATTR_WHITE_VALUE, Light, PLATFORM_SCHEMA,
|
ATTR_HS_COLOR, ATTR_TRANSITION, ATTR_WHITE_VALUE, Light, PLATFORM_SCHEMA,
|
||||||
|
|
|
@ -8,7 +8,7 @@ import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
import homeassistant.components.rfxtrx as rfxtrx
|
from homeassistant.components import rfxtrx
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
ATTR_BRIGHTNESS, SUPPORT_BRIGHTNESS, Light, PLATFORM_SCHEMA)
|
ATTR_BRIGHTNESS, SUPPORT_BRIGHTNESS, Light, PLATFORM_SCHEMA)
|
||||||
from homeassistant.const import CONF_NAME
|
from homeassistant.const import CONF_NAME
|
||||||
|
|
|
@ -8,7 +8,7 @@ import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
import homeassistant.components.scsgate as scsgate
|
from homeassistant.components import scsgate
|
||||||
from homeassistant.components.light import (Light, PLATFORM_SCHEMA)
|
from homeassistant.components.light import (Light, PLATFORM_SCHEMA)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_ENTITY_ID, ATTR_STATE, CONF_DEVICES, CONF_NAME)
|
ATTR_ENTITY_ID, ATTR_STATE, CONF_DEVICES, CONF_NAME)
|
||||||
|
|
|
@ -8,7 +8,7 @@ import asyncio
|
||||||
import logging
|
import logging
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
import homeassistant.util as util
|
from homeassistant import util
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
Light, ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_HS_COLOR, ATTR_TRANSITION,
|
Light, ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_HS_COLOR, ATTR_TRANSITION,
|
||||||
SUPPORT_BRIGHTNESS, SUPPORT_COLOR_TEMP, SUPPORT_COLOR, SUPPORT_TRANSITION)
|
SUPPORT_BRIGHTNESS, SUPPORT_COLOR_TEMP, SUPPORT_COLOR, SUPPORT_TRANSITION)
|
||||||
|
@ -27,7 +27,7 @@ SUPPORT_WEMO = (SUPPORT_BRIGHTNESS | SUPPORT_COLOR_TEMP | SUPPORT_COLOR |
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
"""Set up discovered WeMo switches."""
|
"""Set up discovered WeMo switches."""
|
||||||
import pywemo.discovery as discovery
|
from pywemo import discovery
|
||||||
|
|
||||||
if discovery_info is not None:
|
if discovery_info is not None:
|
||||||
location = discovery_info['ssdp_description']
|
location = discovery_info['ssdp_description']
|
||||||
|
|
|
@ -17,7 +17,7 @@ from homeassistant.components.mqtt import (
|
||||||
MqttAvailability)
|
MqttAvailability)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_NAME, CONF_OPTIMISTIC, CONF_VALUE_TEMPLATE)
|
CONF_NAME, CONF_OPTIMISTIC, CONF_VALUE_TEMPLATE)
|
||||||
import homeassistant.components.mqtt as mqtt
|
from homeassistant.components import mqtt
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
|
@ -9,7 +9,7 @@ import logging
|
||||||
import os
|
import os
|
||||||
from hashlib import sha1
|
from hashlib import sha1
|
||||||
|
|
||||||
import homeassistant.util.dt as dt
|
from homeassistant.util import dt
|
||||||
|
|
||||||
from homeassistant.components.mailbox import (Mailbox, CONTENT_TYPE_MPEG,
|
from homeassistant.components.mailbox import (Mailbox, CONTENT_TYPE_MPEG,
|
||||||
StreamError)
|
StreamError)
|
||||||
|
|
|
@ -333,10 +333,10 @@ class BluesoundPlayer(MediaPlayerDevice):
|
||||||
|
|
||||||
if response.status == 200:
|
if response.status == 200:
|
||||||
result = await response.text()
|
result = await response.text()
|
||||||
if len(result) < 1:
|
if result:
|
||||||
data = None
|
|
||||||
else:
|
|
||||||
data = xmltodict.parse(result)
|
data = xmltodict.parse(result)
|
||||||
|
else:
|
||||||
|
data = None
|
||||||
elif response.status == 595:
|
elif response.status == 595:
|
||||||
_LOGGER.info("Status 595 returned, treating as timeout")
|
_LOGGER.info("Status 595 returned, treating as timeout")
|
||||||
raise BluesoundPlayer._TimeoutException()
|
raise BluesoundPlayer._TimeoutException()
|
||||||
|
@ -640,7 +640,7 @@ class BluesoundPlayer(MediaPlayerDevice):
|
||||||
volume = self.volume_level
|
volume = self.volume_level
|
||||||
if not volume:
|
if not volume:
|
||||||
return None
|
return None
|
||||||
return volume < 0.001 and volume >= 0
|
return 0 <= volume < 0.001
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
|
@ -847,12 +847,12 @@ class BluesoundPlayer(MediaPlayerDevice):
|
||||||
|
|
||||||
items = [x for x in self._preset_items if x['title'] == source]
|
items = [x for x in self._preset_items if x['title'] == source]
|
||||||
|
|
||||||
if len(items) < 1:
|
if not items:
|
||||||
items = [x for x in self._services_items if x['title'] == source]
|
items = [x for x in self._services_items if x['title'] == source]
|
||||||
if len(items) < 1:
|
if not items:
|
||||||
items = [x for x in self._capture_items if x['title'] == source]
|
items = [x for x in self._capture_items if x['title'] == source]
|
||||||
|
|
||||||
if len(items) < 1:
|
if not items:
|
||||||
return
|
return
|
||||||
|
|
||||||
selected_source = items[0]
|
selected_source = items[0]
|
||||||
|
|
|
@ -18,7 +18,7 @@ from homeassistant.const import (CONF_HOST, CONF_NAME, CONF_PORT, STATE_OFF,
|
||||||
STATE_PAUSED, STATE_PLAYING)
|
STATE_PAUSED, STATE_PLAYING)
|
||||||
from homeassistant.exceptions import PlatformNotReady
|
from homeassistant.exceptions import PlatformNotReady
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
import homeassistant.util as util
|
from homeassistant import util
|
||||||
|
|
||||||
REQUIREMENTS = ['einder==0.3.1']
|
REQUIREMENTS = ['einder==0.3.1']
|
||||||
|
|
||||||
|
|
|
@ -759,7 +759,7 @@ class KodiDevice(MediaPlayerDevice):
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_set_shuffle(self, shuffle):
|
def async_set_shuffle(self, shuffle):
|
||||||
"""Set shuffle mode, for the first player."""
|
"""Set shuffle mode, for the first player."""
|
||||||
if len(self._players) < 1:
|
if not self._players:
|
||||||
raise RuntimeError("Error: No active player.")
|
raise RuntimeError("Error: No active player.")
|
||||||
yield from self.server.Player.SetShuffle(
|
yield from self.server.Player.SetShuffle(
|
||||||
{"playerid": self._players[0]['playerid'], "shuffle": shuffle})
|
{"playerid": self._players[0]['playerid'], "shuffle": shuffle})
|
||||||
|
|
|
@ -18,7 +18,7 @@ from homeassistant.components.media_player import (
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_HOST, CONF_NAME, CONF_ACCESS_TOKEN,
|
CONF_HOST, CONF_NAME, CONF_ACCESS_TOKEN,
|
||||||
STATE_OFF, STATE_PLAYING, STATE_PAUSED, STATE_UNKNOWN)
|
STATE_OFF, STATE_PLAYING, STATE_PAUSED, STATE_UNKNOWN)
|
||||||
import homeassistant.util as util
|
from homeassistant import util
|
||||||
|
|
||||||
REQUIREMENTS = ['pylgnetcast-homeassistant==0.2.0.dev0']
|
REQUIREMENTS = ['pylgnetcast-homeassistant==0.2.0.dev0']
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ from homeassistant.const import (
|
||||||
CONF_ACCESS_TOKEN, CONF_HOST, CONF_NAME, STATE_OFF, STATE_ON,
|
CONF_ACCESS_TOKEN, CONF_HOST, CONF_NAME, STATE_OFF, STATE_ON,
|
||||||
STATE_UNKNOWN)
|
STATE_UNKNOWN)
|
||||||
from homeassistant.helpers import config_validation as cv
|
from homeassistant.helpers import config_validation as cv
|
||||||
import homeassistant.util as util
|
from homeassistant import util
|
||||||
|
|
||||||
REQUIREMENTS = ['pyvizio==0.0.3']
|
REQUIREMENTS = ['pyvizio==0.0.3']
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ from homeassistant.const import (
|
||||||
STATE_OFF, STATE_PAUSED, STATE_PLAYING, STATE_UNKNOWN)
|
STATE_OFF, STATE_PAUSED, STATE_PLAYING, STATE_UNKNOWN)
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.script import Script
|
from homeassistant.helpers.script import Script
|
||||||
import homeassistant.util as util
|
from homeassistant import util
|
||||||
|
|
||||||
REQUIREMENTS = ['pylgtv==0.1.7', 'websockets==3.2']
|
REQUIREMENTS = ['pylgtv==0.1.7', 'websockets==3.2']
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import json
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
|
|
||||||
import homeassistant.components.mqtt as mqtt
|
from homeassistant.components import mqtt
|
||||||
from homeassistant.helpers.discovery import async_load_platform
|
from homeassistant.helpers.discovery import async_load_platform
|
||||||
from homeassistant.const import CONF_PLATFORM
|
from homeassistant.const import CONF_PLATFORM
|
||||||
from homeassistant.components.mqtt import CONF_STATE_TOPIC
|
from homeassistant.components.mqtt import CONF_STATE_TOPIC
|
||||||
|
|
|
@ -80,7 +80,7 @@ async def setup_gateways(hass, config):
|
||||||
|
|
||||||
async def _get_gateway(hass, config, gateway_conf, persistence_file):
|
async def _get_gateway(hass, config, gateway_conf, persistence_file):
|
||||||
"""Return gateway after setup of the gateway."""
|
"""Return gateway after setup of the gateway."""
|
||||||
import mysensors.mysensors as mysensors
|
from mysensors import mysensors
|
||||||
|
|
||||||
conf = config[DOMAIN]
|
conf = config[DOMAIN]
|
||||||
persistence = conf[CONF_PERSISTENCE]
|
persistence = conf[CONF_PERSISTENCE]
|
||||||
|
|
|
@ -10,7 +10,7 @@ import time
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
import homeassistant.components.remote as remote
|
from homeassistant.components import remote
|
||||||
from homeassistant.components.remote import (
|
from homeassistant.components.remote import (
|
||||||
ATTR_ACTIVITY, ATTR_DELAY_SECS, ATTR_DEVICE, ATTR_NUM_REPEATS,
|
ATTR_ACTIVITY, ATTR_DELAY_SECS, ATTR_DEVICE, ATTR_NUM_REPEATS,
|
||||||
DEFAULT_DELAY_SECS, DOMAIN, PLATFORM_SCHEMA)
|
DEFAULT_DELAY_SECS, DOMAIN, PLATFORM_SCHEMA)
|
||||||
|
|
|
@ -10,7 +10,7 @@ import logging
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
import homeassistant.components.remote as remote
|
from homeassistant.components import remote
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
DEVICE_DEFAULT_NAME, CONF_NAME, CONF_MAC, CONF_HOST, CONF_PORT,
|
DEVICE_DEFAULT_NAME, CONF_NAME, CONF_MAC, CONF_HOST, CONF_PORT,
|
||||||
CONF_DEVICES)
|
CONF_DEVICES)
|
||||||
|
|
|
@ -7,7 +7,7 @@ https://home-assistant.io/components/remote.kira/
|
||||||
import functools as ft
|
import functools as ft
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import homeassistant.components.remote as remote
|
from homeassistant.components import remote
|
||||||
from homeassistant.const import CONF_DEVICE, CONF_NAME
|
from homeassistant.const import CONF_DEVICE, CONF_NAME
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ DOMAIN = 'rpi_gpio'
|
||||||
|
|
||||||
def setup(hass, config):
|
def setup(hass, config):
|
||||||
"""Set up the Raspberry PI GPIO component."""
|
"""Set up the Raspberry PI GPIO component."""
|
||||||
import RPi.GPIO as GPIO
|
from RPi import GPIO
|
||||||
|
|
||||||
def cleanup_gpio(event):
|
def cleanup_gpio(event):
|
||||||
"""Stuff to do before stopping."""
|
"""Stuff to do before stopping."""
|
||||||
|
@ -36,32 +36,32 @@ def setup(hass, config):
|
||||||
|
|
||||||
def setup_output(port):
|
def setup_output(port):
|
||||||
"""Set up a GPIO as output."""
|
"""Set up a GPIO as output."""
|
||||||
import RPi.GPIO as GPIO
|
from RPi import GPIO
|
||||||
GPIO.setup(port, GPIO.OUT)
|
GPIO.setup(port, GPIO.OUT)
|
||||||
|
|
||||||
|
|
||||||
def setup_input(port, pull_mode):
|
def setup_input(port, pull_mode):
|
||||||
"""Set up a GPIO as input."""
|
"""Set up a GPIO as input."""
|
||||||
import RPi.GPIO as GPIO
|
from RPi import GPIO
|
||||||
GPIO.setup(port, GPIO.IN,
|
GPIO.setup(port, GPIO.IN,
|
||||||
GPIO.PUD_DOWN if pull_mode == 'DOWN' else GPIO.PUD_UP)
|
GPIO.PUD_DOWN if pull_mode == 'DOWN' else GPIO.PUD_UP)
|
||||||
|
|
||||||
|
|
||||||
def write_output(port, value):
|
def write_output(port, value):
|
||||||
"""Write a value to a GPIO."""
|
"""Write a value to a GPIO."""
|
||||||
import RPi.GPIO as GPIO
|
from RPi import GPIO
|
||||||
GPIO.output(port, value)
|
GPIO.output(port, value)
|
||||||
|
|
||||||
|
|
||||||
def read_input(port):
|
def read_input(port):
|
||||||
"""Read a value from a GPIO."""
|
"""Read a value from a GPIO."""
|
||||||
import RPi.GPIO as GPIO
|
from RPi import GPIO
|
||||||
return GPIO.input(port)
|
return GPIO.input(port)
|
||||||
|
|
||||||
|
|
||||||
def edge_detect(port, event_callback, bounce):
|
def edge_detect(port, event_callback, bounce):
|
||||||
"""Add detection for RISING and FALLING events."""
|
"""Add detection for RISING and FALLING events."""
|
||||||
import RPi.GPIO as GPIO
|
from RPi import GPIO
|
||||||
GPIO.add_event_detect(
|
GPIO.add_event_detect(
|
||||||
port,
|
port,
|
||||||
GPIO.BOTH,
|
GPIO.BOTH,
|
||||||
|
|
|
@ -6,7 +6,7 @@ https://home-assistant.io/components/scene.litejet/
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import homeassistant.components.litejet as litejet
|
from homeassistant.components import litejet
|
||||||
from homeassistant.components.scene import Scene
|
from homeassistant.components.scene import Scene
|
||||||
|
|
||||||
DEPENDENCIES = ['litejet']
|
DEPENDENCIES = ['litejet']
|
||||||
|
|
|
@ -11,7 +11,7 @@ import logging
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||||
import homeassistant.components.arduino as arduino
|
from homeassistant.components import arduino
|
||||||
from homeassistant.const import CONF_NAME
|
from homeassistant.const import CONF_NAME
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
|
@ -8,7 +8,7 @@ import asyncio
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import homeassistant.components.mqtt as mqtt
|
from homeassistant.components import mqtt
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.const import TEMP_FAHRENHEIT, TEMP_CELSIUS
|
from homeassistant.const import TEMP_FAHRENHEIT, TEMP_CELSIUS
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
|
|
|
@ -128,7 +128,7 @@ class DHTSensor(Entity):
|
||||||
temperature = data[SENSOR_TEMPERATURE]
|
temperature = data[SENSOR_TEMPERATURE]
|
||||||
_LOGGER.debug("Temperature %.1f \u00b0C + offset %.1f",
|
_LOGGER.debug("Temperature %.1f \u00b0C + offset %.1f",
|
||||||
temperature, temperature_offset)
|
temperature, temperature_offset)
|
||||||
if (temperature >= -20) and (temperature < 80):
|
if -20 <= temperature < 80:
|
||||||
self._state = round(temperature + temperature_offset, 1)
|
self._state = round(temperature + temperature_offset, 1)
|
||||||
if self.temp_unit == TEMP_FAHRENHEIT:
|
if self.temp_unit == TEMP_FAHRENHEIT:
|
||||||
self._state = round(celsius_to_fahrenheit(temperature), 1)
|
self._state = round(celsius_to_fahrenheit(temperature), 1)
|
||||||
|
@ -136,7 +136,7 @@ class DHTSensor(Entity):
|
||||||
humidity = data[SENSOR_HUMIDITY]
|
humidity = data[SENSOR_HUMIDITY]
|
||||||
_LOGGER.debug("Humidity %.1f%% + offset %.1f",
|
_LOGGER.debug("Humidity %.1f%% + offset %.1f",
|
||||||
humidity, humidity_offset)
|
humidity, humidity_offset)
|
||||||
if (humidity >= 0) and (humidity <= 100):
|
if 0 <= humidity <= 100:
|
||||||
self._state = round(humidity + humidity_offset, 1)
|
self._state = round(humidity + humidity_offset, 1)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.util.decorator import Registry
|
from homeassistant.util.decorator import Registry
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.helpers.event import async_track_state_change
|
from homeassistant.helpers.event import async_track_state_change
|
||||||
import homeassistant.components.history as history
|
from homeassistant.components import history
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
|
@ -17,7 +17,7 @@ from homeassistant.const import (
|
||||||
ATTR_LONGITUDE, CONF_MODE)
|
ATTR_LONGITUDE, CONF_MODE)
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
import homeassistant.helpers.location as location
|
from homeassistant.helpers import location
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
|
|
||||||
REQUIREMENTS = ['googlemaps==2.5.1']
|
REQUIREMENTS = ['googlemaps==2.5.1']
|
||||||
|
|
|
@ -10,7 +10,7 @@ from datetime import timedelta
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
import homeassistant.util.dt as dt
|
from homeassistant.util import dt
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
|
|
|
@ -176,7 +176,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
gtfs = pygtfs.Schedule(joined_path)
|
gtfs = pygtfs.Schedule(joined_path)
|
||||||
|
|
||||||
# pylint: disable=no-member
|
# pylint: disable=no-member
|
||||||
if len(gtfs.feeds) < 1:
|
if not gtfs.feeds:
|
||||||
pygtfs.append_feed(gtfs, os.path.join(gtfs_dir, data))
|
pygtfs.append_feed(gtfs, os.path.join(gtfs_dir, data))
|
||||||
|
|
||||||
add_devices([GTFSDepartureSensor(gtfs, name, origin, destination, offset)])
|
add_devices([GTFSDepartureSensor(gtfs, name, origin, destination, offset)])
|
||||||
|
|
|
@ -10,7 +10,7 @@ import math
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
import homeassistant.components.history as history
|
from homeassistant.components import history
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||||
|
|
|
@ -9,7 +9,7 @@ import struct
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
import homeassistant.components.modbus as modbus
|
from homeassistant.components import modbus
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_NAME, CONF_OFFSET, CONF_UNIT_OF_MEASUREMENT, CONF_SLAVE,
|
CONF_NAME, CONF_OFFSET, CONF_UNIT_OF_MEASUREMENT, CONF_SLAVE,
|
||||||
CONF_STRUCTURE)
|
CONF_STRUCTURE)
|
||||||
|
|
|
@ -10,7 +10,7 @@ import math
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||||
import homeassistant.util as util
|
from homeassistant import util
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.helpers.event import track_state_change
|
from homeassistant.helpers.event import track_state_change
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
|
|
|
@ -20,7 +20,7 @@ from homeassistant.const import (
|
||||||
CONF_FORCE_UPDATE, CONF_NAME, CONF_VALUE_TEMPLATE, STATE_UNKNOWN,
|
CONF_FORCE_UPDATE, CONF_NAME, CONF_VALUE_TEMPLATE, STATE_UNKNOWN,
|
||||||
CONF_UNIT_OF_MEASUREMENT, CONF_ICON, CONF_DEVICE_CLASS)
|
CONF_UNIT_OF_MEASUREMENT, CONF_ICON, CONF_DEVICE_CLASS)
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
import homeassistant.components.mqtt as mqtt
|
from homeassistant.components import mqtt
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.typing import HomeAssistantType, ConfigType
|
from homeassistant.helpers.typing import HomeAssistantType, ConfigType
|
||||||
from homeassistant.helpers.event import async_track_point_in_utc_time
|
from homeassistant.helpers.event import async_track_point_in_utc_time
|
||||||
|
|
|
@ -11,7 +11,7 @@ from datetime import timedelta
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
import homeassistant.components.mqtt as mqtt
|
from homeassistant.components import mqtt
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.components.mqtt import CONF_STATE_TOPIC
|
from homeassistant.components.mqtt import CONF_STATE_TOPIC
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||||
|
|
|
@ -12,7 +12,7 @@ from homeassistant.const import (
|
||||||
CONF_NAME, STATE_UNKNOWN, CONF_UNIT_OF_MEASUREMENT, CONF_PAYLOAD)
|
CONF_NAME, STATE_UNKNOWN, CONF_UNIT_OF_MEASUREMENT, CONF_PAYLOAD)
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
import homeassistant.components.pilight as pilight
|
from homeassistant.components import pilight
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
|
@ -8,7 +8,7 @@ import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
import homeassistant.components.rfxtrx as rfxtrx
|
from homeassistant.components import rfxtrx
|
||||||
from homeassistant.components.rfxtrx import (
|
from homeassistant.components.rfxtrx import (
|
||||||
ATTR_DATA_TYPE, ATTR_FIRE_EVENT, CONF_AUTOMATIC_ADD, CONF_DATA_TYPE,
|
ATTR_DATA_TYPE, ATTR_FIRE_EVENT, CONF_AUTOMATIC_ADD, CONF_DATA_TYPE,
|
||||||
CONF_DEVICES, CONF_FIRE_EVENT, DATA_TYPES)
|
CONF_DEVICES, CONF_FIRE_EVENT, DATA_TYPES)
|
||||||
|
|
|
@ -12,7 +12,7 @@ import voluptuous as vol
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||||
from homeassistant.const import CONF_TYPE
|
from homeassistant.const import CONF_TYPE
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
import homeassistant.util as util
|
from homeassistant import util
|
||||||
|
|
||||||
REQUIREMENTS = ['ephem==3.7.6.0']
|
REQUIREMENTS = ['ephem==3.7.6.0']
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
"""Set up the Tellstick sensors."""
|
"""Set up the Tellstick sensors."""
|
||||||
import tellcore.telldus as telldus
|
from tellcore import telldus
|
||||||
import tellcore.constants as tellcore_constants
|
import tellcore.constants as tellcore_constants
|
||||||
|
|
||||||
sensor_value_descriptions = {
|
sensor_value_descriptions = {
|
||||||
|
|
|
@ -7,7 +7,7 @@ https://home-assistant.io/components/sensor.thinkingcleaner/
|
||||||
import logging
|
import logging
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
import homeassistant.util as util
|
from homeassistant import util
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
|
@ -5,7 +5,7 @@ For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/sensor.toon/
|
https://home-assistant.io/components/sensor.toon/
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
import datetime as datetime
|
import datetime
|
||||||
|
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
import homeassistant.components.toon as toon_main
|
import homeassistant.components.toon as toon_main
|
||||||
|
|
|
@ -14,7 +14,7 @@ from homeassistant.const import (
|
||||||
ATTR_ATTRIBUTION, CONF_NAME, CONF_REGION, EVENT_HOMEASSISTANT_START,
|
ATTR_ATTRIBUTION, CONF_NAME, CONF_REGION, EVENT_HOMEASSISTANT_START,
|
||||||
ATTR_LATITUDE, ATTR_LONGITUDE)
|
ATTR_LATITUDE, ATTR_LONGITUDE)
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
import homeassistant.helpers.location as location
|
from homeassistant.helpers import location
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
import homeassistant.components.zabbix as zabbix
|
from homeassistant.components import zabbix
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||||
from homeassistant.const import CONF_NAME
|
from homeassistant.const import CONF_NAME
|
||||||
|
|
|
@ -12,7 +12,7 @@ from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||||
from homeassistant.const import STATE_UNKNOWN
|
from homeassistant.const import STATE_UNKNOWN
|
||||||
from homeassistant.const import CONF_MONITORED_CONDITIONS
|
from homeassistant.const import CONF_MONITORED_CONDITIONS
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
import homeassistant.components.zoneminder as zoneminder
|
from homeassistant.components import zoneminder
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
|
@ -12,7 +12,7 @@ import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.helpers import intent, config_validation as cv
|
from homeassistant.helpers import intent, config_validation as cv
|
||||||
import homeassistant.components.mqtt as mqtt
|
from homeassistant.components import mqtt
|
||||||
|
|
||||||
DOMAIN = 'snips'
|
DOMAIN = 'snips'
|
||||||
DEPENDENCIES = ['mqtt']
|
DEPENDENCIES = ['mqtt']
|
||||||
|
|
|
@ -10,7 +10,7 @@ import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
import homeassistant.components.arduino as arduino
|
from homeassistant.components import arduino
|
||||||
from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHEMA)
|
from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHEMA)
|
||||||
from homeassistant.const import CONF_NAME
|
from homeassistant.const import CONF_NAME
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
|
@ -9,7 +9,7 @@ import logging
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.switch import PLATFORM_SCHEMA
|
from homeassistant.components.switch import PLATFORM_SCHEMA
|
||||||
import homeassistant.components.bbb_gpio as bbb_gpio
|
from homeassistant.components import bbb_gpio
|
||||||
from homeassistant.const import (DEVICE_DEFAULT_NAME, CONF_NAME)
|
from homeassistant.const import (DEVICE_DEFAULT_NAME, CONF_NAME)
|
||||||
from homeassistant.helpers.entity import ToggleEntity
|
from homeassistant.helpers.entity import ToggleEntity
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
|
@ -8,7 +8,7 @@ import logging
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
from homeassistant.components.switch import SwitchDevice
|
from homeassistant.components.switch import SwitchDevice
|
||||||
import homeassistant.util as util
|
from homeassistant import util
|
||||||
|
|
||||||
_CONFIGURING = {}
|
_CONFIGURING = {}
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
|
@ -6,7 +6,7 @@ https://home-assistant.io/components/switch.litejet/
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import homeassistant.components.litejet as litejet
|
from homeassistant.components import litejet
|
||||||
from homeassistant.components.switch import SwitchDevice
|
from homeassistant.components.switch import SwitchDevice
|
||||||
|
|
||||||
DEPENDENCIES = ['litejet']
|
DEPENDENCIES = ['litejet']
|
||||||
|
|
|
@ -7,7 +7,7 @@ https://home-assistant.io/components/switch.modbus/
|
||||||
import logging
|
import logging
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
import homeassistant.components.modbus as modbus
|
from homeassistant.components import modbus
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_NAME, CONF_SLAVE, CONF_COMMAND_ON, CONF_COMMAND_OFF)
|
CONF_NAME, CONF_SLAVE, CONF_COMMAND_ON, CONF_COMMAND_OFF)
|
||||||
from homeassistant.helpers.entity import ToggleEntity
|
from homeassistant.helpers.entity import ToggleEntity
|
||||||
|
|
|
@ -18,7 +18,7 @@ from homeassistant.components.switch import SwitchDevice
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_NAME, CONF_OPTIMISTIC, CONF_VALUE_TEMPLATE, CONF_PAYLOAD_OFF,
|
CONF_NAME, CONF_OPTIMISTIC, CONF_VALUE_TEMPLATE, CONF_PAYLOAD_OFF,
|
||||||
CONF_PAYLOAD_ON, CONF_ICON, STATE_ON)
|
CONF_PAYLOAD_ON, CONF_ICON, STATE_ON)
|
||||||
import homeassistant.components.mqtt as mqtt
|
from homeassistant.components import mqtt
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.restore_state import async_get_last_state
|
from homeassistant.helpers.restore_state import async_get_last_state
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ import logging
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
import homeassistant.components.pilight as pilight
|
from homeassistant.components import pilight
|
||||||
from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHEMA)
|
from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHEMA)
|
||||||
from homeassistant.const import (CONF_NAME, CONF_ID, CONF_SWITCHES, CONF_STATE,
|
from homeassistant.const import (CONF_NAME, CONF_ID, CONF_SWITCHES, CONF_STATE,
|
||||||
CONF_PROTOCOL, STATE_ON)
|
CONF_PROTOCOL, STATE_ON)
|
||||||
|
|
|
@ -11,7 +11,7 @@ from datetime import timedelta
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
import homeassistant.util as util
|
from homeassistant import util
|
||||||
from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHEMA)
|
from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHEMA)
|
||||||
from homeassistant.const import (CONF_NAME, CONF_HOST, CONF_PORT)
|
from homeassistant.const import (CONF_NAME, CONF_HOST, CONF_PORT)
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
|
@ -8,7 +8,7 @@ import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
import homeassistant.components.rfxtrx as rfxtrx
|
from homeassistant.components import rfxtrx
|
||||||
from homeassistant.components.switch import SwitchDevice, PLATFORM_SCHEMA
|
from homeassistant.components.switch import SwitchDevice, PLATFORM_SCHEMA
|
||||||
from homeassistant.components.rfxtrx import (
|
from homeassistant.components.rfxtrx import (
|
||||||
CONF_AUTOMATIC_ADD, CONF_FIRE_EVENT, DEFAULT_SIGNAL_REPETITIONS,
|
CONF_AUTOMATIC_ADD, CONF_FIRE_EVENT, DEFAULT_SIGNAL_REPETITIONS,
|
||||||
|
|
|
@ -9,7 +9,7 @@ import logging
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.switch import PLATFORM_SCHEMA
|
from homeassistant.components.switch import PLATFORM_SCHEMA
|
||||||
import homeassistant.components.rpi_gpio as rpi_gpio
|
from homeassistant.components import rpi_gpio
|
||||||
from homeassistant.const import DEVICE_DEFAULT_NAME
|
from homeassistant.const import DEVICE_DEFAULT_NAME
|
||||||
from homeassistant.helpers.entity import ToggleEntity
|
from homeassistant.helpers.entity import ToggleEntity
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
|
@ -8,7 +8,7 @@ import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
import homeassistant.components.rpi_pfio as rpi_pfio
|
from homeassistant.components import rpi_pfio
|
||||||
from homeassistant.components.switch import PLATFORM_SCHEMA
|
from homeassistant.components.switch import PLATFORM_SCHEMA
|
||||||
from homeassistant.const import ATTR_NAME, DEVICE_DEFAULT_NAME
|
from homeassistant.const import ATTR_NAME, DEVICE_DEFAULT_NAME
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
|
@ -8,7 +8,7 @@ import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
import homeassistant.components.scsgate as scsgate
|
from homeassistant.components import scsgate
|
||||||
from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHEMA)
|
from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHEMA)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_ENTITY_ID, ATTR_STATE, CONF_NAME, CONF_DEVICES)
|
ATTR_ENTITY_ID, ATTR_STATE, CONF_NAME, CONF_DEVICES)
|
||||||
|
|
|
@ -8,8 +8,7 @@ import time
|
||||||
import logging
|
import logging
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
import homeassistant.util as util
|
from homeassistant import util
|
||||||
|
|
||||||
from homeassistant.const import (STATE_ON, STATE_OFF)
|
from homeassistant.const import (STATE_ON, STATE_OFF)
|
||||||
from homeassistant.helpers.entity import ToggleEntity
|
from homeassistant.helpers.entity import ToggleEntity
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ WEMO_STANDBY = 8
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices_callback, discovery_info=None):
|
def setup_platform(hass, config, add_devices_callback, discovery_info=None):
|
||||||
"""Set up discovered WeMo switches."""
|
"""Set up discovered WeMo switches."""
|
||||||
import pywemo.discovery as discovery
|
from pywemo import discovery
|
||||||
|
|
||||||
if discovery_info is not None:
|
if discovery_info is not None:
|
||||||
location = discovery_info['ssdp_description']
|
location = discovery_info['ssdp_description']
|
||||||
|
|
|
@ -10,7 +10,7 @@ import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHEMA)
|
from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHEMA)
|
||||||
from homeassistant.const import (CONF_COMMAND_ON, CONF_COMMAND_OFF)
|
from homeassistant.const import (CONF_COMMAND_ON, CONF_COMMAND_OFF)
|
||||||
import homeassistant.components.zoneminder as zoneminder
|
from homeassistant.components import zoneminder
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
|
@ -11,9 +11,8 @@ import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_API_KEY, CONF_ID, CONF_WHITELIST, STATE_UNAVAILABLE, STATE_UNKNOWN)
|
CONF_API_KEY, CONF_ID, CONF_WHITELIST, STATE_UNAVAILABLE, STATE_UNKNOWN)
|
||||||
from homeassistant.helpers import state as state_helper
|
from homeassistant.helpers import event, state as state_helper
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
import homeassistant.helpers.event as event
|
|
||||||
|
|
||||||
REQUIREMENTS = ['thingspeak==0.4.1']
|
REQUIREMENTS = ['thingspeak==0.4.1']
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue