Let switch.wemo on/off/toggle methods always call status() for returned value for consistency with the frontend and other switch plugins

This commit is contained in:
Fabio Manganiello 2019-12-04 09:24:34 +01:00
parent 675b690929
commit 69e702ed0c
1 changed files with 4 additions and 10 deletions

View File

@ -126,11 +126,8 @@ class SwitchWemoPlugin(SwitchPlugin):
:param device: Device name or address
"""
state = self._exec(device=device, action=SwitchAction.SET_STATE, value=1)
return {
'device': device,
'on': bool(int(state)),
}
self._exec(device=device, action=SwitchAction.SET_STATE, value=1)
return self.status(device)
@action
def off(self, device: str, **kwargs):
@ -139,11 +136,8 @@ class SwitchWemoPlugin(SwitchPlugin):
:param device: Device name or address
"""
state = self._exec(device=device, action=SwitchAction.SET_STATE, value=0)
return {
'device': device,
'on': bool(int(state)),
}
self._exec(device=device, action=SwitchAction.SET_STATE, value=0)
return self.status(device)
@action
def toggle(self, device: str, *args, **kwargs):