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:
Paulus Schoutsen 2018-03-08 14:39:10 -08:00 committed by GitHub
parent 8792fd22b9
commit 9b1a75a74b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 1676 additions and 822 deletions

View file

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