Automating my Sound System using openHab

I have been using openhab for a while now in a relatively small setting.
One thing that bothered me for a while was my Logitech z906 sound system.
I already had it powered by a sonoff device, but always had to actually press the button to start it as well as hook up a device with spotify to it.
That obviously had to change, thats what we are here for after all :smiley:

Using Raspotify and the openhab spotify webconnect api

Since my raspberry is sitting right next to the controller of the sound system, I wanted to use it for playing my spotify playlists. Raspotify is a great Spotify Player that utilizes Spotify Connect to controll the Spotify application on your Raspberry.
https://github.com/dtcooper/raspotify

Since I also wanted to controll the player with openhab I also implemented the openhab spotify webconnect api which allows you to fetch a lot of information from spotify as well as controll your player.
https://community.openhab.org/t/openhab-integration-to-spotify-web-connect-api-player/31610

Thanks to dtcooper and pmpkk for those two great tools!

Hacking my Logitech z906 to make it an iot device

The Logitech z906 does have a IR-Remote, which I unfortuantely lost, but it can of course also be controlled with the buttons on it. So i decided to pop the controll panel open and look at what is inside. I found a simple pcb with multiple buttons, all connected in the default gnd to pull up configuration. After a little bit of testing i found, that i could trigger the buttons with simple transistors.
I now use a Wemos D1 mini with a small MQTT programm to switch those transistors on my command.
With one click in my sitemap I can now power the system, turn it on, set the raspberry as my current device and start the music.

rule "Start on raspberry"
when
Item Spotify_PlayOnRaspi received command ON
then
spotify_current_device_id.sendCommand("2eXXXXXXXXXXXXXXXXX60")
spotify_action.sendCommand("transfer_playback")     //set my raspberry as currently playing device
BM_LU_PCPower.sendCommand(ON)    //turn on the power
Thread::sleep(5000)
BM_LU_Logitech_Speakers_Command.sendCommand(1)    //turn on the system
Thread::sleep(2000)
spotify_action.sendCommand("play")   //PLAY :)
end

Here is how the “hacked” control unit looks:

This is the first project I post on here, since I am quite happy with it. Maybe this gave some of you some inspiration. I am happy to answer any questions you have :slight_smile:

8 Likes

Did you also try the Spotify binding? It’s not yet released, but available in the market place.

Not yet. I will definitely look into it!

What about sound controle?
Are you able to detect how loud the volume ist?

I planed to at first, but the wemos does not have enough pins to monitor all the LEDs. And I wanted a quick and easy solution for this project.

Since I was mostly able to see the box from my couch just being able to control it was fine for me.

Just stumbled upon this and also other projects/reverse engineering efforts. This is a nice approach, but has the potential to damage the console and also doesn’t really provide more comfort than simply attaching a IR Led to the D1 Mini and sending commands that way.

Other approaches are simply man-in-the-middling the serial interface to the amplifier, however so far I haven’t found anything “ready to use” for ESPs and implementing it into Home Assistant as example. The protocol seems to have been reverse engineered almost entirely already, but I’m not a programmer to implement this correctly :frowning: