iphone HAH voice control - SIRI + IOS6??

15 replies [Last post]
garrydwilms
Offline
United Kingdom
Joined: 31 Mar 2011

Just been reading through the IOS6 features which launches on 19th Sept and noticed that SIRI will now send tweets via voice command.

 

Assuming this works OK then this feature easily opens the door to voice control on the HAH.

Simply speaking "tweet House lamps on" or "tweet house thermostat 19" should in theory produce an alias message that can be interpreted by a modified alias lua script.

 

I'm gonna make it my next project when IOS6 ships. I'll keep you posted!.

 

Garry

mark_baldwin
Offline
Blackburn, United Kingdom
Joined: 19 May 2012
sounds interesting, keep us

sounds interesting, keep us posted :)

allanayr
Offline
Ayr, United Kingdom
Joined: 25 Sep 2011
Definitely works. A minor

Definitely works. A minor problem is that when constructing the tweet it capitalises the first letter of the first word. This can be overcome by adding another function to the alias handler applet to deal with it.

 

Cool trick though!

g7pkf
Offline
United Kingdom
Joined: 11 Jan 2011
Any update?

wife would love this-iphone 5 and ipad 3, i get all her cast offs so only have ipad 1 and ipad 1 :(

allanayr
Offline
Ayr, United Kingdom
Joined: 25 Sep 2011
What kind of update?

It's definitely working; saying "tweet thermostat 18.7" to SIRI produces an alias message which resets my CH thermostat. "tweet boost on" sets the boost setting to on, I've even set up a "tweet coffee on" which switches on RF 3 which has the coffee machine attached!

One of the limitations of twitter is that you can't tweet the same message over and over again, so the thermostat is not a problem because you can just change it in .1 of a degree increments. coffee machines and  boost functions are slightly different. I'm not sure what the interval parameters are for repeating the same tweet but it is certainly hours and possibly more than a day. So lights on and lights off could probably only be done once a day each. But I'm sure people can come up with novel names for the same thing in the alias handler.

garrydwilms
Offline
United Kingdom
Joined: 31 Mar 2011
Repeating tweets

Allan,  I can confirm it works for me too however the HAH deletes the tweet for me once actioned so I can repeat the same tweet as often as I like!

 

is this not happening for you?

 

Garry

allanayr
Offline
Ayr, United Kingdom
Joined: 25 Sep 2011
Not AFAIK

I'm really new to twitter (just set it up to do this) but the tweet which was sent this morning is still there on my twitter page. Perhaps there's something I've missed in the set up. I'll have a look.

garrydwilms
Offline
United Kingdom
Joined: 31 Mar 2011
Command prefix?

I bet this is to do with the command prefix setting in the twitter config page. 

Is yours left blank??

this is there so that only tweets starting with the command prefix are actioned ( and I guess deleted) if its blank I assume all tweets are actioned but maybe not deleted. 

It depends what you want most. Adding a command prefix such as "House" would mean that you now need to tweet " House thermostat 17.9" one word longer but this would allow the tweet to be deleted and also get round your capitalisation issue as well

 

i guess it up to you what matters most

garry

allanayr
Offline
Ayr, United Kingdom
Joined: 25 Sep 2011
Sounds likely, I'll

Sounds likely, I'll experiment in the next few days.

 

Allan

g7pkf
Offline
United Kingdom
Joined: 11 Jan 2011
Not working :(

Totally new to twitter-set up for just HAH control for wife, so she can overide heating and turn lights on/off remotely.

 

have set House as command prefix authorized with twitter but no tweets are actioned?

 

if i tweet "House conservatory on" nothing happens but it should switch conservatory lights on?

 

all tweets stay in my twitter bit?

 

how do i debug?

 

Dean

g7pkf
Offline
United Kingdom
Joined: 11 Jan 2011
Ok ran up XFX

And it is picking up twitter

 

xap-header
{
v=12
hop=1
uid=FF00D900
class=alias
source=dbzoo.livebox.Twitter
}
command
{
text=printers off
}

Butit does nowt here is an rf command send from Joggler:-

 

xap-header
{
v=12
hop=1
uid=FF00DBA0
class=xAPBSC.event
source=dbzoo.livebox.Controller:rf.1
}
output.state
{
state=on
displaytext=printers on
}

is there some sort of aliasing i am missing?

 

Dean

allanayr
Offline
Ayr, United Kingdom
Joined: 25 Sep 2011
Alias

Dean

 

Your alias handler needs to convert the command to the appropriate message to target the device.

I assume that what you are saying is that using "printer off" as an alias message works OK?

If you type aliasmsg "printers on" at the command prompt does it work correctly?

 

Allan

g7pkf
Offline
United Kingdom
Joined: 11 Jan 2011
No it doesnt :(

This is my AliasApplet.lua (lokks gibberish to me :) )

--[[
Alias interpreter

Use to perform actions based on xAP alias class messages emitted by
both xap-twitter and xap-googlecal
--]]

module(...,package.seeall)

require("xap")
require("string")
rex = require("rex_posix")

info={
   version="1.0", description="Alias Interpreter"
}

pat={
    [rex.new("(relay|rf) ([1-9]) (on|off)")]=function(m) rfRelayCmd(m) end,
    [rex.new("tweet (.*)")]=function(m) tweet(unpack(m)) end
}

function sendBscCmd(target,body)
  xap.sendShort(string.format([[xap-header
{
target=%s
class=xAPBSC.cmd
}
output.state.1
{
id=*
%s
}]], target, body))
end

function tweet(msg)
  sendBscCmd("dbzoo.livebox.Twitter","text="..msg)
end

function rfRelayCmd(t)
  local addr1,addr2,state = unpack(t)
  sendBscCmd(string.format("dbzoo.livebox.Controller:%s.%s",addr1,addr2),"state="..state)
end

function aliasEngine(frame)
  local alias = frame:getValue("command","text")
  for r,f in pairs(pat) do
      if type(r) == "string" then
         if r == alias then
            f()
         end
      else
        p={r:match(alias)}
        if #p > 0 then
            f(p)
        end
      end
  end
end

function init()
  local f = xap.Filter()
  f:add("xap-header","class","alias")
  f:add("command","text",xap.FILTER_ANY)
  f:callback(aliasEngine)
end

allanayr
Offline
Ayr, United Kingdom
Joined: 25 Sep 2011
OK

OK your alias handler doesn't handle a command called conservatory or whatever.

You need a handler routine and an setup expression to make it work

[rex.new("conservatory (.*)")]=function(m) conservatory(unpack(m)) end,

in your setup and

function conservatory(msg)
sendBscCmd("dbzoo.livebox.Controller:rf.3","state="..msg)
end

in the body

Then when you issue a

aliasmsg "conservatory on" at the command line it should switch rf 3 on or off

 

Allan

g7pkf
Offline
United Kingdom
Joined: 11 Jan 2011
thank you

That sorted it :)

 

now to train wife :)

allanayr
Offline
Ayr, United Kingdom
Joined: 25 Sep 2011
Train the wife

Phew! Good luck mate. Afraid I can't help you with that!

Hardware Info