Talking Domoticz

From Domoticz
Jump to: navigation, search

Give a voice to Domoticz so It may inform you about a device that was triggered, read some news during breakfast, or even speak to a burglar...

There are generally two ways to do this: with a stand-alone piece of software you install in your server, or by using an online service that generates the voice file. The latter may give more attractive results, but does mean you lose some privacy.

eSpeak on RaspBerry Pi

A SW package named „eSpeak“ let Domoticz speak any text in different languages.
eSpeak is not a Domoticz feature but can be started e.g. by pressing a button or called from Domoticz_main.

  • Pro : Standalone. No need of internet connexion.
  • Con : The voice is synthetic. Just horrible unless you like robots from '1950s.


The author used following setup:

  • Raspberry Pi Type B 2nd revision
  • Domoticz version 1.1773

The last stable version is also working.

  • Analog out connected to a stereo amplifier for testing.

For normal usage a mini PC speaker is recommended with a 3.5mm plug and a USB power connector.

Installation of eSpeak

Like always before doing an installation on a live system make a backup of the domoticz.db and better also a copy of the whole SD card (Image) before starting.

sudo apt-get update
sudo apt-get upgrade
sudo reboot
sudo su
sudo apt-get install espeak
sudo apt-get install alsa-utils

Optionally (instead of "sudo apt-get install espeak"): sudo apt-get install mplayer espeak

Configuration for analog audio (jack): sudo amixer cset numid=3 1 Configuration for HDMI audio out: sudo amixer cset numid=3 2


espeak "Hello world, I'm a raspberry pi."

Or in another language like German:

espeak –v de "Hallo Welt, ich gruesse euch”

Create a new bash script like this:


And then in the Nano editor write this:


espeak "Lamp on"

Save the file by pressing ctrl-o, hit enter to save it, and then press ctrl-x to close the nano editor.

Name it "" and make it executable:

chmod +x

Try it out by typing


If you get a bash error, then you may need to renove the #!/bin/bash. Just open the file again like you did above.

Add "script:///home/pi/domoticz/scripts/" to the "On action" field of the switch.


Find info and parameters :

You can discuss here: [3]

Thanks to “drogert” for support.  :-)

Speak with VOICERSS WebService on RaspBerry Pi

Simple to run, text-to-speech (TTS) system for the Raspberry Pi. The only solution to have a good sound quality. There is a lot of good Text to speech API:


sudo apt-get install git-core
sudo apt-get install mpg123
git clone
cd PiAUISuite/Install

Say Yes to install the dependencies. (Around 250Mb)
Say No to install playvideo, downloader, gvapi, gtextcommand, youtube.
Say Yes to install voicecommand (the last one)
Say No to the Self set up voicecommand.

Then, register to Voice RSS [4] and get your API Key.

And adapt the script : insert your API key, your language, bit rate. look here : [5] :

sudo nano /usr/bin/tts
[email protected]
MYAPIKEY="xxxxx from voice RSS xxxxxx"
if [ "$1" == "-l" ] ; then
   string=`echo "$string" | sed -r 's/^.{6}//'`
#empty the original file
echo "" > "/dev/shm/speak.mp3"
wget -q -U Mozilla -O "/dev/shm/tmp.mp3" "$MYAPIKEY&src=$string&f=44khz_16bit_mono&hl=$lang"
cat "/dev/shm/tmp.mp3" >> "/dev/shm/speak.mp3"
#now we finally say the whole thing
cat "/dev/shm/speak.mp3" | mpg123 - 1>>/dev/shm/voice.log 2>>/dev/shm/voice.log


The command can now be used with :

tts "Hello, world"

which will convert your text to speech, which can be heard on your default sound card and audio out.


Voice RSS allows for up to 10 000 characters per call.

API documentation : [6]

From : [7]

From Steven Hickson’s PiAUISuite. : [8]

Other ressources for Raspberry


Use SAPI Windows voice synthesis with :

VBS script


Set MyVoice = CreateObject("Sapi.SpVoice")
MyVoice.Speak WScript.Arguments(0)

Execute with

cscript.exe speak.vbs "Hello world !"

Balabolka Console Application

This Freeware console software is excellent to easy text to speech.

  • No installation required.
  • Use the voice of windows. So excellent quality.
  • Compact.
  • Flexible and easy to use.
  • Low system requirements.

It can be found here : [9]

balabolka_console.exe -t "Hello World"

Keywords : Text to speech. TTS. Speak. Voice. Voice synthesis.