Hello everybody!
I would like to ask for your help. I want to combine BalenaSound with some smart controls.
My idea is to change the output volume of each of my balenaSound devices based on the information that is sent by my home presence sensors while the application is running. For example, if I am in the living room at the moment, the speaker’s volume in the living room should be at 75% and the bedroom speaker should be muted. But if I go into my bedroom, then the speaker in the living room should get muted and the speaker’s volume in my bedroom should change to 75%.
What do you think? Can I somehow realize this idea? Can you help me in which service’s code I need to make changes to create this kind of control?
Initially, the only thing that really interests me is whether I have the ability to change the volume of a device based on changing the input information (which means the presence in this case) while the application is running.
Thanks a lot for your answers!
Hi @milu15,
Welcome to the forums!
I think you could accomplish what you want by creating something for your phone that interfaces with the snapcast server to manage the clients. Take a look at the snapcast code and docs: https://github.com/badaix/snapcast. You could either create a service on the balenaSound server that handles translating between your home automation and snapcast, or you could configure your home automation to talk directly to snapcast.
Cheers!
Mark-
Thank you for your suggestion!
Then I am going to examine snapcast more closely. I will let you know later how the process is going and maybe I will ask for your further help.
BTW, my first sentence about creating something on your phone is a mis-statement. I meant on your home automation. The idea that this was a phone app got stuck in my head last night for some unknown reason.
Hi again!
It’s okay I think i wouldn’t even be able to create that kind of phone application
Tomorrow I will check Snapcast code. Maybe I need to look for the solution in this document: https://github.com/badaix/snapcast/blob/master/control/setVolume.py
Now I would like to ask anoher question. If there are sensors in my house that can detect the exact location of my phone in my home, am I able to change automatically (without using my phone) the master device while balenaSound is running depending on the in-house position of my phone. For example if I connect to my speakers in my living room, the living room device will be the master device. But if I go into the kitchen with my phone in my pocket then I want the kitchen device to automatically switch to the master device.
Should I control somehow the supervisor with that input information (about which room is my phone located) that is sent by the sensors? Or do you have any idea how i could find a solution for this?
Thank you and sorry for the many curiosities!
I’m not sure it’s necessary to change the server based on where you are, except for the one playback protocol that is not network-based, which is Bluetooth. All the other protocols are WiFi-based, and do not depend on your location, except to be sure you have good WiFi signal. Also, with BT, you can’t move an existing connection between devices without interrupting things. BT would only be able to disconnect from one device, and then connect to the next device. At best, that would be a horrible listening experience.
As for what device is acting as the server, that changes dynamically already. Whatever device you connect to becomes the server (after a few seconds), except for some older devices that do not have the compute resources to run as a server. The sound-supervisor container is what controls what device is known as the server across the fleet. Creating a playback connection on any protocol and on any device will trigger a quick reconfig of all the other devices to use the new server.