BigTimer and Amazon Polly Notifications

Sometimes it can be helpful to think outside of the box and I just did. We were discussing getting Amazon Echo to give out arbitrary notifications from a Raspberry Pi + Node-Red installation and after messing about with this for a while I remembered I have an Amazon AWS account in which I use POLY speech synth (see relevant blog entry).

Bigtimer controlling speech on the Pi

I originally put in place a Node-Red sub-flow to play the RED ALERT message and similar from Star Trek as well as arbitrary speech (high quality English female voice is my preference hence the use of Amazon Polly) from the Pi. Essentially I’m using the command line tool MPG123 (via Node-Red) to play MP3 files and Amazon Polly to create new voice files as and when needed. 


See elsewhere on the blog for details of how I control the speech with those function nodes and how I use the EXEC nodes to call AWS and the MPG213 player.

Note – I no longer store my audio files in /usr/audio, I store them in /home/pi/audio – see the code in the above blog entry

If the message already exists on my PI as an MPG file I use that, if not, I call Amazon Polly to create the file – my Node-Red code (a sub-flow) simply takes in some arbitrary text, checks to see if a file with the same name exists, if it does, it plays providing it isn’t already busy, if not already there, I have Amazon AWS generate the file then I do the test again, if anything else is playing, the message goes into a queue otherwise it get played. This is old stuff, documented on the blog.

The new bit is adding BigTimer, simply using the ON payload (and in my case, topic “Amy” and setting an “ON” time to play the notification over the 3.5mm jack speaker on the Pi (or any Bluetooth speaker though that seems less straightforward due to crappy Bluetooth command line handling on the Pi so I’ve skipped that up to now – in theory I should be able to pass it over to Alexa acting as a Bluetooth speaker but no matter). If you think BigTimer is overkill, just remember it is free and in one instance I can set up a message to play only on certain months or certain days. The same principle of course applied to the Notification tool here… instead of a limited feature inject node we can use the power of BigTimers to create standard manually checked Alexa notifications,

So in essence I can now easily add as many arbitrary automatic, timed notifications to my main Spanish Pi3 installation via its own speaker, as well as the Node-Red generated Alexa notifications I have to manually read on Alexa.