Home assistant listenbrainz sensor

For those of you that play around with home automation.
I have configured a listenbrainz sensor for home-assist using a rest sensor.

This creates a sensor with the time, track artist and release of the last thing you played on listenbrainz.

To add this sensor add the following to config.yml replacing your username.

sensor:
  - platform: rest
    name: listenbrainz
    resource: https://api.listenbrainz.org/1/user/dns_server/listens?count=1
    json_attributes_path: "payload.listens[0].track_metadata"
    json_attributes:
      - "track_name"
      - "artist_name"
      - "release_name"
    value_template: '{{ value_json.payload.listens[0].listened_at|timestamp_utc }}'
7 Likes