forked from platypush/platypush
Overridden status method in switch.wemo
This commit is contained in:
parent
2e4e847857
commit
b4dbb0c5a6
1 changed files with 15 additions and 6 deletions
|
@ -66,12 +66,8 @@ class SwitchWemoPlugin(SwitchPlugin):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return [
|
return [
|
||||||
{
|
self.status(device).output
|
||||||
'ip': addr,
|
for device in self._devices.values()
|
||||||
'name': name if name != addr else self.get_name(addr),
|
|
||||||
'on': self.get_state(addr),
|
|
||||||
}
|
|
||||||
for (name, addr) in self._devices.items()
|
|
||||||
]
|
]
|
||||||
|
|
||||||
def _exec(self, device: str, action: SwitchAction, port: int = _default_port, value=None):
|
def _exec(self, device: str, action: SwitchAction, port: int = _default_port, value=None):
|
||||||
|
@ -109,6 +105,19 @@ class SwitchWemoPlugin(SwitchPlugin):
|
||||||
dom = parseString(response.text)
|
dom = parseString(response.text)
|
||||||
return dom.getElementsByTagName(state_name).item(0).firstChild.data
|
return dom.getElementsByTagName(state_name).item(0).firstChild.data
|
||||||
|
|
||||||
|
@action
|
||||||
|
def status(self, device=None, *args, **kwargs):
|
||||||
|
devices = {device: device} if device else self._devices.copy()
|
||||||
|
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
'ip': addr,
|
||||||
|
'name': name if name != addr else self.get_name(addr).output,
|
||||||
|
'on': self.get_state(addr).output,
|
||||||
|
}
|
||||||
|
for (name, addr) in self._devices.items()
|
||||||
|
]
|
||||||
|
|
||||||
@action
|
@action
|
||||||
def on(self, device: str, **kwargs):
|
def on(self, device: str, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue