Break up websocket 2 (#17028)

* Break up websocket 2

* Lint+Test

* Lintttt

* Rename
This commit is contained in:
Paulus Schoutsen authored and Pascal Vizeli committed 2018-10-01 16:09:31 +02:00
1 parent b5e3d8c337
commit 2e6346ca43
27 files changed
+641 -568

No files matched your search

@@ -874,19 +874,19 @@ async def websocket_handle_thumbnail(hass, connection, msg):
player = component.get_entity(msg['entity_id'])
if player is None:
connection.send_message_outside(websocket_api.error_message(
connection.send_message(websocket_api.error_message(
msg['id'], 'entity_not_found', 'Entity not found'))
return
data, content_type = await player.async_get_media_image()
if data is None:
connection.send_message_outside(websocket_api.error_message(
connection.send_message(websocket_api.error_message(
msg['id'], 'thumbnail_fetch_failed',
'Failed to fetch thumbnail'))
return
connection.send_message_outside(websocket_api.result_message(
connection.send_message(websocket_api.result_message(
msg['id'], {
'content_type': content_type,
'content': base64.b64encode(data).decode('utf-8')