ABC consistent not implemented behavior (#2359)
This commit is contained in:
parent
c616115419
commit
68df3deee0
22 changed files with 56 additions and 41 deletions
|
@ -425,39 +425,39 @@ class HvacDevice(Entity):
|
|||
|
||||
def set_temperature(self, temperature):
|
||||
"""Set new target temperature."""
|
||||
pass
|
||||
raise NotImplementedError()
|
||||
|
||||
def set_humidity(self, humidity):
|
||||
"""Set new target humidity."""
|
||||
pass
|
||||
raise NotImplementedError()
|
||||
|
||||
def set_fan_mode(self, fan):
|
||||
"""Set new target fan mode."""
|
||||
pass
|
||||
raise NotImplementedError()
|
||||
|
||||
def set_operation_mode(self, operation_mode):
|
||||
"""Set new target operation mode."""
|
||||
pass
|
||||
raise NotImplementedError()
|
||||
|
||||
def set_swing_mode(self, swing_mode):
|
||||
"""Set new target swing operation."""
|
||||
pass
|
||||
raise NotImplementedError()
|
||||
|
||||
def turn_away_mode_on(self):
|
||||
"""Turn away mode on."""
|
||||
pass
|
||||
raise NotImplementedError()
|
||||
|
||||
def turn_away_mode_off(self):
|
||||
"""Turn away mode off."""
|
||||
pass
|
||||
raise NotImplementedError()
|
||||
|
||||
def turn_aux_heat_on(self):
|
||||
"""Turn auxillary heater on."""
|
||||
pass
|
||||
raise NotImplementedError()
|
||||
|
||||
def turn_aux_heat_off(self):
|
||||
"""Turn auxillary heater off."""
|
||||
pass
|
||||
raise NotImplementedError()
|
||||
|
||||
@property
|
||||
def min_temp(self):
|
||||
|
|
|
@ -58,7 +58,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||
discovery_info, zwave.NETWORK)
|
||||
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
# pylint: disable=too-many-arguments, abstract-method
|
||||
class ZWaveHvac(ZWaveDeviceEntity, HvacDevice):
|
||||
"""Represents a HeatControl hvac."""
|
||||
|
||||
|
|
|
@ -248,7 +248,8 @@ def setup(hass, config):
|
|||
class Light(ToggleEntity):
|
||||
"""Representation of a light."""
|
||||
|
||||
# pylint: disable=no-self-use
|
||||
# pylint: disable=no-self-use, abstract-method
|
||||
|
||||
@property
|
||||
def brightness(self):
|
||||
"""Return the brightness of this light between 0..255."""
|
||||
|
|
|
@ -4,6 +4,7 @@ Support for LimitlessLED bulbs.
|
|||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/light.limitlessled/
|
||||
"""
|
||||
# pylint: disable=abstract-method
|
||||
import logging
|
||||
|
||||
from homeassistant.components.light import (
|
||||
|
|
|
@ -4,6 +4,7 @@ Support for MySensors lights.
|
|||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/light.mysensors/
|
||||
"""
|
||||
# pylint: disable=abstract-method
|
||||
import logging
|
||||
|
||||
from homeassistant.components import mysensors
|
||||
|
|
|
@ -108,7 +108,7 @@ def setup(hass, config):
|
|||
class SwitchDevice(ToggleEntity):
|
||||
"""Representation of a switch."""
|
||||
|
||||
# pylint: disable=no-self-use
|
||||
# pylint: disable=no-self-use, abstract-method
|
||||
@property
|
||||
def current_power_mwh(self):
|
||||
"""Return the current power usage in mWh."""
|
||||
|
|
|
@ -4,7 +4,6 @@ Use serial protocol of acer projector to obtain state of the projector.
|
|||
This component allows to control almost all projectors from acer using
|
||||
their RS232 serial communication protocol.
|
||||
"""
|
||||
|
||||
import logging
|
||||
import re
|
||||
|
||||
|
@ -61,7 +60,8 @@ class AcerSwitch(SwitchDevice):
|
|||
write_timeout=write_timeout, **kwargs)
|
||||
self._serial_port = serial_port
|
||||
self._name = name
|
||||
self._state = STATE_UNKNOWN
|
||||
self._state = False
|
||||
self._available = False
|
||||
self._attributes = {
|
||||
LAMP_HOURS: STATE_UNKNOWN,
|
||||
INPUT_SOURCE: STATE_UNKNOWN,
|
||||
|
@ -100,14 +100,19 @@ class AcerSwitch(SwitchDevice):
|
|||
return match.group(1)
|
||||
return STATE_UNKNOWN
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
"""Return if projector is available."""
|
||||
return self._available
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""Return name of the projector."""
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def state(self):
|
||||
"""Return the current state of the projector."""
|
||||
def is_on(self):
|
||||
"""Return if the projector is turned on."""
|
||||
return self._state
|
||||
|
||||
@property
|
||||
|
@ -120,11 +125,13 @@ class AcerSwitch(SwitchDevice):
|
|||
msg = CMD_DICT[LAMP]
|
||||
awns = self._write_read_format(msg)
|
||||
if awns == 'Lamp 1':
|
||||
self._state = STATE_ON
|
||||
self._state = True
|
||||
self._available = True
|
||||
elif awns == 'Lamp 0':
|
||||
self._state = STATE_OFF
|
||||
self._state = False
|
||||
self._available = True
|
||||
else:
|
||||
self._state = STATE_UNKNOWN
|
||||
self._available = False
|
||||
|
||||
for key in self._attributes.keys():
|
||||
msg = CMD_DICT.get(key, None)
|
||||
|
|
|
@ -4,6 +4,7 @@ Support for device running with the aREST RESTful framework.
|
|||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/switch.arest/
|
||||
"""
|
||||
# pylint: disable=abstract-method
|
||||
import logging
|
||||
|
||||
import requests
|
||||
|
|
|
@ -65,6 +65,10 @@ class WOLSwitch(SwitchDevice):
|
|||
self._wol.send_magic_packet(self._mac_address)
|
||||
self.update_ha_state()
|
||||
|
||||
def turn_off(self):
|
||||
"""Do nothing."""
|
||||
pass
|
||||
|
||||
def update(self):
|
||||
"""Check if device is on and update the state."""
|
||||
if platform.system().lower() == "windows":
|
||||
|
|
|
@ -273,29 +273,29 @@ class ThermostatDevice(Entity):
|
|||
"""Return true if the fan is on."""
|
||||
return None
|
||||
|
||||
def set_temperate(self, temperature):
|
||||
def set_temperature(self, temperature):
|
||||
"""Set new target temperature."""
|
||||
pass
|
||||
raise NotImplementedError()
|
||||
|
||||
def set_hvac_mode(self, hvac_mode):
|
||||
"""Set hvac mode."""
|
||||
pass
|
||||
raise NotImplementedError()
|
||||
|
||||
def turn_away_mode_on(self):
|
||||
"""Turn away mode on."""
|
||||
pass
|
||||
raise NotImplementedError()
|
||||
|
||||
def turn_away_mode_off(self):
|
||||
"""Turn away mode off."""
|
||||
pass
|
||||
raise NotImplementedError()
|
||||
|
||||
def turn_fan_on(self):
|
||||
"""Turn fan on."""
|
||||
pass
|
||||
raise NotImplementedError()
|
||||
|
||||
def turn_fan_off(self):
|
||||
"""Turn fan off."""
|
||||
pass
|
||||
raise NotImplementedError()
|
||||
|
||||
@property
|
||||
def min_temp(self):
|
||||
|
|
|
@ -16,7 +16,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||
])
|
||||
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
# pylint: disable=too-many-arguments, abstract-method
|
||||
class DemoThermostat(ThermostatDevice):
|
||||
"""Representation of a demo thermostat."""
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||
schema=SET_FAN_MIN_ON_TIME_SCHEMA)
|
||||
|
||||
|
||||
# pylint: disable=too-many-public-methods
|
||||
# pylint: disable=too-many-public-methods, abstract-method
|
||||
class Thermostat(ThermostatDevice):
|
||||
"""A thermostat class for Ecobee."""
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||
return True
|
||||
|
||||
|
||||
# pylint: disable=too-many-instance-attributes, import-error
|
||||
# pylint: disable=too-many-instance-attributes, import-error, abstract-method
|
||||
class EQ3BTSmartThermostat(ThermostatDevice):
|
||||
"""Representation of a EQ3 Bluetooth Smart thermostat."""
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@ PLATFORM_SCHEMA = vol.Schema({
|
|||
})
|
||||
|
||||
|
||||
# pylint: disable=unused-argument
|
||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
"""Setup the heat control thermostat."""
|
||||
name = config.get(CONF_NAME)
|
||||
|
@ -55,7 +54,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||
min_temp, max_temp, target_temp)])
|
||||
|
||||
|
||||
# pylint: disable=too-many-instance-attributes
|
||||
# pylint: disable=too-many-instance-attributes, abstract-method
|
||||
class HeatControl(ThermostatDevice):
|
||||
"""Representation of a HeatControl device."""
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||
class HeatmiserV3Thermostat(ThermostatDevice):
|
||||
"""Representation of a HeatmiserV3 thermostat."""
|
||||
|
||||
# pylint: disable=too-many-instance-attributes
|
||||
# pylint: disable=too-many-instance-attributes, abstract-method
|
||||
def __init__(self, heatmiser, device, name, serport):
|
||||
"""Initialize the thermostat."""
|
||||
self.heatmiser = heatmiser
|
||||
|
|
|
@ -91,7 +91,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||
return True
|
||||
|
||||
|
||||
# pylint: disable=too-many-instance-attributes
|
||||
# pylint: disable=too-many-instance-attributes, abstract-method
|
||||
class HomematicThermostat(ThermostatDevice):
|
||||
"""Representation of a Homematic thermostat."""
|
||||
|
||||
|
|
|
@ -49,7 +49,6 @@ def _setup_round(username, password, config, add_devices):
|
|||
|
||||
|
||||
# config will be used later
|
||||
# pylint: disable=unused-argument
|
||||
def _setup_us(username, password, config, add_devices):
|
||||
"""Setup user."""
|
||||
import somecomfort
|
||||
|
@ -74,7 +73,6 @@ def _setup_us(username, password, config, add_devices):
|
|||
return True
|
||||
|
||||
|
||||
# pylint: disable=unused-argument
|
||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
"""Setup the honeywel thermostat."""
|
||||
username = config.get(CONF_USERNAME)
|
||||
|
@ -98,7 +96,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||
class RoundThermostat(ThermostatDevice):
|
||||
"""Representation of a Honeywell Round Connected thermostat."""
|
||||
|
||||
# pylint: disable=too-many-instance-attributes
|
||||
# pylint: disable=too-many-instance-attributes, abstract-method
|
||||
def __init__(self, device, zone_id, master, away_temp):
|
||||
"""Initialize the thermostat."""
|
||||
self.device = device
|
||||
|
@ -182,6 +180,7 @@ class RoundThermostat(ThermostatDevice):
|
|||
self._is_dhw = False
|
||||
|
||||
|
||||
# pylint: disable=abstract-method
|
||||
class HoneywellUSThermostat(ThermostatDevice):
|
||||
"""Representation of a Honeywell US Thermostat."""
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||
for structure, device in nest.devices()])
|
||||
|
||||
|
||||
# pylint: disable=abstract-method
|
||||
class NestThermostat(ThermostatDevice):
|
||||
"""Representation of a Nest thermostat."""
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||
])
|
||||
|
||||
|
||||
# pylint: disable=abstract-method
|
||||
class ProliphixThermostat(ThermostatDevice):
|
||||
"""Representation a Proliphix thermostat."""
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||
add_devices(tstats)
|
||||
|
||||
|
||||
# pylint: disable=abstract-method
|
||||
class RadioThermostat(ThermostatDevice):
|
||||
"""Representation of a Radio Thermostat."""
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||
|
||||
|
||||
# pylint: disable=too-many-arguments, too-many-instance-attributes
|
||||
# pylint: disable=abstract-method
|
||||
class ZWaveThermostat(zwave.ZWaveDeviceEntity, ThermostatDevice):
|
||||
"""Represents a HeatControl thermostat."""
|
||||
|
||||
|
|
|
@ -229,17 +229,15 @@ class ToggleEntity(Entity):
|
|||
@property
|
||||
def is_on(self):
|
||||
"""Return True if entity is on."""
|
||||
return False
|
||||
raise NotImplementedError()
|
||||
|
||||
def turn_on(self, **kwargs):
|
||||
"""Turn the entity on."""
|
||||
_LOGGER.warning('Method turn_on not implemented for %s',
|
||||
self.entity_id)
|
||||
raise NotImplementedError()
|
||||
|
||||
def turn_off(self, **kwargs):
|
||||
"""Turn the entity off."""
|
||||
_LOGGER.warning('Method turn_off not implemented for %s',
|
||||
self.entity_id)
|
||||
raise NotImplementedError()
|
||||
|
||||
def toggle(self, **kwargs):
|
||||
"""Toggle the entity off."""
|
||||
|
|
Loading…
Add table
Reference in a new issue