ABC consistent not implemented behavior (#2359)

This commit is contained in:
Paulus Schoutsen authored and GitHub committed 2016-06-24 21:27:40 -07:00
1 parent c616115419
commit 68df3deee0
22 files changed
+56 -41

No files matched your search

+1 -1
View File
@@ -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)
+1
View File
@@ -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":