Return only the first element, not in an array, if status() was called with only one device
This commit is contained in:
parent
25894d3c00
commit
10ab1751d8
1 changed files with 3 additions and 1 deletions
|
@ -109,7 +109,7 @@ class SwitchWemoPlugin(SwitchPlugin):
|
||||||
def status(self, device=None, *args, **kwargs):
|
def status(self, device=None, *args, **kwargs):
|
||||||
devices = {device: device} if device else self._devices.copy()
|
devices = {device: device} if device else self._devices.copy()
|
||||||
|
|
||||||
return [
|
ret = [
|
||||||
{
|
{
|
||||||
'id': addr,
|
'id': addr,
|
||||||
'ip': addr,
|
'ip': addr,
|
||||||
|
@ -119,6 +119,8 @@ class SwitchWemoPlugin(SwitchPlugin):
|
||||||
for (name, addr) in self._devices.items()
|
for (name, addr) in self._devices.items()
|
||||||
]
|
]
|
||||||
|
|
||||||
|
return ret[0] if device else ret
|
||||||
|
|
||||||
@action
|
@action
|
||||||
def on(self, device: str, **kwargs):
|
def on(self, device: str, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue