Skip to content

Commit a01f2ed

Browse files
authored
v2.0.0 Major rewrite (#88)
* Add work from FL550 plus device fetching * Remove cricle ci * Move to newer build * add more files * Playback works * Fully working version * Added account and more types * Add shuffle and play pause * Small fixes! * Fix play pause icon for grid * First beta release * Add cast debug * Add filter of cast devices * Fixes for beta * Add catch to see what causes the issue for the user * More debug * bump version * catch entitly list filtering * catch entitly list filtering * stop using entity list for casts * account for error in fetching casts * catch player ws as well * print errors * stop updating state when not shown * 2.0.0 * 2.0.0-beta.16 * Add account to readme * Grid auto width with one setting * beta16 * Fix spotify entity not having spotify in the name * Move spotcast test to render * add default device name * beta 19 * debug build * Add setTimeout for subscribe * Check if connection is null * Get hass object on update * v2.0.0
1 parent 2629d33 commit a01f2ed

33 files changed

+6177
-3089
lines changed

.circleci/config.yml

-37
This file was deleted.

.eslintrc.json

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"extends": [
3+
"eslint:recommended",
4+
"plugin:@typescript-eslint/eslint-recommended",
5+
"plugin:@typescript-eslint/recommended"
6+
],
7+
"parser": "@typescript-eslint/parser",
8+
"parserOptions": {
9+
"ecmaVersion": 2020,
10+
"sourceType": "module"
11+
},
12+
"plugins": ["@typescript-eslint"],
13+
"rules": {
14+
"@typescript-eslint/no-explicit-any": "off",
15+
"@typescript-eslint/no-unused-vars": [
16+
"warn",
17+
{
18+
"argsIgnorePattern": "^_"
19+
}
20+
]
21+
}
22+
}

.github/workflows/build.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
21
name: "Build"
32

43
on:
54
push:
6-
branches:
5+
branches:
76
- master
87
pull_request:
9-
branches:
8+
branches:
109
- master
1110

1211
jobs:

.prettierrc.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
semi: true,
3+
trailingComma: 'all',
4+
singleQuote: true,
5+
printWidth: 120,
6+
tabWidth: 2,
7+
};

LICENSE

100644100755
+186-201
Large diffs are not rendered by default.

README.md

100644100755
+81-76
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,81 @@
1-
[![hacs_badge](https://img.shields.io/badge/HACS-Default-orange.svg)](https://github.com/custom-components/hacs) [![spotify-card](https://img.shields.io/github/release/custom-cards/spotify-card.svg)](https://github.com/custom-cards/spotify-card) ![Maintenance](https://img.shields.io/maintenance/yes/2020.svg)
2-
3-
[![Buy me a coffee](https://img.shields.io/static/v1.svg?label=Buy%20me%20a%20coffee&message=🥨&color=black&logo=buy%20me%20a%20coffee&logoColor=white&labelColor=6f4e37)](https://www.buymeacoffee.com/fondberg)
4-
5-
## Home Assistant Spotify Lovelace Card
6-
**DISCLAIMER**: *This project is a private open source project and doesn't have any connection with Spotify.*
7-
8-
Web component card which can be used as a Lovelace [Home Assistants](https://www.home-assistant.io/lovelace/]) card.
9-
10-
Forum thread: https://community.home-assistant.io/t/spotify-lovelace-card/103525
11-
12-
This card supports listing the users currently available devices and the users top playlists on [Spotify](https://www.spotify.com).
13-
Choose an online media player and click on a playlist to play it on the device.
14-
This component will query the current playback from the Spotify Web API and tries to reflect the current status wrt to device and playlist if something is playing.
15-
16-
The component uses the [Spotify Web API](https://developer.spotify.com/documentation/web-api/).
17-
18-
![Screenshot](/spotify-card-highlight.png)
19-
20-
## See release information in github for release notes
21-
22-
### Requirements
23-
This should now work in all newer major browsers. If it does not work for you please provide detailed reports in an issue ticket.
24-
25-
### Installation
26-
Create a new app at [Spotify developer console](https://developer.spotify.com/my-applications/#!/applications)
27-
or use the one created for the HA Spotify component (see below).
28-
Make sure you edit the settings and adds the redirect URL for the tab the card has.
29-
30-
Example: `https://<your public home assistant hostname>:8123/lovelace/media`.
31-
32-
For more information about how to create an app see [Home Assistant Spotify Component documentation](https://www.home-assistant.io/components/media_player.spotify/).
33-
34-
Add the resource in lovelace config:
35-
36-
##### HACS users:
37-
Follow the HACS instructions when installing it.
38-
39-
40-
##### Latest release using cdn:
41-
```
42-
- type: module
43-
url: >-
44-
https://cdn.jsdelivr.net/gh/custom-cards/[email protected]/dist/spotify-card.umd.js
45-
```
46-
47-
##### Add the card to lovelace config
48-
Now add the card like this:
49-
```
50-
cards:
51-
- type: 'custom:spotify-card'
52-
client_id: <YOUR CLIENT ID>
53-
limit: <optional number of playlists to retrieve (default 10)>
54-
device: <optional name of a device to pre-select>
55-
player: <optional use this player only, value should be the same name as the displayname of the player>
56-
featuredPlaylists: <optional show featured playlists instead of users playlists>
57-
featuredPlaylistsCountryCode: <optional country code to show featured playlist relevent to a particular country. https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 >
58-
dailyMixes: <optional show daily mixes, requires spotcast>
59-
height: <optional pixels height for the playlist element. If content is larger scrolling will be enabled>
60-
random_song: <optional boolean to start playlists from a random song>
61-
```
62-
63-
If you add the `device` setting, the card will select it by default and will not display the dropdown menu.
64-
65-
### General usage
66-
This library can of course also be used on other websites or projects other than Home Assistant
67-
68-
### CONTRIBUTING
69-
Please contribute and help.Before creating a large PR make sure to sync about it with me.
70-
71-
### Donate
72-
If you like this and want to buy me a coffee
73-
74-
<a href="https://www.buymeacoffee.com/fondberg" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: auto !important;width: auto !important;" ></a>
75-
### License
76-
This library is licensed under Apache 2.0, see [LICENSE](./LICENSE)
1+
[![hacs_badge](https://img.shields.io/badge/HACS-Default-orange.svg)](https://github.com/custom-components/hacs) [![spotify-card](https://img.shields.io/github/release/custom-cards/spotify-card.svg)](https://github.com/custom-cards/spotify-card)
2+
3+
![Build](https://github.com/custom-cards/spotify-card/workflows/Build/badge.svg)
4+
5+
## Home Assistant Spotify Lovelace Card
6+
7+
**DISCLAIMER**: _This project is a private open source project and doesn't have any connection with Spotify._
8+
9+
This card supports listing the users currently available devices and the users playlists on [Spotify](https://www.spotify.com). Choose an online media player and click on a playlist to play it on the device. This component will query the current playback from the [Spotify Integration](https://www.home-assistant.io/integrations/spotify/) and tries to reflect the currently playing playlist.
10+
11+
The component uses the [Spotify Integration](https://www.home-assistant.io/integrations/spotify/) and [spotcast](https://github.com/fondberg/spotcast) and both of them have to be installed for the card to function properly.
12+
13+
The forum thread can be found [here](https://community.home-assistant.io/t/spotify-lovelace-card/103525)
14+
15+
<img src="pics/grid.png" width="300">
16+
17+
## See release information on Github for release notes
18+
19+
### Requirements
20+
21+
[Spotify Integration](https://www.home-assistant.io/integrations/spotify/) and [spotcast](https://github.com/fondberg/spotcast) have to be installed (Spotcast is needed for many other things than playing on cast devices).
22+
This card should work in all newer major browsers. If it does not work for you please provide detailed reports in an issue ticket.
23+
24+
### Installation
25+
26+
#### HACS users
27+
28+
Follow the HACS instructions when installing it.
29+
30+
#### Manually
31+
32+
Copy the content of the `dist` folder to `www/community/spotify_card/` in your Home Assistant configuration directory. Create these folders if they do not exist.
33+
34+
Then you have to add spotify card to your resources. This can be done via `Settings -> Lovelace Dashboards -> Resources`. Add this path:
35+
36+
```
37+
/local/community/spotify-card/spotify-card.js
38+
```
39+
40+
If you do not have the `Resources` tab available, you have to enable the advanced mode for Lovelace. To do so, click on your username on your Home Assistant dashboard and enanble the setting.
41+
42+
### Usage
43+
44+
Add the card via lovelace to your dashboard. All of the settings can be configured via the visual editor.
45+
46+
If you are not using the visual configuration of Lovelace you can add the card like this:
47+
48+
```
49+
cards:
50+
- type: 'custom:spotify-card'
51+
account: <optional> which account to use for spotcast. Defaults to "default"
52+
height: <optional pixels height for the playlist element. If content is larger scrolling will be enabled>
53+
limit: <optional number of playlists to retrieve (default 10)>
54+
device: <optional name of a device to pre-select>
55+
playlist_type: <optional featured|discover-weekly> Change type of playlists shown. Default are your normal playlists.
56+
always_play_random_song: <optional true> Set to start playlists from a random song.
57+
country_code: <optional country code to show featured playlist relevent to a particular country. https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 >
58+
hide_warning: <optional true> Hide warnings if they are displayed.
59+
name: <optional name> Custom title. Leave empty to hide.
60+
display_style: <optional Grid> Change default display style.
61+
grid_covers_per_row: <optional number> Number of covers per row (default 3) in Grid-view.
62+
spotify_entity: <optional> Name of your spotify media player entity if it doesn't start with "spotify"
63+
default_device: <optional> Name of your spotify connect or chromecast device, e.g. "Kitchen"
64+
```
65+
66+
### Screenshots
67+
68+
<img src="pics/list.png" height="300">
69+
<img src="pics/conf.png" height="300">
70+
71+
### General usage
72+
73+
This library can of course also be used on other websites or projects other than Home Assistant
74+
75+
### CONTRIBUTING
76+
77+
Please contribute and help. Before creating a large PR make sure to sync about it with me.
78+
79+
### License
80+
81+
This library is licensed under Apache 2.0, see [LICENSE](./LICENSE)

TODO.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
###
1+
- Add visualization for tring to start new playback
2+
- Localisation
3+
- check why shuffle doesn't work (uses media_player.spotify)

0 commit comments

Comments
 (0)