Fixing the api_streams sensor (#22200)

* Fire events with websocket messages.

* Added tests to validate

* Fixed api_streams sensor to use new sensor

* Delete from coverageac as now works.

* Removed websocket request event.

* Use dispatcher instead of events.

* Moved sensor to under websocket_api

* Changes as per code review

* Fixed tests.

* Modified test

* Patch
This commit is contained in:
Penny Wood 2019-03-23 02:59:10 +08:00 committed by Paulus Schoutsen
parent 2b6e197deb
commit 1ddc65a0ce
8 changed files with 142 additions and 168 deletions

View file

@ -20,3 +20,7 @@ TYPE_RESULT = 'result'
# Originally, this was just asyncio.CancelledError, but issue #9546 showed
# that futures.CancelledErrors can also occur in some situations.
CANCELLATION_ERRORS = (asyncio.CancelledError, futures.CancelledError)
# Event types
SIGNAL_WEBSOCKET_CONNECTED = 'websocket_connected'
SIGNAL_WEBSOCKET_DISCONNECTED = 'websocket_disconnected'