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
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