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 <alan@aussiegeek.net>
This commit is contained in:
Alan Harper 2021-05-30 00:36:23 +10:00 committed by Eric Callahan
parent 541f5e54dc
commit d6156dee68
1 changed files with 3 additions and 2 deletions

View File

@ -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: