Put some Spotify-music playing at your reachable local network.

Install Home Assistant. Shortest should be:

npm install -g homebridge-homeassistant

sudo apt-get install python3 python3-venv python3-pip

sudo useradd -rm homeassistant

cd /srv

sudo mkdir homeassistant

sudo chown homeassistant:homeassistant homeassistant sudo su -s /bin/bash homeassistant

cd /srv/homeassistant

python3 -m venv .

source bin/activate

python3 -m pip install wheel

pip3 install homeassistant

hass

Change Home Assistant password (earlier mentioned SETYOUTPASSWORDHERE) to /home/homeassistant/.homeassistant/secrets.yaml

Create autostart for Home Assistant (with sudo) to /etc/systemd/system/home-assistant@homeassistant.service:

[Unit]

Description=Home Assistant

After=network-online.target [Service]

Type=simple

User=%i

ExecStart=/srv/homeassistant/bin/hass -c "/home/homeassistant/.homeassistant" [Install]

WantedBy=multi-user.target

Run:

sudo systemctl start home-assistant@homeassistant

sudo systemctl enable home-assistant@homeassistant

Now create script for Spotify to Home Assitant via web-interface. Should be now running at http://raspberrypi.local:8123/.

Goto Configuration -> Script and click the plus-sign at the bottom of the page.