Service to send command to browsers

This commit is contained in:
2019-06-27 13:30:54 +02:00
parent 4149759dd1
commit f58467445c
4 changed files with 41 additions and 4 deletions

View File

@@ -53,10 +53,11 @@ class BrowserModEntity(Entity):
self.entity_id = async_generate_entity_id("media_player.{}", alias or deviceID, hass=hass)
def ws_send(self, command, **kwargs):
self._ws_connection.send_message(event_message(self._ws_cid, {
"command": command,
**kwargs,
}))
if self._ws_connection:
self._ws_connection.send_message(event_message(self._ws_cid, {
"command": command,
**kwargs,
}))
def ws_connect(self, connection, cid):
self._ws_cid = cid