Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95919

Bluetooth speaker

$
0
0

@goosst wrote:

Hello

A question about getting connected to a bluetooth speaker.
My idea was to run a python script and play some music at specific events.

I’ve installed home assistant in a virtual environment (so not the docker setup):

  • armbian buster running on a tinkerboard
  • additional bluetooth usb-dongle

Through my “normal” account I can connect to my bluetooth speaker and play music from the command line (using command cvlc --no-video test.mp3). Doing similar commands in a python way also works.
i.e. this code below works:

xxx@tinkerboard:~$ bluetoothctl
Agent registered
[bluetooth]# power off
Changing power off succeeded
[bluetooth]# power on
[CHG] Controller 00:1A:7D:DA:71:14 Class: 0x000c0000
Changing power on succeeded
[CHG] Controller 00:1A:7D:DA:71:14 Powered: yes
[bluetooth]# connect 94:E3:6D:61:59:72
Attempting to connect to 94:E3:6D:61:59:72
[CHG] Device 94:E3:6D:61:59:72 Connected: yes
Connection successful
[CHG] Device 94:E3:6D:61:59:72 ServicesResolved: yes
[Living Room Bluetooth]# power off
[CHG] Device 94:E3:6D:61:59:72 ServicesResolved: no
[CHG] Device 94:E3:6D:61:59:72 Connected: no
Changing power off succeeded
[CHG] Controller 00:1A:7D:DA:71:14 Powered: no
[CHG] Controller 00:1A:7D:DA:71:14 Discovering: no
[CHG] Controller 00:1A:7D:DA:71:14 Class: 0x00000000
[bluetooth]# quit

Unfortunately this doesn’t work when I move to the homeassistant virtual environment:

  • the bluetoothctl command already hangs and needs to be interrupted with ctrl+c to move forward
  • no (bluetooth) controller gets detected
  • homeassistant user has been added to the group via sudo adduser homeassistant bluetooth
@tinkerboard:~$ sudo -u homeassistant -H -s
homeassistant@tinkerboard:/home/xxx$ source /srv/homeassistant/bin/activate
(homeassistant) homeassistant@tinkerboard:/home/xxx$ bluetoothctl

[bluetooth]# power on
No default controller available
[bluetooth]# agent on
Agent registration enabled
[bluetooth]# default-agent
No agent is registered
[bluetooth]# devices
No default controller available

Do you have any suggestions how to get this resolved?

Thanks!

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 95919

Trending Articles