Get a random record suggestion from Discogs

I’m totalling at 820 records and growing in my record collection and sometimes that can make it hard to pick what to choose (the luxury of abundance I guess). So I set out to create a sensor which fetches a random record from my collection every hour.

Since I don’t know enough Python to comfortably create it as a new component I wrote a small Node.js cloud function and deployed it as an AWS Lambda using serverless:

My initial intention was to have 2 functions:

  • one cloud function to fetch the random record data
  • another function to invoke that lambda and return its result to a push_cam entity

Unfortunatly the images are excluded in Discogs’ API response for some reason and in the meantime I just set up a REST sensor to grab the record data and show it to me:

image

- platform: rest
  icon: mdi:record-player
  scan_interval: 1800
  resource: !secret discogs_random_record_lambda
  name: "Discogs Random Record"
  json_attributes:
    - basic_information
  value_template: "{{ value_json.record.basic_information.artists[0].name }} - {{ value_json.record.basic_information.title }}"
1 Like