TTS on Bluetooth speaker via Raspberry Pi

di someone already try to get this running with intel NUC ?

Thanks at this point I’ve abandoned this my TTS Polly service never went through the Bluetooth. Either did the mplayer commands.

What helped me to finally get this working on Raspbian Stretch is this:

  1. Make sure your bluetooth device is paired successfully

  2. Enable a2dp sink in pulse audio

pactl list cards short
0       alsa_card.platform-soc_audio    module-alsa-card.c
1       bluez_card.xx_xx_xx_xx_xx_xx    module-bluez5-device.c

# Grab the card number and enable a2dp sink
pactl set-card-profile 1 a2dp_sink
  1. Set this sink as default
pactl set-default-sink bluez_sink.xx_xx_xx_xx_xx_xx.a2dp_sink
  1. Now address the device with the .a2dp_sink suffix in the bluetooth tts script

Hope it helps someone else.

@oakbrad did you ever get this to work?

1 Like

Any chances for an update? Seems this component relies on HA but there was a breaking change in 0.76

I’m not sure exactly what you want to do with this but you might want to check out the following and see if it meets your needs:

How is it related?
pkozul wrote a great component that uses Bluetooth speakers for tts. It has nothing to do with alexa.

Read the reply from freekeys. They were asking about tts on echo. I might have misunderstood what you were asking about. If I did then ignore my post.

Hi All,

I am nowhere close to getting the Bluetooth speaker added, I just came close to detecting the Bluetooth device in known devices.yaml. I want to use the bluetooth speaker for google home sdk on hassio.

The instructions provided requires a hassbian os, i am directly running my hassio on the raspberry 3 B+. Any addons that can help me with in setting this up ?

Bluetooth device: Zoook Jazz Blaster 30W Bluetooth Speakers (with mic)

Perhaps this can help?

Thank Yuran, but i am not able to use “Sudo” command on ssh

Any other alternative tried apt-get and apt. These commands are not supporting hassio environment.

Hi friend,
very interesting guide. You are awesome!
I followed the guide and was able to configure my low-cost bluetooth speakers, visible on home assistant (media_player.tts_bluetooth_speaker).
This a month ago. Now after updating home assistant (my version was very old 52.0) at the current 81.6 improvisation I no longer see the add-on and I have the following error: Error doing job: Task exception was never retrieved
File “/home/homeassistant/.homeassistant/custom_components/media_player/tts_bluetooth_speaker.py”, line 183, in <module>
self._is_standby = True
NameError: name ‘self’ is not defined
I enclose the complete log.

Error doing job: Task exception was never retrieved

Traceback (most recent call last):
File "/usr/lib/python3.5/asyncio/tasks.py", line 241, in _step
result = coro.throw(exc)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/setup.py", line 56, in async_setup_component
return await task  # type: ignore
File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
yield self  # This tells Task to wait for completion.
File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
future.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
raise self._exception
File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
result = coro.send(None)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/config_entries.py",  line 444, in async_forward_entry_setup
self.hass, component, self._hass_config)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/setup.py", line 45, in async_setup_component
return await setup_tasks[domain]  # type: ignore
File "/usr/lib/python3.5/asyncio/futures.py", line 382, in __iter__
return self.result()  # May raise too.
File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
raise self._exception
File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
result = coro.send(None)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/setup.py", line 118, in _async_setup_component
conf_util.async_process_component_config(hass, config, domain)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/config.py", line 760, in async_process_component_config
platform = get_platform(hass, domain, p_name)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/loader.py", line 60, in get_platform
return get_component(hass, PLATFORM_FORMAT.format(domain, platform))
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/loader.py", line 92, in get_component
module = importlib.import_module(path)
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 673, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/home/homeassistant/.homeassistant/custom_components/media_player/tts_bluetooth_speaker.py", line 183, in <module>
self._is_standby = True
NameError: name 'self' is not defined

Until a month ago everything worked now no more and I just updated homeassistant.
Please help

i think so, updating ha to last version (later 0.76) the component not work. do you have find solution?

I have the same issue. Did you ever find a solution?

I didn’t use bluetooth speaker anymore. I use 3.5 mm jack through rp3.
My problem is it cannot connect bluetooth automatically when I restart ha or rp3.

Hi all.

On 93.1 I get the following error:

[homeassistant.helpers.config_validation] Your configuration contains extra keys that the platform does not support.
Please remove [address].  (See /home/homeassistant/.homeassistant/configuration.yaml, line 325). 
Offending data: {"platform": "tts_bluetooth_speaker", "address": "07:52:41:A5:72:73"}

Thanks for any clue…

From HA 0.95 this component doesn’t work anymore.
Same error, but this time blocks the component from loading at sturtup.
Got this persistent notification:

title: Invalid config
message: The following components and platforms could not be set up:

 - [media-player.tts-bluetooth-speaker](https://home-assistant.io/components/media_player.tts_bluetooth_speaker/)

From your previous post it indicates that you had invalid items that needed removing, From 0.95 it no longer gives warning but errors. You need to fix that.

https://www.home-assistant.io/blog/2019/06/26/release-95/#noteworthy-breaking-changes

Hi and thanks for reply.
To adapt the source code in order to be compatible with HA0.95 is not in my possibility.
I guess that for someone proficient in custom components design this task could be quite easy.
Anyone??
Thanks anyway!!

ps I contacted the author, this component will not be anymore updated.

Are there any alternatives to this?!
This was a great component

Maybe @pkozul will have a chance to adopt the code?