Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: on pi, possibility to change the audio output as well as use bl… #436

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

lvmasterrj
Copy link
Contributor

I've created the possibility for a pi user, without access to the user interface, to change the oudio output from hdmi, headphone and bluetooth, as well as the possibility to scan and pair to bluetooth devices.

For it to work, it need the PipeWire with Wireplumber

sudo apt install pipewire pipewire-pulse pipewire-jack pipewire-alsa pipewire-audio -y

I created two files in the lib folder audio_devices.py and bluetooth.py.

  • audio devices.py is the file responsible for getting the possible output audio devices, to connect to them and to increase and decrease their volumes. It uses wpctl from wireplumber.

  • bluetooth.py is the file that manages bluetooth devices. It can scan for bt devices, connect and remove. It uses bluetoothctl to do the job. When the script pair to a devices it stores the device in a file called btdevices.txt inside the lib folder. Those are the devices that the system will automatically connect to when it finds it.

The user interface to work with these scripts are in the info.html.

I also created a function inside the get_platform.py to check if the pipewire is installed, if not it doesn't run these scripts.

One more thing: mainly because of the bluetooth scan, that takes some time, I've made it assyncronous so that the info page loads rigth away while this part is still loading and is updated when finished.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant