Refactor Google Assistant (#12959)
* Refactor Google Assistant * Fix cloud test * Fix supported features media player demo * Fix query * Fix execute * Fix demo media player tests * Add tests for traits * Lint * Lint * Add integration tests * Add more tests * update logging * Catch out of range temp errrors * Fix cloud error * Lint
This commit is contained in:
parent
8792fd22b9
commit
9b1a75a74b
16 changed files with 1676 additions and 822 deletions
|
@ -1,6 +1,7 @@
|
|||
"""Module to handle messages from Home Assistant cloud."""
|
||||
import asyncio
|
||||
import logging
|
||||
import pprint
|
||||
|
||||
from aiohttp import hdrs, client_exceptions, WSMsgType
|
||||
|
||||
|
@ -154,7 +155,9 @@ class CloudIoT:
|
|||
disconnect_warn = 'Received invalid JSON.'
|
||||
break
|
||||
|
||||
_LOGGER.debug("Received message: %s", msg)
|
||||
if _LOGGER.isEnabledFor(logging.DEBUG):
|
||||
_LOGGER.debug("Received message:\n%s\n",
|
||||
pprint.pformat(msg))
|
||||
|
||||
response = {
|
||||
'msgid': msg['msgid'],
|
||||
|
@ -176,7 +179,9 @@ class CloudIoT:
|
|||
_LOGGER.exception("Error handling message")
|
||||
response['error'] = 'exception'
|
||||
|
||||
_LOGGER.debug("Publishing message: %s", response)
|
||||
if _LOGGER.isEnabledFor(logging.DEBUG):
|
||||
_LOGGER.debug("Publishing message:\n%s\n",
|
||||
pprint.pformat(response))
|
||||
yield from client.send_json(response)
|
||||
|
||||
except client_exceptions.WSServerHandshakeError as err:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue