@@ -89,7 +85,11 @@ class BrowserPlayer extends LitElement {
: html`
`}
@@ -98,7 +98,7 @@ class BrowserPlayer extends LitElement {
- ${deviceID}
+ ${window.browser_mod.deviceID}
`;
}
@@ -133,7 +133,10 @@ class BrowserPlayer extends LitElement {
}
(async () => {
- await hass_loaded();
+ while (!window.browser_mod) {
+ await new Promise((resolve) => setTimeout(resolve, 1000));
+ }
+ await window.browser_mod.connectionPromise;
if (!customElements.get("browser-player"))
customElements.define("browser-player", BrowserPlayer);
diff --git a/js/plugin/connection.ts b/js/plugin/connection.ts
index 9341b80..a8d119d 100644
--- a/js/plugin/connection.ts
+++ b/js/plugin/connection.ts
@@ -12,6 +12,7 @@ export const ConnectionMixin = (SuperClass) => {
public connectionPromise = new Promise((resolve) => {
this._connectionResolve = resolve;
});
+ public deviceEntities = {};
LOG(...args) {
const dt = new Date();
@@ -26,6 +27,8 @@ export const ConnectionMixin = (SuperClass) => {
if (msg.command) {
this.LOG("Command:", msg);
this.fireEvent(`command-${msg.command}`, msg);
+ } else if (msg.deviceEntities) {
+ this.deviceEntities = msg.deviceEntities;
} else if (msg.result) {
this.update_config(msg.result);
}