Skip to content

Commit

Permalink
[ 1.0.22 ] * This release requires the SpotifyPlus Integration v1.0.7…
Browse files Browse the repository at this point in the history
…2+ release; please make sure you update the SpotifyPlus integration prior to updating this SpotifyPlus Card release.

  * Fixed card not rendering correctly in the card picker and when an entity id was not selected.
  • Loading branch information
thlucas1 committed Dec 18, 2024
1 parent 2b9313e commit b319159
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ Change are listed in reverse chronological order (newest to oldest).

<span class="changelog">

###### [ 1.0.22 ] - 2024/12/18

* This release requires the SpotifyPlus Integration v1.0.72+ release; please make sure you update the SpotifyPlus integration prior to updating this SpotifyPlus Card release.
* Fixed card not rendering correctly in the card picker and when an entity id was not selected.

###### [ 1.0.21 ] - 2024/12/18

* This release requires the SpotifyPlus Integration v1.0.72+ release; please make sure you update the SpotifyPlus integration prior to updating this SpotifyPlus Card release.
Expand Down
9 changes: 8 additions & 1 deletion src/card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1010,11 +1010,18 @@ export class Card extends LitElement {

userPresets: [
{
"name": "Spotify Playlist Daily Mix 1",
"name": "Daily Mix 1",
"subtitle": "Various Artists",
"image_url": "https://dailymix-images.scdn.co/v2/img/ab6761610000e5ebcd3f796bd7ea49ed7615a550/1/en/default",
"uri": "spotify:playlist:37i9dQZF1E39vTG3GurFPW",
"type": "playlist"
},
{
"name": "My Track Favorites",
"subtitle": "Shuffled",
"image_url": "https://t.scdn.co/images/728ed47fc1674feb95f7ac20236eb6d7.jpeg",
"shuffle": true,
"type": "trackfavorites"
}
],

Expand Down
2 changes: 1 addition & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { css } from 'lit';

/** current version of the card. */
export const CARD_VERSION = '1.0.21';
export const CARD_VERSION = '1.0.22';

/** SpotifyPlus integration domain identifier. */
export const DOMAIN_SPOTIFYPLUS = 'spotifyplus';
Expand Down
21 changes: 21 additions & 0 deletions src/model/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export class Store {
this.spotifyPlusService = new SpotifyPlusService(hass, card);
this.player = this.getMediaPlayerObject(playerId);
this.section = section;

}


Expand All @@ -90,6 +91,26 @@ export class Store {
*/
public getMediaPlayerObject(entityId: string) {

// has an entity been configured?
if ((!this.config) || (!this.config.entity) || (this.config.entity.trim() == "")) {

// entityId will not be set in the config if coming from the card picker;
// this is ok, as we want it to render a "needs configured" card ui.
// in this case, we just create an "empty" MediaPlayer instance.
return new MediaPlayer({
entity_id: "",
state: "",
last_changed: "",
last_updated: "",
attributes: {},
context: {
id: "",
user_id: "",
parent_id: "",
}
});
}

// does entity id prefix exist in hass state data?
const hassEntitys = Object.values(this.hass.states)
.filter((ent) => ent.entity_id.match(entityId));
Expand Down

0 comments on commit b319159

Please sign in to comment.