Desktop Remote Volume Control

As part of my current setup I have a linux Desktop (debian) computer as one of the sources that I use to drive music throughout my house. The issue with using this desktop is it is located on a different floor to where most of the daily activities take place. If the phone rings, or someone is at the door, or a song comes on that I want to turn up, until now I have not had the ability to control this remote computer.
Well… necessity is the mother of invention so I thought I would create an mqtt client that would start when the computer boots and add some volume controls to my lovelace dashboard so I can remotely control the computer audio. This topic is the result of my efforts. I thought there may be some others in the community that could utilize this effort so I have uploaded the necessary files to github here.

This includes all the sensor and lovelace configurations to run this system.
The prerequisites are…
  1. you must have an mqtt broker that the system can utilize.
  2. your system must be running linux
  3. install the necessary pip files paho-mqtt and pyalsaaudio
  4. place the application on your linux based computer and configure it to start when the system loads.
  5. update the program with the ip address and port of your mqtt broker
  6. add the sensor, binary sensor, and lovelace control to your HA system


1 Like

Do you have idea how to change per 30 sec check of the volume status in the py script to listen to volume change events? I am noob programmer and did similar script but I control led strip number of leds on depending on volume. However when I have delay in ms between checking of volume it taking like 10 percent of pi resources. Somebody recomended to listen to events howevere I have no Idea how to do so.

If you are referring to my 30 second polling interval just change this constant on line 12 in the file

delay = 30 # seconds