Skip to content

Home Assistant and Bluetooth speakers (based on the Xiaomi Mi Compact BLE Speaker 2 XMYX02YM)

Notifications You must be signed in to change notification settings

adrgumula/HomeAssitantBluetoothSpeaker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 

Repository files navigation

The goal of this tutorial is to pair arbitrary bluetooth speaker with the Home Assistant (HASSO) to be able to hear notifications & Text-To-Speach (TTS)

What was used during the installation:

Proxmox server

I. Connection:

  1. Identify your BT speaker's BT MAC Address & BT Name
  2. Make sure that Proxmox’s HomeAssistant VM has an Audio device added (for example: device=intel-hda, driver=none)
  3. Install SSH add-on into the HA and configure it
  4. Logging into the HA using terminal: login@IP_Address
  5. Switch off your BT speaker
  6. Type: bluetoothctl
  7. Type: list to list all of your connected BT dongles. You should get the MAC addresses of all your BT dongles
  8. Type: select MAC_ADRESS_DONGLE to select your main one dongle (for example: select 55:44:33:22:11:00)
  9. Type: default-agent to make selected BT-dongle a default connector with your BT devices
  10. Let's start connection & paring with your BT-speaker.
  11. Type: scan on
  12. Turn on your BT speaker & set it to paring mode
  13. Check the console to see if your BT speaker has been detected (look for its name or MAC address). NOTE: Be patient during this process. If the speaker does not appear, try putting it back into pairing mode and checking again.
  14. Type: pair MAC_ADRESS (for example: pair 00:11:22:33:44:55)
  15. Type: trust MAC_ADRESS (for example: trust 00:11:22:33:44:55)
  16. Type: connect MAC_ADRESS (for example: connect 00:11:22:33:44:55)
  17. (in the case of any problems type help for more info)
  18. Check the connected devices using commands: pactl list | grep ".a2dp_sink". Look for something similar to Name: bluez_sink.4C_72_74_XX_XX_XX.a2dp_sink (NOTE: the number represents the MAC address of your BT speaker)
  19. image
  20. Set the newly connected BT device as the default sound output by using following command: pactl set-default-sink NAME_OF_YOUR_BT_SPEAKER_FIND_IN_THE_PREV_STEP
  21. Check whether the output-audio is not muted, nor volume set to zero, by Mute: (should be no) and Volume:, should be front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB by using following commend: pactl list sinks | grep "Mute:" and pactl list sinks | grep "Volume:"
  22. Type ha audio reload and wait for Command completed successfully message on the terminal
  23. At this point your BT should be connected to your HA
  24. Type: exit

II. Installing required add-ons & integrations

  1. Goto HA and install Settings -> Add-in VLC Local
  2. Goto VLC Local -> Configuration
  3. Set the Telnet Password and Http Password (you can use the default mypasswrd as well)
  4. Change the Audio-Output to the corresponding BT Name (it's the same obtained at I.1 point)
  5. image
  6. Go back to VLC-Local Info tab and enable Auto-Start option
  7. Get back to Info tab hit Start
  8. Go to HA Settings -> Devices & Services (Integrations) and Add New Integration
  9. Search for VLC LAN select it and pick-up Local VLC Media player via Telnet
  10. Enter the password Telnet Password and click Submit
  11. NOTE: in case when VM with HA restarts & or BT device shutdowns power on the dev (XMYX02YM should say "Connected" after a few seconds) and go to section I.12 and II.4 points, and start VLC Local back again

III. Testing (Audio files)

  1. Go to Developers Tools and Services and enter followings :
  2. Service or Actions : Media player: Play media
  3. Target: Search for VLC and select your one
  4. Content type: music
  5. Content ID: /local/your.mp3 (files your.mp3 should be located at the /local/www/ folder of your HA installation)
  6. Press Call-Service or Perform the action
    image

III. Testing (TTS - Text to speach)

  1. Go to Developers Tools and go to Actions or Services and enter followings :
  2. Service or Actions: type TTS and select one of your favourite (or default) one Text-To-Speach (for the porpouse of this tutoral I used gogole with google translate
image
  1. Target or entity_id: Search for VLC and select your one
  2. Message: type anything you want to be converted to speach
  3. Press Call-Service or Perform the action
    image

About

Home Assistant and Bluetooth speakers (based on the Xiaomi Mi Compact BLE Speaker 2 XMYX02YM)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published