Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Increment Volume via Echo?
#1
so, uh, how would I increment the volume of Sonos, using the Echo?

"Alexa, tell control to turn up the <location> Sonos."

let's say i want that to increment by 2.

i have no conceptual idea how to make that happen. would i first need to read the current volume into a variable and then add 2 and write it back? or do I use the LocalVars ADD? what do?
do the needful ...
Hue | Sonos | Harmony | Elk M1G // Netatmo / Brultech
Reply
#2
You would read the current value into a local variable. Check that you can actually do the increment (i.e. that it's not beyond any limit you want to impose or already within 2 of the max and so would fail if you tried it.) If that check passes, then add two to the local variable, and then write it back out.
Dean Roddey
Software Geek Extraordinaire
Reply
#3
Here is the way I do it with my B&K Receiver.

Dean added a variable some time back for the Echo to allow up and down in addition to on and off.

So I say "Alexa Tell Control to turn Family Up", it keys on Family and Up, then it goes through my global variable assigned to that and does the if statements below.

Note: On mine, it won't work if you tell it to turn up Family, but you may be able to adjust the SetIntent to allow it to do that.

Code:
System::LogMsg
    P1=Music Gact
    P2=0
    P3=Intent: %(LVar:CQCActParm_1), Key: %(LVar:CQCActParm_2), Parms: %(LVar:CQCActParm_3)
    P4=Status
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
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Echo integration still working for folks? IVB 5 83 Yesterday, 06:18 PM
Last Post: IVB
  Echo as Text-To-Speech jkmonroe 8 2,078 12-13-2016, 07:43 AM
Last Post: potts.mike
  how deep is your (echo voice control) love? IVB 197 11,171 05-23-2016, 08:47 AM
Last Post: Dean Roddey
  Amazon Echo Smart Home Skills API jkmonroe 23 2,142 04-19-2016, 08:40 PM
Last Post: IVB
  Amazon Echo $153 today only (on sale) IVB 0 560 04-19-2016, 01:09 PM
Last Post: IVB
  Increasing Echo->SmartThings suckage? IVB 0 565 04-18-2016, 07:08 PM
Last Post: IVB
  Echo Code Snippets potts.mike 5 981 03-23-2016, 12:10 PM
Last Post: kblagron
  Volume Control greyjeep 3 888 11-21-2015, 10:56 AM
Last Post: Dean Roddey
  Where to set volume? rtarver 3 1,110 02-16-2015, 10:27 AM
Last Post: Dean Roddey
  Increment/Decrement ISY HeatSP Squiddy 1 696 03-30-2013, 08:41 PM
Last Post: Squiddy

Forum Jump:


Users browsing this thread: 1 Guest(s)