Home assistant bluetooth audio

Bluesound

The bluesound platform allows you to control your Bluesound HiFi wireless speakers and audio integrations from Home Assistant.

To manually add a Bluesound device to your installation, add the following to your configuration.yaml file:

# Example configuration.yaml media_player: - platform: bluesound hosts: - host: 192.168.1.100 

Configuration Variables

List with your Bluesound devices.

The IP address or hostname of the player.

The name of the device used in the frontend.

The port to communicate with the device.

Advanced configuration example

# Example configuration.yaml entry with manually specified addresses media_player: - platform: bluesound hosts: - host: 192.168.1.100 name: bluesound_kitchen port: 11000 - host: 192.168.1.131 

Service bluesound.join

Group players together under a single master speaker. That will make a new group or join an existing group.

Service data attribute Optional Description
master no A single entity_id that will become/hold the master speaker.
entity_id no String or list of a single entity_id that will group to master speaker.

Service bluesound.unjoin

Remove one or more speakers from a group of speakers. If no entity_id is provided, all speakers are unjoined.

Service data attribute Optional Description
entity_id yes String or list of entity_id s that will be separated from their master speaker.

Service bluesound.set_sleep_timer

Sets a timer that will turn off the speaker. For each time you call this it will increase the time by one step. The steps are (in minutes): 15, 30, 45, 60, 90, 0. If you increase an ongoing timer of for example 13 minutes, it will increase it to 15. If the timer is set to 90, it will remove the time (hence the 0).

Service data attribute Optional Description
entity_id no String or list of entity_id s that will have their timers set.

Service bluesound.clear_sleep_timer

Clear the sleep timer on a speaker, if one is set.

Service data attribute Optional Description
entity_id no String or list of entity_id s that will have their timers cleared.

Help us to improve our documentation

The Bluesound integration was introduced in Home Assistant 0.51, and it’s used by 262 active installations. Its IoT class is Local Polling.

Читайте также:  Гарнитура через блютуз адаптер

Categories

On this page

Источник

Home Assistant Bluetooth Speaker

Video unboxing the Xiaomi Motion sensor and adding it to HA, along with pairing and using a Bluetooth speaker!

Posted on: 2021-02-25 Last updated on: 2021-02-25 Written by: Mark Lewis Comments: 28 Categorised in: Smart Home

So there are two things I want to cover in this post. First, I have done a second unboxing video which can be found below. Felt this was slightly better than the first. Will just keep practicing, putting myself out there and hopefully getting more comfortable with this sort of thing.

Secondly, I have managed to get Home Assistant working with a Bluetooth speaker. Why you might ask, well, I had one sat doing nothing and thought it would be nice to announce stuff (like door open, play a doorbell sound etc). At the moment, I do not have an Echo or Google speaker to make us of so this is the next best thing. Anyway, please watch the video below. I am working on my presentation skills.

When logged in, at the ha prompt, type login to get to the shell prompt

I can’t screen grab the following as it’s all already done but I used the following commands from the above post:

bluetoothctl # note no SUDO available on HA VM list # Controller XXXXXX mydevice [default] power on agent on default-agent scan on # [NEW] Device AA:BB:CC:DD:EE:FF XYZ # Now I Press the pairing button on the device (disabling bluetooth on any nearby devices) pair AA:BB:CC:DD:EE:FF connect AA:BB:CC:DD:EE:FF trust AA:BB:CC:DD:EE:FF exit

At this point my speaker was paired to my HA VM. Winning! Except it wasn’t. I tried doing the du command and it couldn’t find a working asound.conf file. The ones thrown up were generated as part of the Docker processes and were empty. I eventually managed to find the file at

/mnt/data/supervisor/audio/asound

Note: the file name is “asound” not asound.conf or anything like that. I made a backup of the file (mv command) and then I edited the contents as follows using “vi”

So that you can copy/paste the code is below:

pcm.!default < type plug slave.pcm "btreceiver" >pcm.btreceiver < type plug slave < pcm < type bluealsa device AA:BB:CC:DD:EE:FF profile "a2dp" >> hint < show on description "MD-12" >> ctl.!default

At this point the speaker is paired to the VM and the VM is configured to use this as an output for sound. I gave HA a reboot at this point to see if anything would be discovered. Not surprisingly it was nada. This is where I ended up getting a little more creative. I added the “Local VLC” community Add-on. Once installed, I provided a telnet and HTTP password. I was also able to select MD-12 from the output devices (for some reason this isn’t shown below)

Читайте также:  Драйвер bluetooth ноутбука samsung

I logged in to the http interface and was able to play a MP3 file (homed in the share directory)! Now we are winning! So how do we use it within Home Assistant? Well, HA has a built in VLC Telnet client, so I added the following to my config.yaml file:

media_player: platform: vlc_telnet name: Local MD-12 host: 127.0.0.1 password: HA HA yeah right

Of course, give HA a restart, look through the Entities and you will findone called “Local MD-12” which is a media player! I added a Love Lace card for it and when clicking the 3 dots I can enter “Text to speak” and sure enough that text is read out via the BT speaker

It’s not perfect, I think I need to do some bash scripting on the host to make sure the speaker remains connected and doesn’t go to sleep. I also think it needs a script to connect at start (probably the same script). Something else that needs a little work is that the range doesn’t quite reach to where I want to place the speaker. Somewhere in my box of cables is a USB extension lead that I will dig out so that the BT adapter is then outside of the rack.

Источник

Home assistant bluetooth audio

First of all, I want to thank you guys, most of the Bluetooth speakers are connected according toConnecting Raspberry Pi to Tmall Elf Bluetooth Speaker-Chapter 1 This tutorial is done, but if you copy it during the process, some parameters will not be executed, such as HCI=hci0 This stuff, secondly, it seems that I don’t need to write a startup timing script and can automatically connect to Bluetooth speakers.

Tutorial list

Home Assistant build log (1)-install Raspberry Pi system
Home Assistant Build Log (2)-Configure Raspberry Pi System
Home Assistant build log (three)-install and start Home Assistant
Home Assistant Construction Log (4)-Accessing Home Assistant from the Internet
Home Assistant build log (5)-let the Bluetooth speaker sing
Home Assistant build log (6)-MPD player

1. Install bluealsa

I use bluetooth speakers to play music based on bluealsa I feel that it is relatively simple to use this method, and there is no pitfall.
This version also seems to come with bluealsa , So install if prompted bluealsa is already the newest version (0.13). If so, you can go directly to step 2.

sudo apt-get install bluealsa 

2. Connect Bluetooth speakers

Open the Bluetooth tool
Turn on Bluetooth scanning

will scan a bunch of Bluetooth devices and find your own Bluetooth speaker. For example, the one marked in red is my speaker:

[CHG] Device 4D:B8:6A:17:1A:74 RSSI: -62
[CHG] Device F0:59:BC:38:A9:0E RSSI: -97
[CHG] Device 38:E6:0A:3B:38:78 RSSI: -88
[NEW] Device 11:58:02:B8:02:54 HAVIT M8
[CHG] Device 38:F9:D3:8A:C6:4B RSSI: -72
[CHG] Device 4D:B8:6A:17:1A:74 ManufacturerData Key: 0x004c
[CHG] Device 4D:B8:6A:17:1A:74 ManufacturerData Value: 0c 0e 08 7f c9 11 8d ca b7 cd 5c e8 e8 26 86 6d …&.m
[CHG] Device 67:2A:0A:5F:79:44 RSSI: -46

Trust and connect Bluetooth speakers
trust 11:58:02:B8:02:54 (-This is the MAC address of the Bluetooth device, scanned above) 

At this time, the Bluetooth speaker can be connected automatically. If it is not connected, just use the connection command to connect.

Test whether the Bluetooth speaker can play music
aplay -D bluealsa:DEV=Bluetooth device mac address, modify by yourself, PROFILE=A2DP test.wav 

3. Set bluealsa as the default playback plugin

New/Edit configuration file

You’re done here, you don’t need to restart, you can use commands directly aplay test.wav You can play music through the Bluetooth speaker. After restarting, the Raspberry Pi will alsoAutomatically connect to Bluetooth speakers. Of course, I occasionally tried to restart. I disconnected the Bluetooth speaker for a long time and lost it. After restarting, I did not connect to the speaker. It felt that it was a problem with the speaker. It may enter the power saving mode. The Bluetooth speaker is automatically connected.

Источник

Оцените статью
Adblock
detector