Home Automation Games – The Next Great Gaming Adventure

With the considerable help of @RexBeckett on the Micasaverde forum, I was able to finally realise my first HA (Home Automation) / TTS (Text To Speech) game.

Ok so it’s not quite to the level of sophistication/AI that some might like, but it’s a great toe tip in the water and can give you some idea of the untapped potential that’s there.

How does it work?

First you’ll need a Micasavede Vera controller with the Sonos Plugin installed. Next you’ll need to create a new scene (under the Automation tab) to add the following code in the ‘Luup’ section.

To make it more HA, I set my scene up to be triggered when one of the kids walks into the play room, that way it first greats them with a message (via the play room’s SONOS) welcoming them into the room, and then it starts to play this game with them. The game used here should be familiar to many of you – it’s “Simon Says”..

local count = math.random(2,5)
local prms = string.format("%d,%d",count,0)

function simonSays(sprms)
local SONOS = 13
local LS_SID = "urn:micasaverde-com:serviceId:Sonos1"
local scnt,slst = string.match(sprms,"(%d+),(%d+)")
local cnt = tonumber(scnt)
local lst = tonumber(slst)
local says = {"put your hands on your head!", "put your hands on your hips!", "turn around", "touch your ankles", "put your hands on your belly!", "jump up in the air", "put your hands on you ears!", "turn around!", "sit down!", "touch your nose!", "stand on one leg!", "Touch your toes!"}
local pick = math.random(1,table.maxn(says))
if pick == lst then
if pick == table.maxn(says) then
pick = pick - 1
pick = pick + 1
local thissay = says[pick]
if (cnt > 1) then thissay = "Simon says, " .. thissay end
luup.call_action(LS_SID, "Say", {Text = thissay}, SONOS)
cnt = cnt - 1
if cnt > 0 then
local parms = string.format("%d,%d",cnt,pick)

The above has now been rigorously tested on my kids, and they just love it !

I often add/remove some instructions to keep it fresh, therefore please feel free to customise/localise the above ‘say’ command as much as you want. I even find specifying chores like “wiping your hands” or “picking up your toys” etc.) are remarkably well executed when they’re asked via this game and are prefixed with the words ” Simon Says” 😉

So what’s next?

Well, I’m now looking to find a portable device that has a button or two on it, so that the kids can start and stop the game by themselves. Thankfully as I already have the rfxtrx433 plugin installed on my Vera,mthey are a few low cost options available e.g a Visonic or wireless X10 key fob/pads

Now – some of you may say this is just lazy parenting at it’s best/worst, but for me, it’s actually a very interactive experience for them and if used first thing on a Sunday morning, it provides those tired parents with some much needed morning sleep/relaxation, surley it can’t be all bad. 🙂

How far are you going to take it?

Next on the list is to see how much more I could develop games built upon all the HA elements in my home e.g use the TTS feature to ask the kids to go into the lounge (which is validated by a motion sensor) which then triggers the phrase “welcome to the lounge” being spoken. Plus if there’s a theme being used for their activity, (e.g princesses etc) then the words could be tailored e.g “welcome to the kings room”. Once inside, the game could then ask them a question or two, which they would answer by pressing a corresponding button (e.g on an X10 keypad) if they think the answer is xxx or yyyy

As it utilises the Vera Sonos Plugin, it can also play music through out the game, and be set up to change tracks at certain points too, all while it’s being broken up with dynamic TTS “say” commands telling them what they should do next etc.

If you’re able to recall the ‘Choose your own adventure’ books as a kid, well for me this is the 21st century version 🙂

As you can see my mind’s running wild with potential HA games now that I’ve been able to experience this first one ;). Not being a programmer, I’m limited in what I can do, but hopefully experts like @RexBeckett and others will have a few pockets of free time to help me realise a few more of my HA game ideas 🙂

Thanks for reading this, please post any comments/questions below.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: