- Platform information:
- Hardware: CPUArchitecture/RAM/storage Raspberry PI 4 with 2 GB
- OS: what OS is used and which version OH 3 OpenHabian
- Java Runtime Environment: which java platform is used and what version
- openHAB version: 3.2
- Issue of the topic : I’m not able to have bluetooth discovering bluetooth devices in the suroundings.
**Below the few commands I executed in the bluetoothctl tool **
Any clue on what’s wrong here ???
THANKS !
[bluetooth]# show
Controller E4:5F:01:98:72:52 (public)
Name: openhabian
Alias: openhabian
Class: 0x002c0000
Powered: yes
Discoverable: no
DiscoverableTimeout: 0x000000b4
Pairable: yes
UUID: A/V Remote Control (0000110e-0000-1000-8000-00805f9b34fb)
UUID: Audio Source (0000110a-0000-1000-8000-00805f9b34fb)
UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb)
UUID: Audio Sink (0000110b-0000-1000-8000-00805f9b34fb)
UUID: Headset (00001108-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
UUID: Device Information (0000180a-0000-1000-8000-00805f9b34fb)
UUID: Headset AG (00001112-0000-1000-8000-00805f9b34fb)
Modalias: usb:v1D6Bp0246d0537
Discovering: yes
Roles: central
Roles: peripheral
Advertising Features:
ActiveInstances: 0x00 (0)
SupportedInstances: 0x05 (5)
SupportedIncludes: tx-power
SupportedIncludes: appearance
SupportedIncludes: local-name
[bluetooth]# devices
Device 60:64:05:BE:F9:AF VEMITER-2
[bluetooth]# list
Controller E4:5F:01:98:72:52 openhabian [default]
[bluetooth]# version
Version 5.55
[CHG] Device 60:64:05:BE:F9:AF RSSI: -93
[CHG] Device 60:64:05:BE:F9:AF RSSI: -85
[bluetooth]# exit
Did you scan for bluetooth devices
bluetooth]# scan on
Discovery started
[CHG] Controller E3:5E:02:27:8C:98 Discovering: yes
[NEW] Device FF:6E:57:89:AA:BE N00GH
[NEW] Device DA:71:D5:00:1B:17 N00G9
[NEW] Device 66:AD:2F:15:5E:92 67-AD-2F-15-4E-92
Bingo ! Works indeed.
Sorry for such basic question …
1 Like
Hello - I need some help setting up my Bluetooth speaker
I am on Pi3 model B with openhabian and OH3 installed.
Current setup is I play an mp3 file at specific times of the day based on a rule. I have a speaker set connected to pi through the audio jack. Everything works as expected.
I would love to replace the speaker set with a Bluetooth one I have but I am not sure how to get started.
Good news is when I SSH to my pi and run the below command,
hcitool scan
it returns the MAC address and name of my Bluetooth speaker but I don’t know how to connect to it. Don’t know how to tell openhabian to connect to the speaker and from there how to tell Openhab to output the sound through the speaker
Appreciate the help
ok made some progress using the bluetoothctl tool. I paired the speaker device successfully. But when I try to connect to it I get a bizarre error. Any advice?
openhabian@openhabian:~ $ bluetoothctl pair 77:36:37:8C:59:71
Attempting to pair with 77:36:37:8C:59:71
[CHG] Device 77:36:37:8C:59:71 Connected: yes
[CHG] Device 77:36:37:8C:59:71 Modalias: bluetooth:v05D6p000Ad0240
[CHG] Device 77:36:37:8C:59:71 UUIDs: 00001101-0000-1000-8000-00805f9b34fb
[CHG] Device 77:36:37:8C:59:71 UUIDs: 0000110b-0000-1000-8000-00805f9b34fb
[CHG] Device 77:36:37:8C:59:71 UUIDs: 0000110c-0000-1000-8000-00805f9b34fb
[CHG] Device 77:36:37:8C:59:71 UUIDs: 0000110e-0000-1000-8000-00805f9b34fb
[CHG] Device 77:36:37:8C:59:71 UUIDs: 0000111e-0000-1000-8000-00805f9b34fb
[CHG] Device 77:36:37:8C:59:71 UUIDs: 00001200-0000-1000-8000-00805f9b34fb
[CHG] Device 77:36:37:8C:59:71 ServicesResolved: yes
[CHG] Device 77:36:37:8C:59:71 Paired: yes
Pairing successful
openhabian@openhabian:~ $ bluetoothctl connect 77:36:37:8C:59:71
Attempting to connect to 77:36:37:8C:59:71
Failed to connect: org.bluez.Error.Failed
openhabian@openhabian:~ $ bluetoothctl info 77:36:37:8C:59:71
Device 77:36:37:8C:59:71 (public)
Name: ARIA
Alias: ARIA
Class: 0x00340404
Icon: audio-card
Paired: yes
Trusted: yes
Blocked: no
Connected: no
LegacyPairing: no
UUID: Serial Port (00001101-0000-1000-8000-00805f9b34fb)
UUID: Audio Sink (0000110b-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control (0000110e-0000-1000-8000-00805f9b34fb)
UUID: Handsfree (0000111e-0000-1000-8000-00805f9b34fb)
UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb)
Modalias: bluetooth:v05D6p000Ad0240
ManufacturerData Key: 0x5754
ManufacturerData Value:
53 4a 4c aa 58
Searching for
at the end led me to
I did not try that one so I can’t say anything about cons if there are any.
ok I installed Pulseaudio and now I have the speaker connected
openhabian@openhabian:/lib/udev $ bluetoothctl info 77:36:37:8C:59:71
Device 77:36:37:8C:59:71 (public)
Name: ARIA
Alias: ARIA
Class: 0x00340404
Icon: audio-card
Paired: yes
Trusted: yes
Blocked: no
Connected: yes
LegacyPairing: no
UUID: Serial Port (00001101-0000-1000-8000-00805f9b34fb)
UUID: Audio Sink (0000110b-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control (0000110e-0000-1000-8000-00805f9b34fb)
UUID: Handsfree (0000111e-0000-1000-8000-00805f9b34fb)
UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb)
Modalias: bluetooth:v05D6p000Ad0240
ManufacturerData Key: 0x5754
ManufacturerData Value:
53 4a 4c aa 58 SJL.X
Final step is which audio sink to use? I wrote a simple rule to play the doorbell.mp3 but I don’t hear anything. when I reconnect my old speakers through the audio jack I can hear so the rule is correct…
1 Like
I ran the below command
pacmd list-sinks
and I see that my default sink is correctly assigned to my bluetooth speaker yet I cant hear anything
2 sink(s) available.
index: 0
name: <alsa_output.platform-bcm2835_audio.analog-stereo>
driver: <module-alsa-card.c>
flags: HARDWARE DECIBEL_VOLUME LATENCY FLAT_VOLUME
state: IDLE
suspend cause: (none)
priority: 9009
volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB
balance 0.00
base volume: 65536 / 100% / 0.00 dB
volume steps: 65537
muted: no
current latency: 50.64 ms
max request: 10 KiB
max rewind: 10 KiB
monitor source: 0
sample spec: s16le 2ch 44100Hz
channel map: front-left,front-right
Stereo
used by: 0
linked by: 0
fixed latency: 59.95 ms
card: 0 <alsa_card.platform-bcm2835_audio>
module: 6
properties:
alsa.resolution_bits = "16"
device.api = "alsa"
device.class = "sound"
alsa.class = "generic"
alsa.subclass = "generic-mix"
alsa.name = "bcm2835 Headphones"
alsa.id = "bcm2835 Headphones"
alsa.subdevice = "0"
alsa.subdevice_name = "subdevice #0"
alsa.device = "0"
alsa.card = "0"
alsa.card_name = "bcm2835 Headphones"
alsa.long_card_name = "bcm2835 Headphones"
alsa.driver_name = "snd_bcm2835"
device.bus_path = "platform-bcm2835_audio"
sysfs.path = "/devices/platform/soc/3f00b840.mailbox/bcm2835_audio/sound/card0"
device.form_factor = "internal"
device.string = "hw:0"
device.buffering.buffer_size = "10576"
device.buffering.fragment_size = "2640"
device.access_mode = "mmap"
device.profile.name = "analog-stereo"
device.profile.description = "Analog Stereo"
device.description = "Built-in Audio Analog Stereo"
alsa.mixer_name = "Broadcom Mixer"
module-udev-detect.discovered = "1"
device.icon_name = "audio-card"
ports:
analog-output: Analog Output (priority 9900, latency offset 0 usec, available: unknown)
properties:
active port: <analog-output>
* index: 1
name: <bluez_sink.77_36_37_8C_59_71.a2dp_sink>
driver: <module-bluez5-device.c>
flags: HARDWARE DECIBEL_VOLUME LATENCY FLAT_VOLUME
state: IDLE
suspend cause: (none)
priority: 9050
volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB
balance 0.00
base volume: 65536 / 100% / 0.00 dB
volume steps: 65537
muted: no
current latency: 39.57 ms
max request: 2 KiB
max rewind: 0 KiB
monitor source: 1
sample spec: s16le 2ch 44100Hz
channel map: front-left,front-right
Stereo
used by: 0
linked by: 0
fixed latency: 39.51 ms
card: 1 <bluez_card.77_36_37_8C_59_71>
module: 22
properties:
bluetooth.protocol = "a2dp_sink"
device.description = "ARIA"
device.string = "77:36:37:8C:59:71"
device.api = "bluez"
device.class = "sound"
device.bus = "bluetooth"
device.form_factor = "headset"
bluez.path = "/org/bluez/hci0/dev_77_36_37_8C_59_71"
bluez.class = "0x340404"
bluez.alias = "ARIA"
device.icon_name = "audio-headset-bluetooth"
device.intended_roles = "phone"
ports:
headset-output: Headset (priority 0, latency offset 0 usec, available: yes)
properties:
active port: <headset-output>
ok more updates on this. I installed mpg123 and tested the doorbell.mp3 running the below command
mpg123 doorbell.mp3
It runs correctly and I can hear the sound through the blouetooth speaker.
Now the question is how do I select this default sink in Openhab. See rule below - but I still can’t hear the doorbell
I assume that you require the pulse audio binding for this to select the sink from within the openhab UI.
Alternatively you could use executeCommandLine to run your command line to play the sound.
@Wolfgang_S thank you for your feedback. I will start with the command line because I know that the below one works when I ssh to my system. I can hear the sound.
mpg123 -f 2000 /etc/openhab/sounds/doorbell.mp3
So I tried to recreate through a rule and I installed the Exec binding (screenshot below for the “Thing”, “Channel”, “Item”, and “Rule”. I would love the leverage the interface as much as possible. When I run the rule no sound - I am close but something is still off. BTW the log doesn’t show any errors. Item is switching state as expected it just the sound isnt coming through…
Ok more updates on this never ending quest for the answer
when I run this command I hear sound
openhabian@openhabian:$ mpg123 -f 2000 /etc/openhab/sounds/doorbell.mp3
But, when I run this command I don’t hear anything and no error is given meaning the group openhab does have read write access to the mp3 file
openhabian@openhabian:$ sudo -u openhab mpg123 -f 2000 /etc/openhab/sounds/doorbell.mp3
According to this page - its the openhab user that needs to run the command so how do I give the user access to run the mpg123 command?