Make Alexa Speak a Message Received via MQTT

These instructions assume an OpenHAB2 configuration with Mosquitto MQ enabled and working. However, HUE emulation must not necessarily be installed and configured since these instructions use a different binding. Furthermore, there is no need to install any TTS engine (ie: from Paper UI → Add-Ons → TTS) since the Amazon Echo itself will be used as the TTS device. These instructions partially synthesize the official Amazon Echo Control Binding documentation.

The Amazon Echo Control Binding since version 2.3 supports text-to-speech and thereby outdates hardware solutions. To make the Amazon Echo speak a message received on a given MQTT following, perform the following steps:

Bridge amazonechocontrol:account:AMAZON_ACCOUNT_NAME "Amazon Account" @ "Accounts" [amazonSite="amazon.com", email="AMAZON_ACCOUNT_EMAIL", password="AMAZON_ACCOUNT_PASSWORD", pollingIntervalInSeconds=60]
{
    Thing AMAZON_ECHO_NAME                 AMAZON_ECHO_NAME          "Alexa" @ "Living Room" [serialNumber="AMAZON_ECHO_SERIAL_NUMBER"]
    Thing flashbriefingprofile flashbriefing "Flash Briefing Technical" @ "Flash Briefings" 
}

and replace the following placeholders:

String MQTTSay_String { mqtt="<[mosquitto:alexa/say:state:default]" }

String EchoTTS "Text to Speech" {channel="amazonechocontrol:echo: AMAZON_ACCOUNT_NAME: AMAZON_ECHO_NAME:textToSpeech"}

and replace the placeholders that must match the settings in /etc/openhab2/things/echo.things:

rule "Make Alexa say an MQTT message"
when
    Item MQTTSay_String received update
then
    EchoTTS.sendCommand(MQTTSay_String.state.toString())
end

Finally, restart OpenHAB2.

For testing, tail the OpenHAB2 log file (usually, placed at /var/log/openhab2/openhab2.log and then from a different machine, use mosquitto_pub to send a message to the MQTT server, ie:

mosquitto_pub -h MQTT_SERVER_HOSTNAME -t 'alexa/say' -m "Program me daddy\!" -v

where: