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

View file

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