[External integration] Last.fm: your music listens in Gladys 🎵

Hello everyone,

I present to you Last.fm, an external integration for Gladys (v5.1.1 minimum) based on the new SDK for integrations.

The principle: Last.fm records (« scrobbles ») what you listen to on Spotify, Deezer, Apple Music, YouTube Music, Tidal, Plex, Sonos and many others. A single integration thus covers all your players: if your listens arrive on your Last.fm profile, Gladys sees them.

cover

What it does

One device per followed profile (up to 10: yours, a loved one’s…):

  • Listening (yes / no)
  • Current title or last title (« Artist – Title »)
  • Scrobbles of the day (since midnight, Gladys time zone)
  • Total scrobbles

The history is kept: the Graphical card can show your listens of the week, and the classic scenes on the value of a device work (« more than 100 scrobbles today »…).

4 scene triggers:

  • New title (profile, artist filter)
  • Start of listening
  • End of listening (with session duration and number of titles)
  • Loved title (profile, artist filter)

Some ideas:

  • Start of listening → dim the living room and turn on the amp
  • End of listening → turn off the amp
  • New title from « Daft Punk » → disco mode lights :mirror_ball:

4 scene actions: current title, listening statistics (day / total, favorite artist, album and title over a period), love and unlove a title.

3 dashboard widgets:

  • Listening: cover, title, artist · album, counters, love button
  • Recent listens: last titles with covers, « currently playing » and :heart: badges
  • Tops: artists, albums (grid of covers) or titles, from 7 days to forever

Configuration

  1. Create a free Last.fm API key: Login | Last.fm (free application name, the callback URL can remain empty)
  2. Enter the API key and the profiles to follow, then Test the connection
  3. Add the devices from the Discovery tab
  4. (Optional) To love titles from Gladys: enter the shared secret, click on Connect and authorize on the Last.fm page. No redirect URL to declare, Gladys detects the authorization on its own.

Good to know

  • Last.fm has no push API: the integration reads the profiles every 30 s by default (adjustable from 15 to 300 s). Scenes therefore react with a few seconds to half a minute delay.
  • The Artist filter is case-sensitive (« Daft Punk », not « daft punk »).
  • A profile whose recent listens are hidden cannot be followed.
  • Last.fm no longer provides artist photos since 2019: the top artists is displayed without image.

Technical side

About 3 API calls per profile and per cycle, well below Last.fm limits. Covers go through a validated proxy (no SSRF, format and size control). Apache-2.0 license.

:package: Code and complete documentation: GitHub - William-De71/gladys-lastfm: Gladys Assistant integration for Last.fm: what you're listening to, your scrobbles, music-driven scenes and dashboard widgets. · GitHub

This is v1.0.0: your feedback, bugs and scene ideas are welcome, here or as an issue on GitHub!

Community integration, not affiliated with Last.fm.

1 Like