balena-io-experimental / balena-sound

Build a single or multi-room streamer for an existing audio device using a Raspberry Pi! Supports Bluetooth, Airplay and Spotify Connect
https://balena.io/blog/turn-your-old-speakers-or-hi-fi-into-bluetooth-receivers-using-only-a-raspberry-pi/
MIT License
2.43k stars 431 forks source link

HomeAssistant integration #260

Open tmigone opened 4 years ago

tmigone commented 4 years ago

Consider adding homeassistant integration.

DenielTorres commented 3 years ago

Hi @tmigone! Any update on this enhancement? I'm about to install a couple of in-wall speakers around the house with balena sound and would be awesome to somehow integrate these into HA. Maybe as media players?

Thanks in advance! Daniel

drew1kun commented 3 years ago

Yeah, would be great! I came across this request hoping to find any way to integrate it into my HA.

FlyersPh9 commented 3 years ago

Also would like to integrate my Balena Sound into Home Assistant.

sloetr commented 3 years ago

Balena Sounds apparently uses Snapcast to enable the multi room audio. Snapcast can be integrated in Home Assistant (https://www.home-assistant.io/integrations/snapcast/).

In my setup I created a host device with Balena Sound. On every client device I installed Snapclients (https://github.com/badaix/snapcast), but Balena Sound clients should also work. This should give you a working multi room audio system.

Each device (host and/or clients) can then be added in the configuration.yaml of Home Assistant:

media_player:
  - platform: snapcast
    host: 192.168.2.6

After a restart, Snapclient devices should appear in your entities list. The devices can then be used in a lovelace dashboard or Node Red for further integration.

I hope this is (a part of) the functionality you are looking for!

Sn1cket commented 2 weeks ago

I really would like to see a Home Assistant integration because my Balena Sound instance is running in standalone mode so the Snapcast integration isn't an option.

My main use case would be to have the player status in Home Assistant to use it for some automations.

eataiwo commented 2 weeks ago

@Sn1cket I am not an expert, and I stopped using BalenaSound about a year ago, but looking quickly through the BalenaSound documentation, it doesn't seem as if there is a simple way to get the player's status. Maybe if you are able to read the logs from the sound supervisor or audioblock service, but then you would need a way to send that to HA, and as far as I know BalenaSound doesn't have an API so you would have to set that up after the fact with some custom script on your device, alternatively it's possible to modify the relevant docker files for BalenaSound and deploy that, however again I am not an expert so take what I say with a pinch of salt. Depending on your usecase, you can do a workaround. For example, I mainly only used Spotify, so I ran automation using the Spotify integration in HA to turn on my speakers if Spotify was playing via my BalenaSound device, which Spotify could see.

All in all, I do not see a HA integration happening anytime soon unless someone is willing to put together some HACS integration

Sn1cket commented 2 weeks ago

Yeah, I already had a similar assumption and I looked for alternatives. So far I think I will probably move to moode audio player. It seems like it supports everything I need (BT Audio + API). Their API can be used to integrate into Home Assistant with the RESTful and MPD integration.

eataiwo commented 2 weeks ago

@Sn1cket Yes, I moved to Moode Audio as well, and I was pretty happy with it. I haven't done any "direct" integration with Moode and HA yet. I knew it was possible but not plug and play, so I haven't had the time to figure it out. I still just use the Spotify integration, but I wish you luck.