From d6156dee683ece86d14fd9dbbaa95894b53adb0b Mon Sep 17 00:00:00 2001 From: Alan Harper <475+aussiegeek@users.noreply.github.com> Date: Sun, 30 May 2021 00:36:23 +1000 Subject: [PATCH] power: Fix Home Assistant exception Home Assistant returns an empty response when switching a switch on or off. Will now requery the switch status and return it's result Signed-off-by: Alan Harper --- moonraker/components/power.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/moonraker/components/power.py b/moonraker/components/power.py index ed64315..86dde1f 100644 --- a/moonraker/components/power.py +++ b/moonraker/components/power.py @@ -699,8 +699,9 @@ class HomeAssistant(HTTPDevice): return res[f"state"] async def _send_power_request(self, state: str) -> str: - res = await self._send_homeassistant_command(state) - return res[0][f"state"] + await self._send_homeassistant_command(state) + res = await self._send_status_request() + return res class Loxonev1(HTTPDevice): def __init__(self, config: ConfigHelper) -> None: