Skip to content

Commit 501bcdb

Browse files
committed
Add setTimeout for subscribe
1 parent 8c8dd1c commit 501bcdb

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

dist/spotify-card.js

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/spotify-card.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/const.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
const CARD_VERSION = '2.0.0-beta.21';
1+
const CARD_VERSION = '2.0.0-beta.22';
22
export default CARD_VERSION;

src/spotify-card.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ export class SpotifyCard extends LitElement {
7373
super.connectedCallback();
7474
this.spotcast_connector = new SpotcastConnector(this);
7575
//get all available entities and when they update
76-
this.unsubscribe_entitites = subscribeEntities(this.hass.connection, (entities) => this.entitiesUpdated(entities));
76+
setTimeout(() => {
77+
this.unsubscribe_entitites = subscribeEntities(this.hass.connection, (entities) =>
78+
this.entitiesUpdated(entities)
79+
);
80+
}, 1000);
7781
}
7882

7983
public disconnectedCallback() {
@@ -84,7 +88,6 @@ export class SpotifyCard extends LitElement {
8488
//Callback when hass-entity has changed
8589
entitiesUpdated(entities: HassEntities): void {
8690
let updateDevices = false;
87-
console.log('ENTITIES:', entities);
8891
for (const item in entities) {
8992
// Are there any changes to media players
9093
if (item.startsWith('media_player')) {

0 commit comments

Comments
 (0)