Charmed Quark Systems, Ltd. - Support Forums and Community

Full Version: New Amazon Echo Support
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
kblagron Wrote:Now that I am up and running, I have it working pretty good with a global actions and training the device based on what Echo is hearing. Haven't been doing a lot, but can now ask what the temperatures are in areas of the house or outside, plus I have been able to get it to turn on DirecTV and set the stations, etc. Plus a few WAF's where I ask who is the Prettiest or the Most Beautiful. :-)

Could you post the global action you're using for the temperature readouts from the Echo? Curious how you're doing that. Thanks.
It struggles a little bit when I ask it for all the temperatures, but the rest it gets easily.

Here is the is the action in the echo config file:

Code:
Action=\User\Query\Temperature
        Downstairs, Downstairs Temp, Downstairs, Downstairs Temperature
        Upstairs, Upstairs Temp, Upstairs Temperature
        Master, Master Temperature, Master Bedroom Temperature, Office Temperature
        Outside, Outside Temperature
        All, All Temperatures, All the Temperatures, all temperature, temperature, all the temps, all the temperature
    EndAction

Here is the global action file:

Code:
System::LogMsg
    P1=Temperature Gact
    P2=0
    P3=Intent: %(LVar:CQCActParm_1), Key: %(LVar:CQCActParm_2), Parms: %(LVar:CQCActParm_3)
    P4=Status

LocalVars::SetVariable
    P1=LVar:Temp
    P2=

If System::Equals
    P1= %(LVar:CQCActParm_2)
    P2= DOWNSTAIRS
    P3=No Case

LocalVars::SetVariable
    P1=LVar:Message
    P2=The Current Downstairs Temperature is

LocalVars::SetVariable
    P1=LVar:Temp
    P2=$(HVAC1.TempStat1)

LocalVars::Append
    P1=LVar:Message
    P2=%(LVar:Temp)

GlobalVars::SetVariable
    P1=GVar:EchoReply
    P2=%(LVar:Message)

End
If System::Equals
    P1= %(LVar:CQCActParm_2)
    P2= UPSTAIRS
    P3=No Case

LocalVars::SetVariable
    P1=LVar:Message
    P2=The Current Upstairs Temperature is

LocalVars::SetVariable
    P1=LVar:Temp
    P2=$(HVAC2.TempStat2)

LocalVars::Append
    P1=LVar:Message
    P2=%(LVar:Temp)

GlobalVars::SetVariable
    P1=GVar:EchoReply
    P2=%(LVar:Message)

End
If System::Equals
    P1= %(LVar:CQCActParm_2)
    P2= MASTER
    P3=No Case

LocalVars::SetVariable
    P1=LVar:Message
    P2=The Current Master Bedroom and Office Temperature is

LocalVars::SetVariable
    P1=LVar:Temp
    P2=$(HVAC2.TempStat1)

LocalVars::Append
    P1=LVar:Message
    P2=%(LVar:Temp)

GlobalVars::SetVariable
    P1=GVar:EchoReply
    P2=%(LVar:Message)

End
If System::Equals
    P1= %(LVar:CQCActParm_2)
    P2= OUTSIDE
    P3=No Case

LocalVars::SetVariable
    P1=LVar:Message
    P2=The Current Entry Way Temperature is

LocalVars::SetVariable
    P1=LVar:Temp
    P2=$(Weather.CurTemp)

LocalVars::Append
    P1=LVar:Message
    P2=%(LVar:Temp)

LocalVars::Append
    P1=LVar:Message
    P2=. The Current Weather Underground Temperature is

LocalVars::SetVariable
    P1=LVar:Temp
    P2=$(HVAC2.TempOutsideStat1)

LocalVars::Append
    P1=LVar:Message
    P2=%(LVar:Temp)

LocalVars::Append
    P1=LVar:Message
    P2=. The Current Garage Temperature is

LocalVars::SetVariable
    P1=LVar:Temp
    P2=$(HVAC1.TempOutsideStat1)

LocalVars::Append
    P1=LVar:Message
    P2=%(LVar:Temp)

GlobalVars::SetVariable
    P1=GVar:EchoReply
    P2=%(LVar:Message)

End
If System::Equals
    P1= %(LVar:CQCActParm_2)
    P2= ALL
    P3=No Case

LocalVars::SetVariable
    P1=LVar:Message
    P2=The Current Entry Way Temperature is

LocalVars::SetVariable
    P1=LVar:Temp
    P2=$(Weather.CurTemp)

LocalVars::Append
    P1=LVar:Message
    P2=%(LVar:Temp)

LocalVars::Append
    P1=LVar:Message
    P2=. The Current Weather Underground Temperature is

LocalVars::SetVariable
    P1=LVar:Temp
    P2=$(HVAC2.TempOutsideStat1)

LocalVars::Append
    P1=LVar:Message
    P2=%(LVar:Temp)

LocalVars::Append
    P1=LVar:Message
    P2=. The Current Garage Temperature is

LocalVars::SetVariable
    P1=LVar:Temp
    P2=$(HVAC1.TempOutsideStat1)

LocalVars::Append
    P1=LVar:Message
    P2=%(LVar:Temp)

LocalVars::Append
    P1=LVar:Message
    P2=. The Current Downstairs Temperature is


LocalVars::SetVariable
    P1=LVar:Temp
    P2=$(HVAC1.TempStat1)

LocalVars::Append
    P1=LVar:Message
    P2=%(LVar:Temp)

LocalVars::Append
    P1=LVar:Message
    P2=. The Current Upstairs Temperature is


LocalVars::SetVariable
    P1=LVar:Temp
    P2=$(HVAC2.TempStat2)

LocalVars::Append
    P1=LVar:Message
    P2=%(LVar:Temp)

LocalVars::Append
    P1=LVar:Message
    P2=. The Current Master Bedroom and Office Temperature is


LocalVars::SetVariable
    P1=LVar:Temp
    P2=$(HVAC2.TempStat1)

LocalVars::Append
    P1=LVar:Message
    P2=%(LVar:Temp)

GlobalVars::SetVariable
    P1=GVar:EchoReply
    P2=%(LVar:Message)

End
kblagron Wrote:It struggles a little bit when I ask it for all the temperatures, but the rest it gets easily.

Here is the is the action in the echo config file:

Cool, thanks. I'll try something similar. At least now I have a clear path.
You could significantly reduce that by using two enumerated variables. So you'd just create two local variables of string type with an Enum: type limits. For the first one, set the values to the mapping values DOWNSTAIRS, UPSTAIRS, etc... For the other one set the values to the response strings.

After you create them, use the incoming parameter value to set the first enum (set it from text.) Then get the ordinal value of it and set the ordinal on the second one, so that it's now at the same entry. You can then get the text of the second one and that's the message.

You may still have an issue with figuring out what values to replace. You can put a replacement token into the messages and replace that with the replacement text you build up. But if some have replacement tokens and some don't or some have one and some other more than one, then you'd still have to deal with that in an ad hoc sort of way.

Work it out in a simple button driven action in a dummy template, with the action trace up so that you can see what is being done. All the dummy action does is invoke the global action, passing in test parameters.
Makes sense! I will take a look at that.

For me, working in Fortran, Pascal, and then C before I hung up the programming role, a Case command would be perfect from what I remember for the Echo. It would be easy to set up, and of course, if it doesn't hear what it is looking for, fall out to the end with a message.
Yeh, a case/switch type statement in CML has been requested a number of times. It just makes the editor a lot more complicated, so I've not taken it on yet.
I am trying to get Alexa to change channels on my DirecTV box, and I can get it to do that easily with a "Tell Control to set to ESPN", or "Tell Control to set to NFL Network". It reads the echocfg.txt file and runs a global action based on what it returns.

However, I would like to try to say something like "Tell Control to change to ESPN" or "change channels to ESPN", and thought I could add something in the Utterances. I added this

CQCSetOffIntent change to {Channel|Target}

But no luck. Any thoughts on how to do this?

The other thing I was curious about was if there was an easy way to convert written numbers to values, so if I said something like "Change to 206" it would convert the words coming back from the Echo of "two oh six" to the value.

By the way Dean - great work, I am really loving this device. I had a lot of fun yesterday at this fantasy football draft party at my house, where I loaded about 10 things on there regarding other guys teams (smack talk mainly) along with getting her to chirp out highest scores ever, best records, etc. on my queries.
The numbers thing is a problem. The Echo can do it, but only if the replacement value indicates a number in the intent schema. The problem with that is that there's no way to then have them be unique. I.e., it couldn't tell the difference between:

set Bubba to Leave mode

and

set Bubba to 58

There's nothing to distinguish those two things. And anything that would distinguish it would make it awkward to say. There again, a problem with how the Echo works wrt to a general purpose product like CQC where everything can't be pre-known or specialized for each individual installation.


On the other thing, you'd want to use the regular Set intent as well probalby. So take these:

CQCSetIntent set {Volume|Target}
CQCSetIntent set {Disco Mode|Target}
CQCSetIntent set {a Happy Scene|Target}

And paste in a copy and change them to:

CQCSetIntent change to {Volume|Target}
CQCSetIntent change to {Disco Mode|Target}
CQCSetIntent change to {a Happy Scene|Target}

That should work. And, keep in mind that you have to have a variation for every number of words the replacement value can take. You provided a single word replacement value so it'll only work with one word. That's why the above examples have one, two and three word variations.
Is it possible to have more than one of these on a system? Wasn't obvious from the Amazon write up.
Yeh, you can have more than one. You could even have different ones talk back to different web servers in your system, but you'd have to have each web server on a different port (and if doing it safely, have each one with a different public DNS name and certificate.) In general though there'd be no issue with them all reporting back to the same web server. It's not really any different that multiple remote controls invoking commands via an IR receiver driver or something like that.

Any response text to speak flows back to the originating Echo device.