From 10ab1751d869cb328d4ea8627044cb3b7e3c04c9 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Wed, 4 Dec 2019 09:29:29 +0100 Subject: [PATCH] Return only the first element, not in an array, if status() was called with only one device --- platypush/plugins/switch/wemo/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/platypush/plugins/switch/wemo/__init__.py b/platypush/plugins/switch/wemo/__init__.py index 00b8cec1e2..08ededf59c 100644 --- a/platypush/plugins/switch/wemo/__init__.py +++ b/platypush/plugins/switch/wemo/__init__.py @@ -109,7 +109,7 @@ class SwitchWemoPlugin(SwitchPlugin): def status(self, device=None, *args, **kwargs): devices = {device: device} if device else self._devices.copy() - return [ + ret = [ { 'id': addr, 'ip': addr, @@ -119,6 +119,8 @@ class SwitchWemoPlugin(SwitchPlugin): for (name, addr) in self._devices.items() ] + return ret[0] if device else ret + @action def on(self, device: str, **kwargs): """