mirror of
https://github.com/home-assistant/core.git
synced 2026-09-02 10:17:26 -05:00
Code clean-up.
This commit is contained in:
@@ -18,7 +18,7 @@ from homeassistant.exceptions import PlatformNotReady
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
DEFAULT_NAME = 'Xiaomi Miio Switch'
|
||||
PLATFORM = 'xiaomi_miio'
|
||||
|
||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
||||
vol.Required(CONF_HOST): cv.string,
|
||||
vol.Required(CONF_TOKEN): vol.All(cv.string, vol.Length(min=32, max=32)),
|
||||
@@ -154,20 +154,16 @@ class XiaomiPlugGenericSwitch(SwitchDevice):
|
||||
@asyncio.coroutine
|
||||
def async_turn_on(self, **kwargs):
|
||||
"""Turn the plug on."""
|
||||
result = yield from self._try_command(
|
||||
"Turning the plug on failed.", self._plug.on)
|
||||
|
||||
if result:
|
||||
if (yield from self._try_command("Turning the plug on failed.",
|
||||
self._plug.on)):
|
||||
self._state = True
|
||||
self._skip_update = True
|
||||
|
||||
@asyncio.coroutine
|
||||
def async_turn_off(self, **kwargs):
|
||||
"""Turn the plug off."""
|
||||
result = yield from self._try_command(
|
||||
"Turning the plug off failed.", self._plug.off)
|
||||
|
||||
if result:
|
||||
if (yield from self._try_command("Turning the plug off failed.",
|
||||
self._plug.off)):
|
||||
self._state = False
|
||||
self._skip_update = True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user