2018-06-04

Voice activated train layout!

I can now control my layout using voice!


Here is how it works:





  1. I give a voice command to my Google Home device, for example, "OK Google, Track 5"
  2. The Google assistant triggers an IFTTT recipe indicating that I wish to dispatch the train on track 5 of my main station.
  3. IFTTT triggers a webhook which does an HTTP POST to a port on my router which in turn directs the call to the HTTP server running in my layout software controlling the layout.
  4. My layout control program then dispatches whatever train is present on track 5 in this example.
  5. The destination is indicated on the RemoteSign departure board for the station in question.
  6. When the train has clear track, the route is booked, an announcement is made (in German), the signals are set and a few seconds later the train starts its journey.




I have created commands for:

  • Dispatching trains.
  • Emergency stop (everything), and reinstating power again.
  • Triggering predefined events such as sound effects, lighting sequences, etc.
  • Special announcements, such as welcoming people or paging them by name.
  • Asking the decoder address of any loco.
  • Asking for information on any train

Since my layout has a German theme, the station and train names are German. This makes the recognition of these names by the Google assistant listening in English somewhat problematic. For example it is unlikely to ever recognize the command "Shattenbahnhof five", but what it hears is "shutting five", so I define the triggers in IFTTT using that text instead. Each trigger can have three trigger commands and one can add multiple triggers too.

When matching loco or train names, if it does not find an exact match, it then matches using soundex matching.

It is very nice to be able to say "Hey Google; Sunset" and watch a sunset sequence, complete with sound effects, and lights coming on in the town and under the bridge.

Update August 2022
I have just been informed by IFTTT that the passing of parameters from Google Assistant will no longer be supported! The breaks most of the functionality, as I will no longer be able to pass in the name of the event I want to trigger or the name of the person that should be paged etc. Very sad and annoying the important functionality like this gets dropped.