Hey,

I wanted to see some info about Spotify on my Windows PC in Pimatic and also control it.
Like this:

Here’s how it’s done, you need:
EventGhost with Spotify plugin and Webserver plugin
Some pimatic buttons
ShellSensor:

{
  "id": "spotify_info",
  "name": "Spotify PC",
  "class": "ShellSensor",
  "attributeName": "currently_playing",
  "attributeType": "string",
  "attributeUnit": "",
  "command": "/home/pi/spotify.sh",
  "discrete": true,
  "interval": 5000
}

only 5 seconds delay adds some cpu-load, but not that much.

Shell Script:

#!/bin/bash

host="192.168.1.21"
port="1602"

ping -c 1 -W 1 $host &> /dev/null
if [ $? -ne 0 ]; then
  echo "Host is offline."
else
  foo=$(curl -s http://$host:$port/spotify.htm)
  if [ "$foo" == "None" ]; then
    echo "Spotify not running."
  else
    echo $foo | sed 's/Spotify running! //g'
  fi
fi

create a file called “spotify.htm” inside the webserver directory of eventghost with this content:

{{eg.plugins.MySpotify.GetStatus()}}

You also need some events in spotify for the actions:

Then it can be called like this:

The spotify plugin for EventGhost is a little bit flawed, some of the functions don’t work at all.
If you know of a better way of interacting with spotify on windows please tell me. ;)