Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Echo Code Snippets
#1
I am struggling through setting up my echo and thought I would post what I have in hopes of gettign some inspiration.

I have started with setting volumes, basically from the setup guide.

Config entry
Code:
Action=\User\Echo\setmedia
Volume, music volume, theater volume, t. v. volume, tv volume
EndAction

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

If System::Equals
    P1=%(LVar:CQCActParm_3)
    P2=low
    P3=No Case

Devices::FieldWrite
    P1=PlayBar.Volume
    P2=20
    P3=True

End
If System::Equals
    P1=%(LVar:CQCActParm_3)
    P2=high
    P3=No Case

Devices::FieldWrite
    P1=PlayBar.Volume
    P2=60
    P3=True

End
If System::Equals
    P1=%(LVar:CQCActParm_3)
    P2=normal
    P3=No Case

Devices::FieldWrite
    P1=PlayBar.Volume
    P2=35
    P3=True

End
If System::Equals
    P1=%(LVar:CQCActParm_3)
    P2=medium
    P3=No Case

Devices::FieldWrite
    P1=PlayBar.Volume
    P2=35
    P3=True

End
|Z-Wave|Sonos|Tivo|Hue|Plex|Roku|MyMovies|Echo|
Nest|Harmony|Neeo|LG TV|Smarthings|
Reply
#2
Also working on some Tivo control

config entry
Code:
Action=\User\Echo\Tune Living Room TV to station
T. V., Television, Channel, tv
EndAction

Global Action
Code:
System::LogMsg
    P1=Test Action
    P2=0
    P3=intent: %(LVar:CQCActParm_1), Key:  %(LVar:CQCActParm_2), Parms:  %(LVar:CQCActParm_3)
    P4=Status

If System::Equals
    P1=%(LVar:CQCActParm_3)
    P2=abc
    P3=No Case

Devices::FieldWrite
    P1=LivingRoomTivo.SetChannel
    P2=0652
    P3=True

End
If System::Equals
    P1=%(LVar:CQCActParm_3)
    P2=espn
    P3=No Case

Devices::FieldWrite
    P1=LivingRoomTivo.SetChannel
    P2=0668
    P3=True

End
If System::Equals
    P1=%(LVar:CQCActParm_3)
    P2=e.s.p.n.
    P3=No Case

Devices::FieldWrite
    P1=LivingRoomTivo.SetChannel
    P2=0668
    P3=True

End
If System::Equals
    P1=%(LVar:CQCActParm_3)
    P2=Science
    P3=No Case

Devices::FieldWrite
    P1=LivingRoomTivo.SetChannel
    P2=0683
    P3=True

End
If System::Equals
    P1=%(LVar:CQCActParm_3)
    P2=cbs
    P3=No Case

Devices::FieldWrite
    P1=LivingRoomTivo.SetChannel
    P2=0654
    P3=True

End
If System::Equals
    P1=%(LVar:CQCActParm_3)
    P2=nbc
    P3=No Case

Devices::FieldWrite
    P1=LivingRoomTivo.SetChannel
    P2=0653
    P3=True

End
If System::Equals
    P1=%(LVar:CQCActParm_3)
    P2=Bravo
    P3=No Case

Devices::FieldWrite
    P1=LivingRoomTivo.SetChannel
    P2=0761
    P3=True

End
If System::Equals
    P1=%(LVar:CQCActParm_3)
    P2=e.
    P3=No Case

Devices::FieldWrite
    P1=LivingRoomTivo.SetChannel
    P2=0768
    P3=True

End
If System::Equals
    P1=%(LVar:CQCActParm_3)
    P2=fox
    P3=No Case

Devices::FieldWrite
    P1=LivingRoomTivo.SetChannel
    P2=0655
    P3=True

End
If System::Equals
    P1=%(LVar:CQCActParm_3)
    P2=show time
    P3=No Case

Devices::FieldWrite
    P1=LivingRoomTivo.SetChannel
    P2=0650
    P3=True

End
If System::Equals
    P1=%(LVar:CQCActParm_3)
    P2=comedy central
    P3=No Case

Devices::FieldWrite
    P1=LivingRoomTivo.SetChannel
    P2=0772
    P3=True

End
If System::Equals
    P1=%(LVar:CQCActParm_3)
    P2=guide
    P3=No Case

Devices::FieldWrite
    P1=LivingRoomTivo.Teleport
    P2=Guide
    P3=True

End
|Z-Wave|Sonos|Tivo|Hue|Plex|Roku|MyMovies|Echo|
Nest|Harmony|Neeo|LG TV|Smarthings|
Reply
#3
I would love to see an example of the up/down intent and returning text to the user.
|Z-Wave|Sonos|Tivo|Hue|Plex|Roku|MyMovies|Echo|
Nest|Harmony|Neeo|LG TV|Smarthings|
Reply
#4
Any action can return text to be spoken. There's nothing special about that. Even something like the above can return something like, "OK, I set the channel to e.s.p.n." or something like that. All you have to do is put the text into the right variable and it'll get picked up and returned.
Dean Roddey
Software Geek Extraordinaire
Reply
#5
One thing I noticed is that when using Echo to control volume of other things, you have to make the volume change more dramatic than one click on the remote. Notice how the echo itself has 10 volume levels?

I used it to activate the appleTV today because all I had was the appleTV remote around and I wanted to use the apple TV. I never needed the TV remote. When I was done I told it to turn off the TV.

I often use it to open/close the garage door when I don't enter the house through the garage.

I hope to use it to control sonos at some point.
--Kill all the serial ports--
Reply
#6
Here is the way I did it (I just showed one of the 4 global action IF statements so it wouldn't be so long:

Config Entry

Code:
    Action=\User\Set\Music
        Family,Family Music
        Outside,Patio,Outdoor,Patio Music,Outside Music,Outdoor Music
        Office
        Bedroom, bed room
    EndAction

Global Action Commands:

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

If System::Equals
    P1=%(LVar:CQCActParm_3)
    P2=on
    P3=No Case

Devices::FieldWrite
    P1=CTHD6.ZoneBPower
    P2=True
    P3=True

Devices::FieldWrite
    P1=Audio1.PlayMedia
    P2=favorite:QuickMix
    P3=True

GlobalVars::SetVariable
    P1=GVar:EchoReply
    P2=Logitech Media Server is now On in the Family Room

End
If System::Equals
    P1=%(LVar:CQCActParm_3)
    P2=off
    P3=No Case

Devices::FieldWrite
    P1=CTHD6.ZoneBPower
    P2=False
    P3=True

GlobalVars::SetVariable
    P1=GVar:EchoReply
    P2=Logitech Media Server is now Off in the Family Room

End
If System::Equals
    P1=%(LVar:CQCActParm_3)
    P2=up
    P3=No Case

LocalVars::SetVariable
    P1=LVar:Vol
    P2=$(CTHD6.ZoneBVolume)

LocalVars::Add
    P1=LVar:Vol
    P2=5

Devices::FieldWrite
    P1=CTHD6.ZoneBVolume
    P2=%(LVar:Vol)
    P3=True

GlobalVars::SetVariable
    P1=GVar:EchoReply
    P2=Family music volume has been turned up.

End
If System::Equals
    P1=%(LVar:CQCActParm_3)
    P2=down
    P3=No Case

LocalVars::SetVariable
    P1=LVar:Vol
    P2=$(CTHD6.ZoneBVolume)

LocalVars::Subtract
    P1=LVar:Vol
    P2=5

Devices::FieldWrite
    P1=CTHD6.ZoneBVolume
    P2=%(LVar:Vol)
    P3=True

GlobalVars::SetVariable
    P1=GVar:EchoReply
    P2=Family music volume has been turned down.

End
End
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Echo integration still working for folks? IVB 5 1,140 01-15-2018, 06:18 PM
Last Post: IVB
  Echo as Text-To-Speech jkmonroe 8 3,301 12-13-2016, 07:43 AM
Last Post: potts.mike
  how deep is your (echo voice control) love? IVB 197 19,408 05-23-2016, 08:47 AM
Last Post: Dean Roddey
  Amazon Echo Smart Home Skills API jkmonroe 23 3,601 04-19-2016, 08:40 PM
Last Post: IVB
  Amazon Echo $153 today only (on sale) IVB 0 850 04-19-2016, 01:09 PM
Last Post: IVB
  Increasing Echo->SmartThings suckage? IVB 0 835 04-18-2016, 07:08 PM
Last Post: IVB
  Increment Volume via Echo? jkmonroe 2 1,287 02-10-2016, 08:27 AM
Last Post: kblagron
  How do you keeping track of your CML code? bbrendon 5 1,329 11-30-2015, 12:12 PM
Last Post: Dean Roddey
  IR code / Global Cache question ControlFreak 11 4,890 11-09-2014, 09:27 PM
Last Post: MikeA
  Example Media Type Code Needed ASAP... AnthonyZ 8 1,275 07-17-2009, 12:53 PM
Last Post: Dean Roddey

Forum Jump:


Users browsing this thread: 1 Guest(s)