Author Topic: Programming Sonos to "start and stop" with my Elk Alarm system  (Read 903 times)

Offline lakewoodjazz

  • Sr. Newbie
  • *
  • Posts: 30
  • Karma: +1/-0
Programming Sonos to "start and stop" with my Elk Alarm system
« on: September 24, 2016, 02:01:59 am »
I put these three luup codes below in my scene and they are not working.

Step 1.Trigger is: When I disarm my Elk Alarm System.
Step 2.Device Actions: Turn on 2 lights and unlock 2 doors
Step 3. Also, execute the following Luup code:
luup.call_action("urn:micasaverde-com:serviceId:Sonos1", "Say",
                 {Text="Welcome home. I hope you had a good time and a safe journey.", Language="en-CA", GroupZones="ALL",
                  Volume=65, SameVolumeForAll="true"},
                 48)
luup.call_action("urn:upnp-org:serviceId:AVTransport", "Stop", {}, 48)
return luup.is_night() == true

The Say command works as usual but the Sonos Stop command does not.....
The return luup.is_night() == true  did not work.
Seems likely only one luup code is working....

What I want the Scene to do (via luup or with addition device commands perhaps run in the Advanced Editor?)
is when I Disarm my Elk Alarm system play the Welcome Say command and turn off the Sonos radio station I had playing from when I left the house.
Also only turn on the light when it is night time plus unlock my 2 entry doors.
Seems like I can do it without Pleg.....
All the codes work individually in other Scenes I have created except the  luup.call_action("urn:upnp-org:serviceId:AVTransport", "Stop", {}, 48)
which seems like the perfect code posted in a thread by Z-Waver.

Also
When programming the Arm House Seen:
I am trying to use the advanced editor with a 30" delay after the Say Command to play a radio station.

Step 1.Trigger is: When I Arm my Elk Alarm System.
Step 2.Device Actions: Turn on 2 lights and unlock 5 doors
Step 3. Also, execute the following Luup code:
luup.call_action("urn:micasaverde-com:serviceId:Sonos1", "Say",
                 {Text="Good Bye I will protect your house. I hope you hacve a safe journey.", Language="en-CA", GroupZones="ALL",
                  Volume=65, SameVolumeForAll="true"},
                 48)
How do I get Sonos from the say.mp3 to a radio station by itself?
Seems like it would work in advanced editir but I can't find the right Play URI for the station.
I have tried many ways.....
This one works in Sonos Player PAge URI Dropdown......but the x-sonosapi-stream is not a drop down option in the advanced editor under Sonos.
   
x-sonosapi-stream:s22368?sid=254&flags=8224&sn=0



Hope you can help!


Offline lloydshearer

  • Newbie
  • *
  • Posts: 9
  • Karma: +0/-0
Re: Programming Sonos to "start and stop" with my Elk Alarm system
« Reply #1 on: January 27, 2017, 12:41:34 pm »
From my basic knowledge, there is no stop command for sonos, the correct command is pause, here is a list of commands from another interface to sonos that i have

play
pause
playpause (toggles playing state)
volume (parameter is absolute or relative volume. Prefix +/- indicates relative volume)
groupVolume (parameter is absolute or relative volume. Prefix +/- indicates relative volume)
mute / unmute
groupMute / groupUnmute
togglemute (toggles mute state)
seek (parameter is queue index)
trackseek (parameter is in seconds, 60 for 1:00, 120 for 2:00 etc)
next
previous
state (will return a json-representation of the current state of player)
favorite
playlist
lockvolumes / unlockvolumes (experimental, will enforce the volume that was selected when locking!)
repeat (on/off)
shuffle (on/off)
crossfade (on/off)
pauseall (with optional timeout in minutes)
resumeall (will resume the ones that was pause on the pauseall call. Useful for doorbell, phone calls, etc. Optional timeout)
say
queue
clearqueue

Offline ZW-Tom

  • Sr. Newbie
  • *
  • Posts: 35
  • Karma: +4/-1
Re: Programming Sonos to "start and stop" with my Elk Alarm system
« Reply #2 on: August 22, 2017, 03:30:08 pm »
From my basic knowledge, there is no stop command for sonos, the correct command is pause, here is a list of commands from another interface to sonos that i have

play
pause
playpause (toggles playing state)
volume (parameter is absolute or relative volume. Prefix +/- indicates relative volume)
groupVolume (parameter is absolute or relative volume. Prefix +/- indicates relative volume)
mute / unmute
groupMute / groupUnmute
togglemute (toggles mute state)
seek (parameter is queue index)
trackseek (parameter is in seconds, 60 for 1:00, 120 for 2:00 etc)
next
previous
state (will return a json-representation of the current state of player)
favorite
playlist
lockvolumes / unlockvolumes (experimental, will enforce the volume that was selected when locking!)
repeat (on/off)
shuffle (on/off)
crossfade (on/off)
pauseall (with optional timeout in minutes)
resumeall (will resume the ones that was pause on the pauseall call. Useful for doorbell, phone calls, etc. Optional timeout)
say
queue
clearqueue
I did not see an answer to your question.
Yes, Sonos does have a "Stop". It has both "Pause" and "Stop". as noted below:
"Pause" will pause the current song and resume at the same place with a "Play" command.
"Stop" will stop the music and resume from the queue with the next "Play" command.
A stop, Pause or Play can be issued with the following code:
luup.call_action("urn:micasaverde-com:serviceId:MediaNavigation1", "Stop", {}, SonosID)
or
luup.call_action("urn:upnp-org:serviceId:AVTransport", "Stop", {}, SonosID)

Although this topic is old, I felt a reply would be good as is it is a topic I found looking for something else.

Tom

Offline parkerc

  • Sr. Hero Member
  • ******
  • Posts: 2371
  • Karma: +33/-45
  • Life Moves Pretty Fast....
    • Node Central
Re: Programming Sonos to "start and stop" with my Elk Alarm system
« Reply #3 on: August 29, 2017, 02:20:41 pm »
Hi @Lloydshearer

Have a look at using the Sonos Http API with Vera (rather than the TTS within the sonos plugin) - assuming it is TTS you need, if the messages are fixed you could pre-record and save as an .mp3

http://forum.micasaverde.com/index.php/topic,49618.0.html

I have this Amazon Polly set up with my DSC Alarm Panel, so when the alarm is triggered it makes a number of notifications etc.

Offline lakewoodjazz

  • Sr. Newbie
  • *
  • Posts: 30
  • Karma: +1/-0
Re: Programming Sonos to "start and stop" with my Elk Alarm system
« Reply #4 on: September 02, 2017, 08:45:45 am »
Thanks for your reply but after reading through the thread i dont have the skills to set it up.....yet...
:)
I would like to create my own mp3 Say Commands plus even use other famous voices for events. I do own a Netgear and Seagate NAS. Having the Say Commands cached on them looks like a great idea. If anybody can post a "TTS for Dummies" version that would be awesome. Currently using Responsive Voice via Sonos. I have integrated my Elk Alarm ssystem.