New error
homeassistant.exceptions.HomeAssistantError: Config file not found: /home/homeassistant/.homeassistant/custom_components/device_tracker/services.yaml
Oops⌠forgot to add the file. Can you grab this file from the GitHub repo?
ha-tts-bluetooth-speaker/custom_components/device_tracker/services.yaml
2017-07-12 00:38:41 ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: expected dict for dictionary value @ data['action'][0]['data']. Got None
extra keys not allowed @ data['action'][0]['message']. Got None. (See /home/homeassistant/.homeassistant/configuration.yaml, line 157). Please check the docs at https://home-assistant.io/components/automation/
Note:
I have placed the automation in the automation.yaml file
content
#################################################################
## Lighting Automations
#################################################################
##########################################################
## Turn on lights at sunset
##########################################################
- id: sunset_lights_on
alias: Sunset Light On
trigger:
- platform: sun
event: 'sunset'
action:
- service: light.turn_on
entity_id:
- light.gazebo
##########################################################
## Turn off lights at sunrise
##########################################################
- id: sunset_lights_off
alias: Sunrise Light Off
trigger:
- platform: sun
event: 'sunrise'
action:
- service: light.turn_off
entity_id:
- light.gazebo
#
## - service: tts.google_say
# data:
# entity_id: media_player.bluetooth_speaker
# message: 'Night mode deactivated'
#
- id: home_assistant_startup
alias: Home Assistant Start
trigger:
- platform: homeassistant
event: 'start'
action:
- service: tts.google_say
data:
entity_id: media_player.tts_bluetooth_speaker
message: 'Home Assistant has started'
@hackertc Last two lines in your automation need to be indented. Try copying mine as is:
automation:
- alias: Home Assistant Start
trigger:
platform: homeassistant
event: start
action:
- service: tts.google_say
data:
entity_id: media_player.tts_bluetooth_speaker
message: 'Home Assistant has started'
Thank you!
I was checking the yaml config with http://www.freecodeformat.com/yaml-validator.php and it got me green light.
Now I managed to finally hear âHome assistant is startingâ but, only after connecting manually with bluetoothctl and connect B8:69:C2:BE:6C:CC and after restarting home assistant using the HA interface.
I probably have to dig deeper in the startup bluetooth config to make it auto connect after pi restarts
@hackertc Great to hear you got it working. Do you also have Bluetooth tracker enabled for presence detection?
yes, togetter with owntracks (i hope i did the config ok)
device_tracker:
- platform: owntracks
- platform: bluetooth_tracker
max_gps_accuracy: 200
waypoints: True
waypoint_whitelist:
- alextc
@hackertc Not sure about owntracks, but your config should probably look like this:
device_tracker:
- platform: bluetooth_tracker
- platform: owntracks
max_gps_accuracy: 200
waypoints: True
waypoint_whitelist:
- alextc
I think those options are for owntracks, so I have moved them there.
@hackertc Hmmm⌠I wonder whether it would make sense to force the Bluetooth speaker component to always call bluetoothctl
and connect [BLUETOOTH_ADDRESS]
before it plays the TTS file using mplayer.
That way, we could simply rely on the Bluetooth speaker component to ensure the connection is made to the Bluetooth speake, and not have to worry about creating our own startup scripts to make the connection.
Probably not a very elegant way, but if it works, then heyâŚ
Managed to get it to work!
Thank you @pkozul! for the help.
My problem was because of the lack of execute permissions on /.homeassistant/scripts/pair_bluetooth.sh
file
solved by sudo chmod a+x /home/homeassistant/.homeassistant/scripts/pair_bluetooth.sh
Got it working buy doing the sudo adduser homeassistant pulse-access
thanks guys
@Charles_Brown Great to hear. Thanks for letting us know. Are you using the latest version (i.e. files from GitHub)?
Im using the ones prior to the device tracker added stuff Not using device tracker with bluetooth AlthoughI did not auto connect after a reboot I will need to look into that now.
So you guys donât know if it works with BLE dongles, since bluetooh presence detection I have currently done via Node-red and not HASS. Havenât yet tried to do it here.
Hi,
Thank you very much for the tutorial. I finally made the tts work, but I found that the first around two seconds of the sound are missing.
For example in âHome assistant has startedâ, I can only hear âant has startedâ
It seems that there is a delay time from the time that the sound is playing and the time since actually the media player is on and playing.
Anyone had this problem?
Thank you!
Santi
@santirguez Hi there. Does this issue also occur when you call the TTS service using the Developer Tools > Services in the HA frontend? Or does it just occur when HA starts up?
Just want to figure out whether itâs being caused by HA starting up, or whether it always occurs in all scenarios.
@pkozul
Awesome, this looks great. Iâm curious though, why did you choose to use mplayer + pulseaudio instead of VLC directly with ALSA?
Any plans to submit this up to HA for inclusion in a future release?
So in theory this should actually work for connecting to an echo and doing TTS on it right? Anyone given that a shot yet? Does staying connected break alexa hotwords?
Thanks!
Hi @superm1. Originally I couldnât get it work with vlc
but that was in the early stages when I was doing lots of trial and error.
I will revisit this and see if vlc works now.
If this version works âproperlyâ for enough people, I will submit this for inclusion in HA.
Sorry, no idea about connecting to an Echo. Iâm sure sooner or later someone will try and it tell us about it.
@superm1 BTW, I donât think this will work with ALSA because Bluez no longer supports ALSA, so PulseAudio is the only option.
Hi @pkozul
It happens every time I call the service, but only if the call is separated in time from each other. I mean, If I call TTS twice in a row, the second time works ok, but the first one is cut at the beginning.
For now I solved it adding a 2 seconds silence file playing before the TTS mp3 file is played.