# Controlling Spotifyd via Dbus / Mpris?

**URL:** <https://discourse.nodered.org/t/controlling-spotifyd-via-dbus-mpris/67159>\
**Category:** General\
**Created:** [31 August 2022 01:52 UTC](https://discourse.nodered.org/t/controlling-spotifyd-via-dbus-mpris/67159 "2022-08-31T01:52:50Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![HonestJohn61](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/honestjohn61/32/51533_2.png) [@HonestJohn61](https://discourse.nodered.org/u/HonestJohn61)\
**Post date:** [2 September 2022 09:02 UTC](https://discourse.nodered.org/t/controlling-spotifyd-via-dbus-mpris/67159/2 "2022-09-02T09:02:14Z")

</div>

Well, I've been making some progress on this. The first element was discovering that spotifyd supports this as an option:

> —-onevent curl [http://192.168.11.97:1880/Spotify](http://192.168.11.97:1880/Spotify)

With [some help](https://discourse.nodered.org/t/how-to-trigger-a-node-red-flow-from-a-shell-script/67208/2) from @Colin I can now trigger a Node-RED flow whenever there's a change in what spotifyd is playing or pausing.

I have also discovered [Spotimaster](https://github.com/Intika-Linux-Spotify/Spotimaster) but this seems a very heavy solution to what I'm after, and I wasn't sure I fully understood how to implement it. Looking through the dependencies highlighted dbus-send so I decided to investigate that a bit further.

dbus-send is a standard part of Ubuntu, so if I can figure out how to use it to address the spotifyd daemon, I should be able to make this work without installing anything else. I found [an excellent guide](https://sheitsandgiggles.com/2019/07/16/a-trip-into-dbus-send/) which I'm slowly working through. I've already found the spotifyd device on the dbus:

> ubuntu@ubuntu:~$ dbus-send --system --print-reply --dest=org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager.ListUnits
> 
> method return time=1662102778.773997 sender=:1.3 -\> destination=:1.52 serial=2743738 reply\_serial=2  
> ...  
> array [  
> struct {  
> string "spotifyd.service"  
> string "Spotify Daemon"  
> string "loaded"  
> string "active"  
> string "running"  
> string ""  
> object path "/org/freedesktop/systemd1/unit/spotifyd\_2eservice"  
> uint32 0  
> string ""  
> object path "/"  
> }  
> ...

Now I just need to work what methods (?) are supported by the spotifyd unit, how to send them from and get the reply into Node-RED and I'll be almost there ...

---

_[View the full topic](https://discourse.nodered.org/t/controlling-spotifyd-via-dbus-mpris/67159)._
