Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration tts_bluetooth_speaker not found with more recent home assistant core versions #19

Open
miikama opened this issue Mar 6, 2022 · 8 comments

Comments

@miikama
Copy link

miikama commented Mar 6, 2022

I have hass version 2022.3.1

I had some issues when adding the tts_bluetooth_speaker as a custom component. I manually added the component into the configuration.yaml as

media_player:
  - platform: "tts_bluetooth_speaker"
    address: "CC:CC:CC:CC:CC:CC"
    volume: 0.45

After adding, and checking the configuration

(env) homeassistant@raspberrypi:~/.homeassistant $ hass --script check_config
Testing configuration at /home/homeassistant/.homeassistant
Failed config
  General Errors: 
    - Platform error media_player.tts_bluetooth_speaker - Integration 'tts_bluetooth_speaker' not found.

The component should be at the correct location

(env) homeassistant@raspberrypi:~/.homeassistant $ ls /home/homeassistant/.homeassistant/custom_components/tts_bluetooth_speaker/
__init__.py  manifest.json  media_player.py

It seems that more recent hass versions require a version key in the custom component manifest.json file.

See e.g. https://community.home-assistant.io/t/no-version-key-in-the-manifest-file-for-custom-integration-environment-canada/311313/7

{
    "domain": "tts_bluetooth_speaker",
    "name": "BT Speaker",
    "documentation": "https://github.com/pkozul/ha-tts-bluetooth-speaker",
    "dependencies": [],
    "codeowners": ["@pkozul"],
-   "requirements": []
+   "requirements": [],
+   "version": "0.0.0"
}

Also, the class MediaPlayerDevice has been renamed to MediaPlayerEntity. See https://community.home-assistant.io/t/media-player-not-working-after-upgrading-to-2022-2-6/391841.

Thetts_bluetooth_speaker component can be loaded after updating the file media_player.py

from homeassistant.components.media_player import (
    SUPPORT_PLAY_MEDIA,
    SUPPORT_VOLUME_SET,
    PLATFORM_SCHEMA,
-    MediaPlayerDevice)
+    MediaPlayerEntity)

-class BluetoothSpeakerDevice(MediaPlayerDevice):
+class BluetoothSpeakerDevice(MediaPlayerEntity):
@archit3kt
Copy link

Thanks @miikama for the detailed message, I was able to add tts_bluetooth thanks to you !

But when testing with the service Text-to-speech (TTS): Say an TTS message with google_translate, no sound is outputting... Is it working for you ?

I can output audio from my BT speaker with the mplayer -ao pulse::bluez_sink command, so the device is behaving correctly on the Debian host

Thanks for the help you already provided and maybe the help you could provide :)

@miikama
Copy link
Author

miikama commented Mar 17, 2022

The module seems to use two command line utilities, mplayer and sox. Do you also have sox installed? (I didn't because I skipped some instruction steps).

Which environment are you running the homeassistant on? Is it the docker container, the home assistant operating system on raspberry pi, or the home assistant installed in a python virtual environment? I am running it from a Python virtual environment so it is not containerized. If you are running it in a container, can you also run the mplayer command inside the container successfully?

@miikama
Copy link
Author

miikama commented Mar 17, 2022

And to answer your question @archit3kt , I am actually able to use the TTS to output speech from the speaker :)

@archit3kt
Copy link

archit3kt commented Mar 17, 2022

I'm running HA in supervised mode on latest Debian 11, to stay in a supported environment !

Indeed the amd64-hassio-audio container, which configure all the audio stuff, wasn't getting the bluetooth conf from the pulseaudio host... I could configure the conf file inside the container to access the bluetooth sink, but the conf would be lost at every reboot.

I went another way and installed mpd on the Debian host, configure it to use the pulseaudio bluez sink on the host, and configure HA in this very simple way :

`media_player:

  • platform: mpd
    host: 127.0.0.1
    `

Now it is workiing like a charm, this page gave me the right instructions to add the BT player on the host, and mpd is doing the rest :)

Thanks for your help, was appreciated !

@elektrinis
Copy link

elektrinis commented May 8, 2022

I'm running HA in supervised mode on latest Debian 11, to stay in a supported environment !

I'm on the same boat, just not as advanced as you.
Would you mind detailing how I can set it up?

I can get audio via bluetooth, but not tts.

@archit3kt
Copy link

Hey @elektrinis, I followed this guide until point 5 included, so bluetooth audio was working on the Debian host.

pactl list sinks is listing correctly : bluez_sink.11_75_58_9D_B7_73.a2dp_sink

I installed mpd and configured /etc/mpd.conf with the following :

audio_output {
type "pulse"
name "My Pulse Output"
sink "bluez_sink.11_75_58_9D_B7_73.a2dp_sink"
}

Ofc enable and start the service, that's all on the Debian part. Connect to your HA instance and add to configuration.yaml :

media_player:

  • platform: mpd
    host: 127.0.0.1

It will connect the mpd HA object to your mpd server on Debian host. You can then use this mpd object to play audio files in HA.

For TTS, don't forget to configure it in the configuration.yaml :

tts:

  • platform: google_translate
    language: en
    cache: true
    cache_dir: /tmp/tts
    time_memory: 300
    base_url: "your external URL FQDN here"
    service_name: google_say

or if you like marytts like me and you run the container to get local voice generation on your debian host :

tts:

  • platform: marytts

Should be working after all this :)

@DivanX10
Copy link

Or as the simplest way to output audio to a bluetooth speaker, this is through the Mopidy addon, where we select a bluetooth speaker from the list as an audio output.

image

in configuration.yaml, we add

#MPD music player daemon
media_player:
  - platform: mpd
    name: "MPD Mopidy"
    host: localhost
    port: 6601

for example, audio output via a portable bluetooth speaker using a local rhasspy voice assistant with Silero TTS Service speech synthesis

service: tts.marytts_say
data:
  entity_id: media_player.mpd_mopidy
  message: >-
    15 years later, the life of Jean-Luc, who once plowed the cosmic expanses
    Picard

@VincentSC
Copy link

Unfortunately it did not work. Not sure if HASS 2023 or 2024 has more changes, but I still get this:

Platform error media_player.tts_bluetooth_speaker - Integration 'tts_bluetooth_speaker' not found.

Anybody knows where to look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants