Add experimental camera support
This commit is contained in:
@@ -4,8 +4,8 @@ import voluptuous as vol
|
||||
from homeassistant.components.websocket_api import websocket_command, result_message, event_message, async_register_command
|
||||
from homeassistant.helpers.entity import Entity, async_generate_entity_id
|
||||
|
||||
from .const import DOMAIN, WS_CONNECT, WS_UPDATE
|
||||
from .helpers import get_devices, create_entity
|
||||
from .const import DOMAIN, WS_CONNECT, WS_UPDATE, WS_CAMERA
|
||||
from .helpers import get_devices, create_entity, get_config
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@@ -38,7 +38,6 @@ async def setup_connection(hass, config):
|
||||
async_register_command(hass, handle_connect)
|
||||
async_register_command(hass, handle_update)
|
||||
|
||||
|
||||
class BrowserModConnection:
|
||||
def __init__(self, hass, deviceID):
|
||||
self.hass = hass
|
||||
@@ -49,10 +48,11 @@ class BrowserModConnection:
|
||||
self.screen = None
|
||||
self.sensor = None
|
||||
self.fully = None
|
||||
self.camera = None
|
||||
|
||||
def connect(self, connection, cid):
|
||||
self.connection.append((connection, cid))
|
||||
self.send("update")
|
||||
self.send("update", **get_config(self.hass, self.deviceID))
|
||||
|
||||
def disconnect():
|
||||
self.connection.remove((connection, cid))
|
||||
@@ -100,3 +100,11 @@ class BrowserModConnection:
|
||||
self)
|
||||
self.fully.data = data.get('fully')
|
||||
|
||||
if data.get('camera'):
|
||||
self.camera = self.camera or create_entity(
|
||||
self.hass,
|
||||
'camera',
|
||||
self.deviceID,
|
||||
self)
|
||||
self.camera.data = data.get('camera')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user