Allow multiple connections per browser
This commit is contained in:
parent
1cb64a2c8d
commit
1076bb2c9c
@ -24,7 +24,7 @@ class BrowserModBrowser:
|
||||
self.entities = {}
|
||||
self.data = {}
|
||||
self.settings = {}
|
||||
self.connection = None
|
||||
self._connections = []
|
||||
|
||||
self.update_entities(hass)
|
||||
|
||||
@ -105,8 +105,7 @@ class BrowserModBrowser:
|
||||
if self.connection is None:
|
||||
return
|
||||
|
||||
connection, cid = self.connection
|
||||
|
||||
for (connection, cid) in self.connection:
|
||||
connection.send_message(
|
||||
event_message(
|
||||
cid,
|
||||
@ -130,6 +129,14 @@ class BrowserModBrowser:
|
||||
device = dr.async_get_device({(DOMAIN, self.browserID)})
|
||||
dr.async_remove_device(device.id)
|
||||
|
||||
@property
|
||||
def connection(self):
|
||||
return self._connections
|
||||
|
||||
@connection.setter
|
||||
def connection(self, con):
|
||||
self._connections.append(con)
|
||||
|
||||
|
||||
def getBrowser(hass, browserID, *, create=True):
|
||||
"""Get or create browser by browserID."""
|
||||
|
@ -1918,14 +1918,6 @@ const AutoSettingsMixin = (SuperClass) => {
|
||||
return link === null || link === void 0 ? void 0 : link.href;
|
||||
}
|
||||
_updateFavicon({ result }) {
|
||||
// TEMP: Template for testing
|
||||
/*
|
||||
{% if is_state("light.bed_light", "on") %}
|
||||
/local/workspace/test/icons/green.png
|
||||
{% else %}
|
||||
/local/workspace/test/icons/red.png
|
||||
{% endif %}
|
||||
*/
|
||||
const link = document.head.querySelector("link[rel~='icon']");
|
||||
link.href = result;
|
||||
window.browser_mod.fireEvent("browser-mod-favicon-update");
|
||||
|
@ -109,14 +109,6 @@ export const AutoSettingsMixin = (SuperClass) => {
|
||||
}
|
||||
|
||||
_updateFavicon({ result }) {
|
||||
// TEMP: Template for testing
|
||||
/*
|
||||
{% if is_state("light.bed_light", "on") %}
|
||||
/local/workspace/test/icons/green.png
|
||||
{% else %}
|
||||
/local/workspace/test/icons/red.png
|
||||
{% endif %}
|
||||
*/
|
||||
const link: any = document.head.querySelector("link[rel~='icon']");
|
||||
link.href = result;
|
||||
window.browser_mod.fireEvent("browser-mod-favicon-update");
|
||||
|
Loading…
x
Reference in New Issue
Block a user