So I finally managed the home message announcing thing as I want it.
As I needed to search for hours for little chunks of info everywhere, I want to share with you now all the steps I’ve made to get it working.
I’m not exactly sure, if this will work fine on a RPi, this is tested on a x64 architecture with an Intel chip-set.
1. The wish
So, what I wanted is to play a chime and read a message in my language, when something happens, like some door opens.
This has to be done on the machine, where HA is running.
2. Hardware needed
Device, which will play the sound with a 3’5mm jack-plug.
Could be a set of PC speakers or like I did, a DIY Amplifier from Aliexpress and a passive speaker.
I did this on Home Assistant 2021.11.3 supervised on Debian 11 Bullseye.
No additional external downloads were made, all needed stuff is inside HA already.
A Nabu Casa Subscription is needed. It will work without also, with a different cloud TTS service, like Google_say or Google_translate, but I preferred Nabu Casa Cloud say, as it is already enabled, when you are subscribed.
Plug the sound playing device in to the 3,5mm headphone output of your HA machine
Go to Supervisor → Add On store and install VLC
Go to Configuration → Integrations and install VLC media player Telnet
Go to Configuration → Home Assistant Cloud and under Text to Speach select your language and preffered voice
Edit your configuration.yaml file with adding the following:
notify: - platform: tts name: VLCtelnetHA #This name you can choose yourself tts_service: tts.cloud_say media_player: media_player.vlc_telnet
Go to Configuration → Server maintenance and validate your config. If it validates, go to point 7. If not, have fun seeking your fault.
Restart Home assistant
Find your favorite chime sound as an mp3 file and copy it into /config/www/ It will look like this: /config/www/dingdong.mp3
Create your automation like this example:
alias: door open description: '' trigger: - platform: state entity_id: remote.sonoff_1000cdcc13 attribute: ts condition: - condition: state entity_id: remote.sonoff_1000cdcc13 state: door open attribute: name action: - service: media_player.play_media target: entity_id: media_player.vlc_telnet data: media_content_id: http://XXX.XXX.XXX.XX:8123/local/dingdong.mp3 #Of course this is the IP of your own machine! media_content_type: music - delay: '00:00:04' #This delay has to be a second longer, than your mp3 file is other ways dingdong will not get played! - service: notify.vlctelnetha #This is the name you gave the service in configuration.yaml data: message: Someone entered the room. I have seen it, I swear mode: single
- You are done!
Optional Lovelace card where you can type messages to be read
For this you will need the HACS store!
Go to HACS store → Frontend and install Notify card
Reload the page! This is necessary.
Create a new card on your lovelace
type: custom:notify-card target: VLCtelnetHA #This is the name you gave the service in configuration.yaml title: Send Notification label: Notify Speaker # your own text here
- You are done. You can send text to TTS from a card.