parent
78a3c01f27
commit
384f63dd1d
23 changed files with 33 additions and 21 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -98,3 +98,6 @@ desktop.ini
|
||||||
/home-assistant.pyproj
|
/home-assistant.pyproj
|
||||||
/home-assistant.sln
|
/home-assistant.sln
|
||||||
/.vs/*
|
/.vs/*
|
||||||
|
|
||||||
|
# mypy
|
||||||
|
/.mypy_cache/*
|
||||||
|
|
|
@ -277,7 +277,7 @@ class Alert(ToggleEntity):
|
||||||
yield from self.async_update_ha_state()
|
yield from self.async_update_ha_state()
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_toggle(self):
|
def async_toggle(self, **kwargs):
|
||||||
"""Async toggle alert."""
|
"""Async toggle alert."""
|
||||||
if self._ack:
|
if self._ack:
|
||||||
return self.async_turn_on()
|
return self.async_turn_on()
|
||||||
|
|
|
@ -69,7 +69,8 @@ class IHCBinarySensor(IHCDevice, BinarySensorDevice):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, ihc_controller, name, ihc_id: int, info: bool,
|
def __init__(self, ihc_controller, name, ihc_id: int, info: bool,
|
||||||
sensor_type: str, inverting: bool, product: Element=None):
|
sensor_type: str, inverting: bool,
|
||||||
|
product: Element=None) -> None:
|
||||||
"""Initialize the IHC binary sensor."""
|
"""Initialize the IHC binary sensor."""
|
||||||
super().__init__(ihc_controller, name, ihc_id, info, product)
|
super().__init__(ihc_controller, name, ihc_id, info, product)
|
||||||
self._state = None
|
self._state = None
|
||||||
|
|
|
@ -42,7 +42,7 @@ 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):
|
def __init__(self, node: object) -> None:
|
||||||
"""Initialize the ISY994 cover device."""
|
"""Initialize the ISY994 cover device."""
|
||||||
super().__init__(node)
|
super().__init__(node)
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ def get_scanner(hass, config):
|
||||||
class UnifiScanner(DeviceScanner):
|
class UnifiScanner(DeviceScanner):
|
||||||
"""Provide device_tracker support from Unifi WAP client data."""
|
"""Provide device_tracker support from Unifi WAP client data."""
|
||||||
|
|
||||||
def __init__(self, controller, detection_time: timedelta):
|
def __init__(self, controller, detection_time: timedelta) -> None:
|
||||||
"""Initialize the scanner."""
|
"""Initialize the scanner."""
|
||||||
self._detection_time = detection_time
|
self._detection_time = detection_time
|
||||||
self._controller = controller
|
self._controller = controller
|
||||||
|
|
|
@ -37,7 +37,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
class ComfoConnectFan(FanEntity):
|
class ComfoConnectFan(FanEntity):
|
||||||
"""Representation of the ComfoConnect fan platform."""
|
"""Representation of the ComfoConnect fan platform."""
|
||||||
|
|
||||||
def __init__(self, hass, name, ccb: ComfoConnectBridge):
|
def __init__(self, hass, name, ccb: ComfoConnectBridge) -> None:
|
||||||
"""Initialize the ComfoConnect fan."""
|
"""Initialize the ComfoConnect fan."""
|
||||||
from pycomfoconnect import SENSOR_FAN_SPEED_MODE
|
from pycomfoconnect import SENSOR_FAN_SPEED_MODE
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ class ComfoConnectFan(FanEntity):
|
||||||
speed = SPEED_LOW
|
speed = SPEED_LOW
|
||||||
self.set_speed(speed)
|
self.set_speed(speed)
|
||||||
|
|
||||||
def turn_off(self) -> None:
|
def turn_off(self, **kwargs) -> None:
|
||||||
"""Turn off the fan (to away)."""
|
"""Turn off the fan (to away)."""
|
||||||
self.set_speed(SPEED_OFF)
|
self.set_speed(SPEED_OFF)
|
||||||
|
|
||||||
|
|
|
@ -320,7 +320,7 @@ def setup(hass: HomeAssistant, base_config):
|
||||||
class CecDevice(Entity):
|
class CecDevice(Entity):
|
||||||
"""Representation of a HDMI CEC device entity."""
|
"""Representation of a HDMI CEC device entity."""
|
||||||
|
|
||||||
def __init__(self, hass: HomeAssistant, device, logical):
|
def __init__(self, hass: HomeAssistant, device, logical) -> None:
|
||||||
"""Initialize the device."""
|
"""Initialize the device."""
|
||||||
self._device = device
|
self._device = device
|
||||||
self.hass = hass
|
self.hass = hass
|
||||||
|
|
|
@ -14,7 +14,7 @@ class IHCDevice(Entity):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, ihc_controller, name, ihc_id: int, info: bool,
|
def __init__(self, ihc_controller, name, ihc_id: int, info: bool,
|
||||||
product: Element=None):
|
product: Element=None) -> None:
|
||||||
"""Initialize IHC attributes."""
|
"""Initialize IHC attributes."""
|
||||||
self.ihc_controller = ihc_controller
|
self.ihc_controller = ihc_controller
|
||||||
self._name = name
|
self._name = name
|
||||||
|
|
|
@ -64,7 +64,7 @@ class IhcLight(IHCDevice, Light):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, ihc_controller, name, ihc_id: int, info: bool,
|
def __init__(self, ihc_controller, name, ihc_id: int, info: bool,
|
||||||
dimmable=False, product: Element=None):
|
dimmable=False, product: Element=None) -> None:
|
||||||
"""Initialize the light."""
|
"""Initialize the light."""
|
||||||
super().__init__(ihc_controller, name, ihc_id, info, product)
|
super().__init__(ihc_controller, name, ihc_id, info, product)
|
||||||
self._brightness = 0
|
self._brightness = 0
|
||||||
|
|
|
@ -75,7 +75,7 @@ def hsv_to_rgb(hsv: Tuple[float, float, float]) -> Tuple[int, int, int]:
|
||||||
class TPLinkSmartBulb(Light):
|
class TPLinkSmartBulb(Light):
|
||||||
"""Representation of a TPLink Smart Bulb."""
|
"""Representation of a TPLink Smart Bulb."""
|
||||||
|
|
||||||
def __init__(self, smartbulb: 'SmartBulb', name):
|
def __init__(self, smartbulb: 'SmartBulb', name) -> None:
|
||||||
"""Initialize the bulb."""
|
"""Initialize the bulb."""
|
||||||
self.smartbulb = smartbulb
|
self.smartbulb = smartbulb
|
||||||
self._name = name
|
self._name = name
|
||||||
|
|
|
@ -34,7 +34,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
class CecPlayerDevice(CecDevice, MediaPlayerDevice):
|
class CecPlayerDevice(CecDevice, MediaPlayerDevice):
|
||||||
"""Representation of a HDMI device as a Media palyer."""
|
"""Representation of a HDMI device as a Media palyer."""
|
||||||
|
|
||||||
def __init__(self, hass: HomeAssistant, device, logical):
|
def __init__(self, hass: HomeAssistant, device, logical) -> None:
|
||||||
"""Initialize the HDMI device."""
|
"""Initialize the HDMI device."""
|
||||||
CecDevice.__init__(self, hass, device, logical)
|
CecDevice.__init__(self, hass, device, logical)
|
||||||
self.entity_id = "%s.%s_%s" % (
|
self.entity_id = "%s.%s_%s" % (
|
||||||
|
|
|
@ -6,6 +6,9 @@ https://home-assistant.io/components/media_player.onkyo/
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
# pylint: disable=unused-import
|
||||||
|
from typing import List # noqa: F401
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import (
|
from homeassistant.components.media_player import (
|
||||||
|
|
|
@ -9,6 +9,9 @@ from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
|
# pylint: disable=unused-import
|
||||||
|
from typing import Dict # noqa: F401
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import (
|
from homeassistant.components.media_player import (
|
||||||
|
|
|
@ -130,7 +130,7 @@ class CallRateDelayThrottle(object):
|
||||||
it should not block the mainloop.
|
it should not block the mainloop.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, hass, delay_seconds: float):
|
def __init__(self, hass, delay_seconds: float) -> None:
|
||||||
"""Initialize the delay handler."""
|
"""Initialize the delay handler."""
|
||||||
self._delay = timedelta(seconds=max(0.0, delay_seconds))
|
self._delay = timedelta(seconds=max(0.0, delay_seconds))
|
||||||
self._queue = []
|
self._queue = []
|
||||||
|
|
|
@ -16,7 +16,7 @@ import queue
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from typing import Dict, Optional
|
from typing import Any, Dict, Optional # noqa: F401
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,8 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
class ComfoConnectSensor(Entity):
|
class ComfoConnectSensor(Entity):
|
||||||
"""Representation of a ComfoConnect sensor."""
|
"""Representation of a ComfoConnect sensor."""
|
||||||
|
|
||||||
def __init__(self, hass, name, ccb: ComfoConnectBridge, sensor_type):
|
def __init__(self, hass, name, ccb: ComfoConnectBridge,
|
||||||
|
sensor_type) -> None:
|
||||||
"""Initialize the ComfoConnect sensor."""
|
"""Initialize the ComfoConnect sensor."""
|
||||||
self._ccb = ccb
|
self._ccb = ccb
|
||||||
self._sensor_type = sensor_type
|
self._sensor_type = sensor_type
|
||||||
|
|
|
@ -57,7 +57,8 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
class DaikinClimateSensor(Entity):
|
class DaikinClimateSensor(Entity):
|
||||||
"""Representation of a Sensor."""
|
"""Representation of a Sensor."""
|
||||||
|
|
||||||
def __init__(self, api, monitored_state, units: UnitSystem, name=None):
|
def __init__(self, api, monitored_state, units: UnitSystem,
|
||||||
|
name=None) -> None:
|
||||||
"""Initialize the sensor."""
|
"""Initialize the sensor."""
|
||||||
self._api = api
|
self._api = api
|
||||||
self._sensor = SENSOR_TYPES.get(monitored_state)
|
self._sensor = SENSOR_TYPES.get(monitored_state)
|
||||||
|
|
|
@ -62,7 +62,7 @@ class IHCSensor(IHCDevice, Entity):
|
||||||
"""Implementation of the IHC sensor."""
|
"""Implementation of the IHC sensor."""
|
||||||
|
|
||||||
def __init__(self, ihc_controller, name, ihc_id: int, info: bool,
|
def __init__(self, ihc_controller, name, ihc_id: int, info: bool,
|
||||||
unit, product: Element=None):
|
unit, product: Element=None) -> None:
|
||||||
"""Initialize the IHC sensor."""
|
"""Initialize the IHC sensor."""
|
||||||
super().__init__(ihc_controller, name, ihc_id, info, product)
|
super().__init__(ihc_controller, name, ihc_id, info, product)
|
||||||
self._state = None
|
self._state = None
|
||||||
|
|
|
@ -30,7 +30,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
class CecSwitchDevice(CecDevice, SwitchDevice):
|
class CecSwitchDevice(CecDevice, SwitchDevice):
|
||||||
"""Representation of a HDMI device as a Switch."""
|
"""Representation of a HDMI device as a Switch."""
|
||||||
|
|
||||||
def __init__(self, hass: HomeAssistant, device, logical):
|
def __init__(self, hass: HomeAssistant, device, logical) -> None:
|
||||||
"""Initialize the HDMI device."""
|
"""Initialize the HDMI device."""
|
||||||
CecDevice.__init__(self, hass, device, logical)
|
CecDevice.__init__(self, hass, device, logical)
|
||||||
self.entity_id = "%s.%s_%s" % (
|
self.entity_id = "%s.%s_%s" % (
|
||||||
|
|
|
@ -53,7 +53,7 @@ class IHCSwitch(IHCDevice, SwitchDevice):
|
||||||
"""IHC Switch."""
|
"""IHC Switch."""
|
||||||
|
|
||||||
def __init__(self, ihc_controller, name: str, ihc_id: int,
|
def __init__(self, ihc_controller, name: str, ihc_id: int,
|
||||||
info: bool, product: Element=None):
|
info: bool, product: Element=None) -> None:
|
||||||
"""Initialize the IHC switch."""
|
"""Initialize the IHC switch."""
|
||||||
super().__init__(ihc_controller, name, ihc_id, product)
|
super().__init__(ihc_controller, name, ihc_id, product)
|
||||||
self._state = False
|
self._state = False
|
||||||
|
|
|
@ -19,7 +19,7 @@ import sys
|
||||||
from types import ModuleType
|
from types import ModuleType
|
||||||
|
|
||||||
# pylint: disable=unused-import
|
# pylint: disable=unused-import
|
||||||
from typing import Dict, Optional, Sequence, Set # NOQA
|
from typing import Dict, List, Optional, Sequence, Set # NOQA
|
||||||
|
|
||||||
from homeassistant.const import PLATFORM_FORMAT
|
from homeassistant.const import PLATFORM_FORMAT
|
||||||
from homeassistant.util import OrderedSet
|
from homeassistant.util import OrderedSet
|
||||||
|
|
|
@ -3,7 +3,7 @@ import datetime as dt
|
||||||
import re
|
import re
|
||||||
|
|
||||||
# pylint: disable=unused-import
|
# pylint: disable=unused-import
|
||||||
from typing import Any, Union, Optional, Tuple # NOQA
|
from typing import Any, Dict, Union, Optional, Tuple # NOQA
|
||||||
|
|
||||||
import pytz
|
import pytz
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ class UnitSystem(object):
|
||||||
raise TypeError('{} is not a numeric value.'.format(str(length)))
|
raise TypeError('{} is not a numeric value.'.format(str(length)))
|
||||||
|
|
||||||
return distance_util.convert(length, from_unit,
|
return distance_util.convert(length, from_unit,
|
||||||
self.length_unit) # type: float
|
self.length_unit)
|
||||||
|
|
||||||
def as_dict(self) -> dict:
|
def as_dict(self) -> dict:
|
||||||
"""Convert the unit system to a dictionary."""
|
"""Convert the unit system to a dictionary."""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue