Announcement

Collapse
No announcement yet.

Feature request

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Originally posted by rprade View Post
    It would still be very helpful if I had some device that could tell me whether Sonos TTS is active or not. This is why I started this thread. If I had some way of being able to determine if TTS is running or not, it would really help with controlling announcements that aren't specifically sent to Sonos, but intercepted from another client.

    Ideally it would be a device controlled by the plug-in "TTS Active" that could be used as a trigger or condition within an event. It could even be included in Sonos Triggers and Sonos Conditions when any client is "Announcing".
    Until/if Dirk implements this, you could do a workaround by creating your own virtual device that is set to "active" every time one of your announcements is triggered. Knowing when the announcement is over is more problematic. You could have a timer that is run when the announcement starts that will reset the virtual device back to "inactive". You could use different times for the timer based on how long each announcment is. It would get complicated when more than one announcement is run sequentially, but I'm sure it could be done.

    Maybe you should make a separate thread for this feature request.

    Comment


      #17
      Originally posted by prsmith777 View Post
      Until/if Dirk implements this, you could do a workaround by creating your own virtual device that is set to "active" every time one of your announcements is triggered. Knowing when the announcement is over is more problematic. You could have a timer that is run when the announcement starts that will reset the virtual device back to "inactive". You could use different times for the timer based on how long each announcement is. It would get complicated when more than one announcement is run sequentially, but I'm sure it could be done.

      Maybe you should make a separate thread for this feature request.
      That is actually what the first request in the first post of this thread was for

      For now I turn a virtual device on when an announcement is started, then a second event will turn it off if any active client changes and goes to "Stopped" if the announcement virtual device has been on for at least 10 seconds. After an announcement all devices go to stop and 10 seconds gives the plug-in enough time to build a linkgroup and start an announcement.
      HS4 Pro, 4.2.19.0 Windows 10 pro, Supermicro LP Xeon

      Comment


        #18
        Here is how I handled the script. It may be more than some want, but it works for me. I have what might be a unique situation in that up to 5 of my Sonos clients may be powered off. For that reason I have 2 virtual devices per client. The first one is the announcement level and the second is the "Include" device that is set to On(1) if the Sonos client is online and to Off(0) if it is Offline. I do not want a client included in the linkgroup if it is not online - this prevents errors when the plug-in tries to build a linkgroup. The announcement level is as I posted above 0=Muted and 1-100 is the level. I also don't want a device included in the linkgroup unless it is set at some level other then Muted (0). Before I do an announcement, I run the script so that the linkgroup is built. Only devices that are online and have a level greater than 0 are included. The levels will be adjusted if we are watching TV or other activities that may call for more or less volume on announcements and some clients may be muted at certain times.

        This script evaluates the two virtual devices per client and builds the linkgroup accordingly. I've been testing it all day and it is working perfectly.

        Code:
        'Sonos Linkgroup - builds announcement group using virtual devices.  
        
        Sub Main(parm as object)
        
        ' Define sonos unit control strings (Room;Device;Level;Include) - spaces are ignored
        	Dim SonosUnits() As String = {
        		"RO;   5178; 5173; RINCON_000E583C92DE01400", _
        		"USB;  5179; 5176; RINCON_949F3E1ED0A201400", _
        		"MBR;  5181; 5180; RINCON_000E583177CA01400", _
        		"MR;   5184; 5183; RINCON_000E58D8669E01400", _	
        		"MO;   5174; 5175; RINCON_5CAAFD97C8FA01400", _	
        		"Shed; 5185; 5186; RINCON_000E58D92EE201400", _
        		"LR;   5170; 5169; RINCON_000E58D91EBE01400", _
        		"DSB;  5177; 5182; RINCON_5CAAFD4F8BBC01400" }   ' Note last item syntax!
        	Dim elements() As String
        	Dim LinkString As String = ""
        	Dim level As Integer
        	Dim incl As Integer
        
        ' For each string entry , above, parse the elements into separate strings		
        	For Each SonosUnitString as String In SonosUnits
        		If LinkString <> "" Then LinkString &= "|"				' Append separator
        		elements = SonosUnitString.Split(";")
        		LinkString &= elements(3).Trim() & ";" 					' Append device id
        		level = hs.DeviceValue (elements(1).Trim())				' Get Level
        		LinkString &= (str(level).Trim()) & ";"					' Append Level
        		LinkString &= "1;"							' Append Mute
        		incl = hs.DeviceValue (elements(2).Trim())				' Get Include flag
        		If level = 0 Then incl = 0						' Don't include if level = 0
        		LinkString &= (str(incl).Trim())					' Append Include
        											
        	Next SonosUnitString
        	'hs.WriteLog("Trace", LinkString)
        	hs.pluginfunction("Sonos", "", "SetLinkgroupZoneDestination", {"ANNOUNCE", LinkString})
        End Sub
        If I add or replace units all I need to do is add to or edit the unit control strings.

        Thanks to brother Gary for helping me build the script.
        HS4 Pro, 4.2.19.0 Windows 10 pro, Supermicro LP Xeon

        Comment


          #19
          Looks good Randy.

          I wish there was a way to change the delay on when Sonos Plugin unlinks the announcement grouping and reverts back to baseline. I have a motion detector at the front door which announces. I also have a doorbell that announces when its rung. When someone walks up to the door and rings the doorbell, there is a long delay for the doorbell to announce, because the plugin is cycling out of the linking from the motion announcement and then cycling back into the linking for the doorbell announcement. If I could adjust the delay using scripting, I could set the delay longer for the front door motion and there would be no long delay between the two. It would need to be an adjustable delay, perhaps in the INI file like the linkgrouping.

          Comment


            #20
            Originally posted by rprade View Post
            Is there any way we could have Sonos Trigger or Condition when a TTS announcement is active. Triggers would be "Sonos Announcement begins" and "Sonos Announcement ends". The Condition would be "Sonos Announcement Active".
            Looking at this but not a whole lot of free time .....

            Dirk

            Comment


              #21
              Originally posted by dcorsus View Post
              Looking at this but not a whole lot of free time .....

              Dirk
              No problem. When you have time.
              HS4 Pro, 4.2.19.0 Windows 10 pro, Supermicro LP Xeon

              Comment


                #22
                Add conditions and trigger for announcements

                Only very cursory testing.....
                download attached and unzip in HS root.
                Let me know what you learn.
                Dirk
                Last edited by dcorsus; September 26, 2017, 10:22 PM.

                Comment


                  #23
                  Originally posted by dcorsus View Post
                  Only very cursory testing.....
                  download attached and unzip in HS root.
                  Let me know what you learn.
                  Dirk
                  Thanks.

                  I just tested the announce start and end triggers and they seem to work fine. The announcement end trigger will really help, because it triggers after the linkgoup is deconstructed and the Sonos devices are returned to their original state.

                  With my linkgroup construction script and these new triggers, I should be able to make the Sonos announcements reliable and flexible.

                  I'll play some ore tomorrow and let you know.
                  HS4 Pro, 4.2.19.0 Windows 10 pro, Supermicro LP Xeon

                  Comment


                    #24
                    5 days in and the change is working perfectly. The ability to trigger on different Linkgroups lets me handle speech that is sent to the HS default client differently than speech specifically sent to Sonos. It also lets me dynamically setup linkgroup values based upon virtual devices and one of two scripts I have.

                    Thank you for the change!
                    HS4 Pro, 4.2.19.0 Windows 10 pro, Supermicro LP Xeon

                    Comment


                      #25
                      I would like to know how you did the virtual devices with Volumes? I am wondering if I could use a virtual device to adjust the volume of my grouped Sonos speakers up or down based on voice command? I was thinking that using a virtual device might work.

                      Comment

                      Working...
                      X