Announcement

Collapse
No announcement yet.

Dynamic linkgroup script

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

    Dynamic linkgroup script

    I have posted about this in a couple of threads and have been asked if I would share my method. To be clear, I am not proficient at scripting. While the design and methodology are all of my making, I couldn't have built the script without substantial help from my brother GPrade He has given me permission to share his work.

    The goal was to be able to send announcements to selected Sonos speakers and to vary the level of these announcements based on priority. There a variety of situations where a single Linkgroup will not work
    • When my wife works at home, she doesn't want announcements in her office
    • I power down some clients when they are not used and I don't want to send announcements to devices that are offline
    • There are a number of clients that may be online but will not always be used for announcements
    • We want alerts to be at a higher level than announcements with the ability to vary this increase in level
    To do this with 12 clients and dozens of different situations would require a large number of linkgroups and a new one to be built for each new situation.

    The first step was two sets of virtual devices to set announcement levels and client enable. The announcement Level devices allow me to fine tune levels for each client otr to mute them for all announcements. I also control the Level devices on certain clients based upon activities, such as watching TV.

    Click image for larger version  Name:	Level.PNG Views:	1 Size:	122.7 KB ID:	1268554

    The Enable Devices allow me to monitor a clients online status as well as the ability to temporarily mute a client that is online.

    Click image for larger version  Name:	Enable.PNG Views:	1 Size:	122.1 KB ID:	1268555

    I grouped these devices using Jon00's Device Grouping web page to keep them together.

    Then I control the enable devices with Events. These are designed to track the Sonos clients with UltraMon conditions and with a 10 second delay to allow temporary manual overrides.

    Click image for larger version  Name:	EnableEvents.PNG Views:	1 Size:	83.7 KB ID:	1268549

    Then I have 3 global devices to 1) vary the amount the level is boosted for alerts, 2) to allow Events to determine if an announcement is active and 3) to store the last announcement text and time. The last device allows me to ask for an announcement to be repeated through an Echo request.

    Click image for larger version  Name:	Global.PNG Views:	1 Size:	32.0 KB ID:	1268550

    I control the Announcement Active device with a pair of Events that monitor my two Linkgroups.

    Click image for larger version  Name:	SonosAnnounceActive.PNG Views:	1 Size:	45.5 KB ID:	1268551

    Click image for larger version  Name:	SonosAnnounceActiveEnd.PNG Views:	1 Size:	41.2 KB ID:	1268552

    The ANNOUNCE Linkgroup is the one I control dynamically and the NOCLIENT Linkgroup is for any hs.speak Actions that are not handled by the script.

    I also have an Event called by the script that can be used for any pre-announcement needs. This one will also set the Announcement Active device.

    Click image for larger version  Name:	SonosAnnounceSetup.PNG Views:	1 Size:	43.0 KB ID:	1268553

    In designing the script, I considered passing the text to be spoken as a parameter, but instead decided to use a tagged entry in an .ini file. I also wanted to pass a level override to the script to be used instead of the Adder Virtual Device. While the Adder Device and parameter are designed to add globally to every announcement level, negative numbers can be used to reduce levels if needed. The tagged entry in the ini file has a boolean value as to using the Adder Virtual Device. If an Adder is passed as a parameter, it overrides the setting of the virtual device. The end result is that I pass two parameters, the tag for the announcement text and a level modifier number (if desired). The script could be modified to pass the text as a parameter if desired, but I preferred to keep it all in a configuration file.

    The Sonos configuration file contains the Linkgroup structures including the Destination Player, Volume, Mute Override and whether the Player is included in the linkgroup. All Player's UDNs are included in this entry. The config file entry for any Linkgroup can be written by a plug-in function
    Code:
    hs.PluginFunction("Sonos", "", "SetLinkgroupZoneDestination", {"LINKGROUP", String})
    The script is used to build the linkgroup and write it to the .ini file, then send the TTS string to the Linkgroup. As I wrote above I use two linkgroups - NOCLIENT is used for general hs.speak TTS that is sent to all clients instead of being handled by the script. It is set manually through the Sonos Configuration page. ANNOUNCE is the Linkgroup used by the script and is assembled dynamically by the script..

    Click image for larger version  Name:	Linkgroups.PNG Views:	1 Size:	82.3 KB ID:	1268556
    HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

    #2
    Now to the script. I have cleaned it up somewhat and added some comments. Hopefully it is understandable. There are some manual edits that need to be made to the script, which I will outline first.

    At the top of the script, there are some variables declared, one of which is a boolean to turn on or off debug logging.
    Code:
         Public Trace As Boolean = True                      ' Set this to False to turn off Trace messages
    
        Sub LogTrace(ByVal Msg As String)
            If Trace Then hs.WriteLog("SonosSpeak", Msg)
        End Sub 'LogTrace
    Change it to False if you want to minimize logging.

    I needed to declare the Reference ID for my two global devices which are done here
    Code:
            Dim AlertAdderDev as integer = 5212
            Dim MessageDev as integer = 5213
    Then I needed to build a reference string containing all of my speaker clients and the associated virtual devices. it is in the format "Room;Level Device;Enable Device;Player UDN" separated by commas and enclosed in braces. The format must be exact, but spaces are ignored. Here is the string for my 13 clients
    Code:
             ' Define sonos unit control strings (Room;Level Device;Enable Device;Player UDN) - spaces are ignored
            Dim SonosUnits() As String = {
             "EX; 5524; 5522; RINCON_XXXXXXXXXXXX01400",
             "RO; 5525; 5523; RINCON_XXXXXXXXXXXX01400",
           "Shed; 5185; 5186; RINCON_XXXXXXXXXXXX01400",
             "MR; 5184; 5183; RINCON_XXXXXXXXXXXX01400",
             "LR; 5170; 5169; RINCON_XXXXXXXXXXXX01400",
       "Ft Porch; 5177; 5182; RINCON_XXXXXXXXXXXX01400",
            "Gar; 7927; 7928; RINCON_XXXXXXXXXXXX01400",
            "MBR; 5181; 5180; RINCON_XXXXXXXXXXXX01400",
            "USB; 5179; 5176; RINCON_XXXXXXXXXXXX01400",
           "Deck; 5178; 5173; RINCON_XXXXXXXXXXXX01400",
            "DSB;  225;  224; RINCON_XXXXXXXXXXXX01400",
             "MO; 5174; 5175; RINCON_XXXXXXXXXXXX01400",
             "WS; 6063; 6064; RINCON_XXXXXXXXXXXX01400"}    ' Note last item syntax!
    You would substitute your virtual devices and player UDNs. This structure is for 13 clients, if you have more or less, add or delete lines. While it might be possible to extract the UDNs from the config file, I felt it was easier to hard code the entirety of my system as a single block, since I had to match a pair of virtual devices with each client. I have edited it when I have added or replaced speaker clients.

    The name of the configuration file is SonosSpeak.ini. This is where I put my tagged speech text. A sample of it is
    Code:
    Sample;0;<silence msec='1000'/>|c:\Program Files (x86)\HomeSeer HS3\Wave\Chime2.wav|<voice required="name = $$DSR:5214:">$$DTR:8850: <silence msec='500'/> it is  $$time <silence msec='250'/>  $$DVR:3695:degrees<silence msec='250'/>  $$DVR:3699:percent humidity
    Time11;0;$$DTR:8850: <silence msec='500'/> it is  $$time <silence msec='250'/>  $$DVR:3695:degrees<silence msec='250'/>  $$DVR:3699:percent humidity
    Time;0;|c:\Program Files (x86)\HomeSeer HS3\Wave\Chime2.wav|<voice required="name = $$DSR:5214:">$$DTR:8850: <silence msec='500'/> it is  $$time <silence msec='250'/>  $$DVR:3695:degrees<silence msec='250'/>  $$DVR:3699:percent humidity
    Dryer;0;The dryer is finished
    Washer;0;The washing machine is finished
    Each line has only three entries separated by a semicolon. The first entry is the tag, used in the parameters when launching the script, the second is the boolean as to whether this is an alert and will have the value of the alert adder virtual device added to the level of all clients. The third is the text string, which can be structured exactly as the entry in a Speak Event Action, including wave files, voices, replacement variables and text to be spoken. I am including my entire configuration file and the script in the attached archive. Hopefully I have not broken the script by editing it for this post


    The rest of the script is fairly well commented and builds the Linkgroup. Then it is written to the Sonos configuration file, paused for one second (to make sure the config file is written before the plug-in reads it) then the speech action is launched. It takes about 4 seconds for an announcement to start, which about 1 second longer than a direct Speak action to an existing linkgroup. I have found the script to be a little faster than a fully configured static Linkgroup in most cases and I rarely get errors due to sending TTS to an offline client, which does happen with a static Linkgroup. Here are some log entries from just now when the time was announced.
    Code:
    Dec-21 2:00:25 PM         SonosSpeak    Announce End (event)
    Dec-21 2:00:15 PM         Event    Event Trigger "Sonos LR Speakers - Rear OFF"
    Dec-21 2:00:15 PM         Event    Event Trigger "Sonos LR Speakers - Playing Stopped"
    Dec-21 2:00:04 PM         SonosSpeak    Announce Start (event)
    Dec-21 2:00:01 PM         SonosSpeak    Group link begun
    Dec-21 2:00:00 PM         SonosSpeak    Ini fields: Alert= 0, Text=|c:\Program Files (x86)\HomeSeer HS3\Wave\Chime2.wav|$$DTR:8850: it is $$time $$DVR:3695:degrees $$DVR:3699:percent humidity
    Dec-21 2:00:00 PM         SonosSpeak    Ini entry found - Key:time, Parms=0;|c:\Program Files (x86)\HomeSeer HS3\Wave\Chime2.wav|$$DTR:8850: it is $$time $$DVR:3695:degrees $$DVR:3699:percent humidity
    Dec-21 2:00:00 PM         SonosSpeak    Input parms: Key=Time, Adder= 0
    Dec-21 2:00:00 PM         Event    Running script in background: C:/Program Files (x86)/HomeSeer HS3/scripts/SonosSpeak.vb
    Dec-21 2:00:00 PM         Event    Event Trigger "Messages Spoken - Announcements Time - Trigger - Michelle not Home - Hourly"
    The Event triggered on the hour, the actual announcement started after 4 seconds, the announcement ended after 11 seconds and the Sonos returned to playing my music after another 10 seconds.

    I have attached the script and the config file in a zip file. Here is the script for discussion
    Code:
    Imports System.IO
    Imports System.Convert
        'SonosSpeak Sonos Announcement grouping
        '
        '  Usage: SonosSpeak called from an event with the following parameters
        '         Key: first parameter - any string
        '         Adder: optional adder for volume, defaults to 0.  If any value other than 0 add value to level for all devices.  If this parameter is not numeric, set to 0
    
        ' Global variables
    
        Public IniPath As String = "C:\Program Files (x86)\HomeSeer HS3\Config\SonosSpeak.ini" 'Name text file location
        Public Trace As Boolean = True                      ' Set this to False to turn off Trace messages
        Public charSeparators() As Char = {";"c}            ' Character between parameters
        Public AlertAdder As Integer  ' Retrieve the Alert Adder
    
        Sub LogTrace(ByVal Msg As String)
            If Trace Then hs.WriteLog("SonosSpeak", Msg)
        End Sub 'LogTrace
    
        Function FindKey(ByVal Key As String) As String
            ' Find the supplied key in .ini file
            ' returns string (Alert, Text); Alert = 0 or 1; returns Nothing if no match or error
            ' .ini file format (parameters separated by a ";"
            '    Rec 1-n:
            '       Key: Key - key for this command set
            '       Alert: Flag for Alert (Null=No, 0=No, non-0=Yes)
            '       Text: Text to speak
            '       Example: Time;0;it is  $$time <silence msec='250'></silence>  $$DVR:xxxx:degrees<silence msec='250'></silence>  $$DVR:xxxx:percent humidity;true;$SONOS$ANNOUNCE$:*
            Dim IniParms() As String
            Dim Lines() As String = File.ReadAllLines(IniPath)  ' Read entire file
    
            For Each line As String In Lines                        ' Parse a line at a time
                IniParms = line.Split(charSeparators, 2, StringSplitOptions.None)   ' Extract the key
                If Key.ToLower() = IniParms(0).ToLower() Then
                    LogTrace("Ini entry found - Key:" & IniParms(0).ToLower() & ", Parms=" & IniParms(1))
                    Dim Parms() As String = IniParms(1).Split(charSeparators, 2, StringSplitOptions.None)
                    If Parms.Length < 2 Then
                        hs.WriteLog("Warning", "SonosSpeak Invalid entry for " & Key & " in .ini file; entry ignored")
                        Return Nothing                          ' Bad ini entry (no text)
                    End If
                    Dim Text As String = Parms(1)
                    Dim Alert As Integer
                    If Not Integer.TryParse(Parms(0), Alert) Then
                        Alert = 0                               ' Alert not a valid number
                    ElseIf Alert <> 0 Then
                        Alert = 1                             ' Alert integer not equal to 0
                    Else
                        Alert = 0                               ' Alert zero
                    End If
                    Return Alert.ToString.Trim() & ";" & Text   ' Return concatenated string
                End If
            Next
            hs.WriteLog("Warning", "SonosSpeak Key " & Key & " not found")
            Return Nothing                                      ' No match for key
        End Function 'Key
    
        Public Sub Main(ByVal InParms As String)
            hs.TriggerEvent ("Sonos Announce Setup") 'Optional event to perform pre-announcement setup
    
            Dim AlertAdderDev as integer = 5212
            Dim MessageDev as integer = 5213
    
            ' Define sonos unit control strings (Room;Level Device;Enable Device;Player UDN) - spaces are ignored
            Dim SonosUnits() As String = {
             "EX; 5524; 5522; RINCON_XXXXXXXXXXXX01400",
             "RO; 5525; 5523; RINCON_XXXXXXXXXXXX01400",
           "Shed; 5185; 5186; RINCON_XXXXXXXXXXXX01400",
             "MR; 5184; 5183; RINCON_XXXXXXXXXXXX01400",
             "LR; 5170; 5169; RINCON_XXXXXXXXXXXX01400",
       "Ft Porch; 5177; 5182; RINCON_XXXXXXXXXXXX01400",
            "Gar; 7927; 7928; RINCON_XXXXXXXXXXXX01400",
            "MBR; 5181; 5180; RINCON_XXXXXXXXXXXX01400",
            "USB; 5179; 5176; RINCON_XXXXXXXXXXXX01400",
           "Deck; 5178; 5173; RINCON_XXXXXXXXXXXX01400",
            "DSB;  225;  224; RINCON_XXXXXXXXXXXX01400",
             "MO; 5174; 5175; RINCON_XXXXXXXXXXXX01400",
             "WS; 6063; 6064; RINCON_XXXXXXXXXXXX01400"}    ' Note last item syntax!
            Dim sa() As String                              ' Scratch string array
            Dim Alert As Integer                            ' Alert if non-zero
            Dim LinkString As String = ""                   ' Linkgroup string
            Dim IniString As String                         ' String from ini file
            Dim level As Integer                            ' Level for announcement
            Dim incl As Integer                             ' Include unit in linkgroup flag if enable device is on
            Dim Adder As Integer                            ' The volume adder provided to script
            Dim Key As String                               ' The first parameter as a string
            Dim MsgText As String                           ' The message text to be passed to the plugin
    
            ' Extract and validate calling parameters
            Key = ""
            Adder = 0                                       ' Default for no Adder provided
            If InParms IsNot Nothing Then
                sa = Split(InParms.ToString, ";")
                If sa.Length() >= 1 Then Key = sa(0)
                If sa.Length() >= 2 Then
                    If Not Integer.TryParse(sa(1).Trim, Adder) Then Adder = 0
                End If
            End If
            LogTrace("Input parms: Key=" & Key & ", Adder=" & Str(Adder))
            IniString = FindKey(Key)
            If IniString Is Nothing Then
                hs.WriteLog("Warning", "SonosSpeak No ini match for key=" & Key)
                Return
            End If
            sa = IniString.Split(";"c)                      ' Extract Alert and Text string from ini entry
            Alert = CType(sa(0), Integer)
            MsgText = sa(1)
            hs.WriteLog("SonosSpeak", "Ini fields: Alert=" & Str(Alert) & ", Text=" & MsgText)        'added to provide logging when Logtrace disabled above
            'LogTrace("Ini fields: Alert=" & Str(Alert) & ", Text=" & MsgText)
            AlertAdder = hs.DeviceValue(AlertAdderDev) 'Alert increase virtual device
            ' For each device string entry parse the elements into separate strings and build linkgroup        
            For Each SonosUnitString As String In SonosUnits
                If LinkString <> "" Then LinkString &= "|"              ' Append separator when not the first
                sa = SonosUnitString.Split(";")
                LinkString &= sa(3).Trim() & ";"                        ' Append Sonos Player UDN
                level = hs.DeviceValue(Convert.ToInt32(sa(1).Trim()))   ' Get Level from level virtual device
                If Adder <> 0 Then                                      ' An Adder was provided on the call - it supersedes
                    level += Adder                                      ' ... so just add the adder provided
                ElseIf Alert <> 0 Then                                  ' If its an alert, increase it by alert level virtual device
                    level += AlertAdder
                End If
                level = Math.Min(level, 99)                             ' Keep <= 99
                level = Math.Max(level, 0)                              ' ... also keep >= 0
                LinkString &= Str(level).Trim() & ";"                   ' Append Level
                LinkString &= "1;"                                      ' Append Mute override
                incl = hs.DeviceValue(Convert.ToInt32(sa(2).Trim()))    ' Get Include flag
                If level = 0 Then incl = 0                              ' Don't include if level = 0
                LinkString &= Str(incl).Trim()                          ' Append Include 1=Sonos Device included 0=Not included
            Next SonosUnitString
            LogTrace(LinkString)
    
            ' Linkgroup built, now write it to Sonos ini file
            hs.PluginFunction("Sonos", "", "SetLinkgroupZoneDestination", {"ANNOUNCE", LinkString})
    
            hs.SetDeviceString(MessageDev, MsgText, True)               'Write last announcement to virtual device
            hs.WaitSecs(1)                           ' Use this if thread.Sleep does weird things.  Only integer seconds allowed, though
            LogTrace("Group link begun")
            hs.speak (MsgText, True, "$SONOS$ANNOUNCE$:*")     'speak message to Sonos Linkgroup.
    Use an Event to launch the script and pass the tag and adder (if desired) separated by a semicolon.


    SonosSpeak.zip
    Attached Files
    HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

    Comment


      #3
      Thank you so much for this!!!!

      Comment


        #4
        Thanks for sharing. Impressive setup !

        Comment


          #5
          Randy, firstly many thanks for providing your SONO solution. I have some basic questions (I'm trying to absorb something new);
          1) I'm assuming that you have pairs of events (Offline and Online) for each speaker client?
          2) looking at your linkgroups I notice that "Gar" wasn't selected (green arrow) so I'm assuming that other than showing state your not sending any announcements to the garage?
          3) Intercept Speaker Devices you have "0,100" for Noclient and nothing for Announce linkgroup?
          4) Noticed that between your NoClient and Announce linkgroup that the not all of the same speaker devices have been selected between both, I'm assuming that the script controls this?
          5) Can you provide a event example for the
          launch the script and pass the tag and adder (if desired) separated by a semicolon

          Then I control the enable devices with Events. These are designed to track the Sonos clients with UltraMon conditions and with a 10 second delay to allow temporary manual overrides.

          Click image for larger version  Name:	EnableEvents.PNG Views:	1 Size:	83.7 KB ID:	1268549
          Computer: CUK Intel NUC7i7BNH
          Op System: Windows10 Pro - Work Station
          HS Version: HS4 Pro Edition 4.2.19.0

          Plug-Ins: AK Weather 4.0.5.25,APCUPSD 3.3.2.3,BLBackup 2.0.63.0,BLEditor 2.0.11.0,BLGData 3.0.55.0,BLOccupied 2.0.28.0,BLShutdown 1.0.6.0,Blue-Iris 3.1.3.33206,Device History 3.2.0.2,EasyTrigger 3.0.0.76,Harmony Hub 4.0.14.0,iRobot 5.22.41.1,JowiHue 4.0.8.7,Nest 3.0.0.34,NetCam Plugin 1.0.0.5,PHLocation2 3.0.0.64,Pushover 4.0.10.0,Random 3.0.0.2,Restart 1.0.0.7,Ring 1.0.0.9,SDJ-Health 3.1.1.3,Sonos 3.1.0.59,Sonos4 4.0.1.12,UltraCID3 3.0.6681.34300,UltraMon3 3.0.6554.33094,UltraNetCam3 3.0.6413.20219,Unifi 4.0.32.0,Zigbee 4.0.11.0,Z-Wave 4.0.3.0, and Jon00 scripts.

          Comment


            #6
            Originally posted by MNB View Post
            Randy, firstly many thanks for providing your SONO solution. I have some basic questions (I'm trying to absorb something new);
            1) I'm assuming that you have pairs of events (Offline and Online) for each speaker client?
            2) looking at your linkgroups I notice that "Gar" wasn't selected (green arrow) so I'm assuming that other than showing state your not sending any announcements to the garage?
            3) Intercept Speaker Devices you have "0,100" for Noclient and nothing for Announce linkgroup?
            4) Noticed that between your NoClient and Announce linkgroup that the not all of the same speaker devices have been selected between both, I'm assuming that the script controls this?
            5) Can you provide a event example
            Yes, have an online and offline event for each client.
            The linkgroups are built on the fly, so Garage will not be selected unless they are online. Workshop, Deck, Shed, and Front Porch speakers are not usually powered on, so they will not be included in linkgroups unless they are powered on. That is what the online and offline events take care of.
            The intercept device for the HomeSeer default audio is 0. I have also seen 100 used for another speech proxy, but I don't recall which one. The "NoClient linkgroup is only going to be used when hs.speak is sent to all clients (no Sonos linkgroup defined). This is for any speak action to all HS clients. The script only builds the "Announce" linkgroup. The "NoClient" linkgroup is defined in Sonos config.

            The Event would just call the script and pass two parameters - the tag and alert adder if needed. For instance to speak an entry "DadIsHome" with the level increased by 10 the parameters would be "DadIsHome; 10".
            HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

            Comment


              #7
              Randy, could you share what one of your announcement level and client virtual devices "Status Graphics" are setup as? It looks like your increment your volume by 5? Mike

              The first step was two sets of virtual devices to set announcement levels and client enable. The announcement Level devices allow me to fine tune levels for each client or to mute them for all announcements. I also control the Level devices on certain clients based upon activities, such as watching TV.
              Computer: CUK Intel NUC7i7BNH
              Op System: Windows10 Pro - Work Station
              HS Version: HS4 Pro Edition 4.2.19.0

              Plug-Ins: AK Weather 4.0.5.25,APCUPSD 3.3.2.3,BLBackup 2.0.63.0,BLEditor 2.0.11.0,BLGData 3.0.55.0,BLOccupied 2.0.28.0,BLShutdown 1.0.6.0,Blue-Iris 3.1.3.33206,Device History 3.2.0.2,EasyTrigger 3.0.0.76,Harmony Hub 4.0.14.0,iRobot 5.22.41.1,JowiHue 4.0.8.7,Nest 3.0.0.34,NetCam Plugin 1.0.0.5,PHLocation2 3.0.0.64,Pushover 4.0.10.0,Random 3.0.0.2,Restart 1.0.0.7,Ring 1.0.0.9,SDJ-Health 3.1.1.3,Sonos 3.1.0.59,Sonos4 4.0.1.12,UltraCID3 3.0.6681.34300,UltraMon3 3.0.6554.33094,UltraNetCam3 3.0.6413.20219,Unifi 4.0.32.0,Zigbee 4.0.11.0,Z-Wave 4.0.3.0, and Jon00 scripts.

              Comment


                #8
                They are 1-100 level + muted. We usually step them in 5% increments, but the resolution is in 1%.

                Click image for larger version  Name:	A2A03733-E808-45D6-81D1-B728196A11D6.jpeg Views:	1 Size:	49.9 KB ID:	1290965
                HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

                Comment


                  #9
                  Hey Randy,
                  1) Looking at the attached event you have a "Message spoken Announcement Active" virtual device what is it for (see first graphic)? What's different from you global device #5088 "Announcement Active"?
                  .
                  2) What does your Alert Adder Virtual Device look like? I'm assuming that it add or subtracts speaker volume at a global level whilst the Announcement Level control individual speakers? Mike

                  .
                  3) Can you provide examples of your "Sonos Announce Setup" events (see second graphic) e.g. "Sonos Sonos Announce - MBR or MR"?

                  .
                  4) So I've pretty much am "dressed in my party dressed for the Prom" but am not quite there! Re-reading your writeup it looks like I need an "Run a Script" event, with the following Parameters: [Tag,0] Tag = one of the SonoSpeak.ini premade speak line and 0 = Alert Adder value (increases the volume by X). Said another way I'm creating multiple events with Sonos Speak script and using different tags as needed? I should read your earlier post (my bad) but I noticed that in your example your using an ";" (semicolon) as a delimitator I thought normally its a "," (comma)?
                  .
                  The Event would just call the script and pass two parameters - the tag and alert adder if needed. For instance to speak an entry "DadIsHome" with the level increased by 10 the parameters would be "DadIsHome; 10".
                  .
                  5) I assume that the various LinkGroup I previously created should be now deleted and I'm left with NOCLIENT and ANNOUNCE only? Reading your text above if I'm sending TTS to all clients I should use NOCLIENT with general hs.speak TTS and ANNOUNCE for selected clients?

                  .
                  6) What writes (event/script) to your "Last Announcement" Ref ID 5213?

                  .
                  7) Looking at your SonoSpeak.ini you have a Ref ID of 8850 called out multiple times what is it?
                  .
                  Attached Files
                  Computer: CUK Intel NUC7i7BNH
                  Op System: Windows10 Pro - Work Station
                  HS Version: HS4 Pro Edition 4.2.19.0

                  Plug-Ins: AK Weather 4.0.5.25,APCUPSD 3.3.2.3,BLBackup 2.0.63.0,BLEditor 2.0.11.0,BLGData 3.0.55.0,BLOccupied 2.0.28.0,BLShutdown 1.0.6.0,Blue-Iris 3.1.3.33206,Device History 3.2.0.2,EasyTrigger 3.0.0.76,Harmony Hub 4.0.14.0,iRobot 5.22.41.1,JowiHue 4.0.8.7,Nest 3.0.0.34,NetCam Plugin 1.0.0.5,PHLocation2 3.0.0.64,Pushover 4.0.10.0,Random 3.0.0.2,Restart 1.0.0.7,Ring 1.0.0.9,SDJ-Health 3.1.1.3,Sonos 3.1.0.59,Sonos4 4.0.1.12,UltraCID3 3.0.6681.34300,UltraMon3 3.0.6554.33094,UltraNetCam3 3.0.6413.20219,Unifi 4.0.32.0,Zigbee 4.0.11.0,Z-Wave 4.0.3.0, and Jon00 scripts.

                  Comment


                    #10
                    Randy, I apologize for the multiple questions and promise to be finished once I understand how you solved the above questions. I have to say your Sonos concept is quite interesting and takes a few passes to review/understand what's going on for those of us that are not programmers by trade, kudos to your brother's script it is well laid out and document that fool like me can follow the logic.

                    I'm trying to understand how one turns off a speaker using the "Announce Enable XXX" as it's being controlled by the two events based on UltraMon results, if one manually changes a speaker to off, after 10 sec it turn back On or the speaker it's self is powered off, so I'm thinking that the only way to turn off a speaker is via the "Announcement Level XX" device by setting to "0" would stop any messages from being spoken?

                    I'm assuming that the
                    "Sonos Announce Setup" events is were you setup which speakers to use for each announcement or am I missing something? Again Thanxs to another great HS3 solution, Mike
                    Computer: CUK Intel NUC7i7BNH
                    Op System: Windows10 Pro - Work Station
                    HS Version: HS4 Pro Edition 4.2.19.0

                    Plug-Ins: AK Weather 4.0.5.25,APCUPSD 3.3.2.3,BLBackup 2.0.63.0,BLEditor 2.0.11.0,BLGData 3.0.55.0,BLOccupied 2.0.28.0,BLShutdown 1.0.6.0,Blue-Iris 3.1.3.33206,Device History 3.2.0.2,EasyTrigger 3.0.0.76,Harmony Hub 4.0.14.0,iRobot 5.22.41.1,JowiHue 4.0.8.7,Nest 3.0.0.34,NetCam Plugin 1.0.0.5,PHLocation2 3.0.0.64,Pushover 4.0.10.0,Random 3.0.0.2,Restart 1.0.0.7,Ring 1.0.0.9,SDJ-Health 3.1.1.3,Sonos 3.1.0.59,Sonos4 4.0.1.12,UltraCID3 3.0.6681.34300,UltraMon3 3.0.6554.33094,UltraNetCam3 3.0.6413.20219,Unifi 4.0.32.0,Zigbee 4.0.11.0,Z-Wave 4.0.3.0, and Jon00 scripts.

                    Comment


                      #11
                      Originally posted by MNB View Post
                      Randy, I apologize for the multiple questions and promise to be finished once I understand how you solved the above questions. I have to say your Sonos concept is quite interesting and takes a few passes to review/understand what's going on for those of us that are not programmers by trade, kudos to your brother's script it is well laid out and document that fool like me can follow the logic.

                      I'm trying to understand how one turns off a speaker using the "Announce Enable XXX" as it's being controlled by the two events based on UltraMon results, if one manually changes a speaker to off, after 10 sec it turn back On or the speaker it's self is powered off, so I'm thinking that the only way to turn off a speaker is via the "Announcement Level XX" device by setting to "0" would stop any messages from being spoken?

                      I'm assuming that the
                      "Sonos Announce Setup" events is were you setup which speakers to use for each announcement or am I missing something? Again Thanxs to another great HS3 solution, Mike

                      No, the Sonos Announce Setup just fixes speaker switching based upon the entertainment status in the three rooms with surround receivers (MBR, Living Room and Media Room). In those rooms, if we are watching TV in one of those rooms the Sonos is routed to the rear speakers, if not it is routed to the front.

                      To mute a particular room during certain announcements I just bump the Announce Enable virtual device for that room to Off.


                      Click image for larger version  Name:	Capture.PNG Views:	1 Size:	109.4 KB ID:	1291433

                      The way the Event is structured, that device will be turned back on after a 10 second delay. It will also wait until any announcement has ended. You can also use the plug-in native "Is Online" condition instead of UltraMon.

                      Click image for larger version  Name:	Capture.PNG Views:	1 Size:	65.2 KB ID:	1291437
                      HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

                      Comment


                        #12
                        Thanxs for the comeback, that clever I did not think about using the 10 sec trigger in that manner. I'm still confused as to where your setting which speakers to use for which when your ready to speak something do simply turn each speaker off that I don't want in the announcement similar to your "Time-Trigger-always-Hourly" where you turn off a single speaker, then run the Sonos Script event?

                        If that's the case I could create static events that turn off selected speakers that I do not want also?
                        Computer: CUK Intel NUC7i7BNH
                        Op System: Windows10 Pro - Work Station
                        HS Version: HS4 Pro Edition 4.2.19.0

                        Plug-Ins: AK Weather 4.0.5.25,APCUPSD 3.3.2.3,BLBackup 2.0.63.0,BLEditor 2.0.11.0,BLGData 3.0.55.0,BLOccupied 2.0.28.0,BLShutdown 1.0.6.0,Blue-Iris 3.1.3.33206,Device History 3.2.0.2,EasyTrigger 3.0.0.76,Harmony Hub 4.0.14.0,iRobot 5.22.41.1,JowiHue 4.0.8.7,Nest 3.0.0.34,NetCam Plugin 1.0.0.5,PHLocation2 3.0.0.64,Pushover 4.0.10.0,Random 3.0.0.2,Restart 1.0.0.7,Ring 1.0.0.9,SDJ-Health 3.1.1.3,Sonos 3.1.0.59,Sonos4 4.0.1.12,UltraCID3 3.0.6681.34300,UltraMon3 3.0.6554.33094,UltraNetCam3 3.0.6413.20219,Unifi 4.0.32.0,Zigbee 4.0.11.0,Z-Wave 4.0.3.0, and Jon00 scripts.

                        Comment


                          #13
                          Every time you open the preverbal "Kimono" .. What is the "Messages spoken Time" ?
                          Computer: CUK Intel NUC7i7BNH
                          Op System: Windows10 Pro - Work Station
                          HS Version: HS4 Pro Edition 4.2.19.0

                          Plug-Ins: AK Weather 4.0.5.25,APCUPSD 3.3.2.3,BLBackup 2.0.63.0,BLEditor 2.0.11.0,BLGData 3.0.55.0,BLOccupied 2.0.28.0,BLShutdown 1.0.6.0,Blue-Iris 3.1.3.33206,Device History 3.2.0.2,EasyTrigger 3.0.0.76,Harmony Hub 4.0.14.0,iRobot 5.22.41.1,JowiHue 4.0.8.7,Nest 3.0.0.34,NetCam Plugin 1.0.0.5,PHLocation2 3.0.0.64,Pushover 4.0.10.0,Random 3.0.0.2,Restart 1.0.0.7,Ring 1.0.0.9,SDJ-Health 3.1.1.3,Sonos 3.1.0.59,Sonos4 4.0.1.12,UltraCID3 3.0.6681.34300,UltraMon3 3.0.6554.33094,UltraNetCam3 3.0.6413.20219,Unifi 4.0.32.0,Zigbee 4.0.11.0,Z-Wave 4.0.3.0, and Jon00 scripts.

                          Comment


                            #14
                            Originally posted by MNB View Post
                            Thanxs for the comeback, that clever I did not think about using the 10 sec trigger in that manner. I'm still confused as to where your setting which speakers to use for which when your ready to speak something do simply turn each speaker off that I don't want in the announcement similar to your "Time-Trigger-always-Hourly" where you turn off a single speaker, then run the Sonos Script event?

                            If that's the case I could create static events that turn off selected speakers that I do not want also?
                            I usually want announcements sent to all active clients except the front porch and deck. The time announcement Event is an example where I want it to go to all active clients except my wife's office. When she works at home, she doesn't want the announcements in her office. That Event is a legacy, because I now kill all announcements to her office when the company supplied laptop is online and set it back to a preset level when the computer is offline. Adding default level virtual devices a few weeks ago gave me even more flexibility. In addition to being able to mute her office and then restore it to a default level, I could also bump the volume of announcements whenever we are watching TV. After making that change we actually settled on reducing the volume of the TV during announcements using the Harmony plug-in. Nevertheless the default level devices gives me more flexibility in setting the announcement level as needed on a case by case basis.


                            Click image for larger version  Name:	image_77524.png Views:	1 Size:	85.1 KB ID:	1291443
                            HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

                            Comment


                              #15
                              Its interesting I had not used UltraMon3 but for a few events, I can now see using more similar to your case with your wife's office. I'm see the potentials. I know I'm thinking and posting several times on the same post which makes it hard to keep up if your not refreshing ones page... I was thinking about creating a few standard events where I would turn-off clients that I do not want to speak similar to what I did using the Sonos PI which would useable for multiple speak instances that I didn't need to add each one within a SonoSpeak event every time and only list unique setups similar to what your did to your wife's Office, your thoughts?
                              Computer: CUK Intel NUC7i7BNH
                              Op System: Windows10 Pro - Work Station
                              HS Version: HS4 Pro Edition 4.2.19.0

                              Plug-Ins: AK Weather 4.0.5.25,APCUPSD 3.3.2.3,BLBackup 2.0.63.0,BLEditor 2.0.11.0,BLGData 3.0.55.0,BLOccupied 2.0.28.0,BLShutdown 1.0.6.0,Blue-Iris 3.1.3.33206,Device History 3.2.0.2,EasyTrigger 3.0.0.76,Harmony Hub 4.0.14.0,iRobot 5.22.41.1,JowiHue 4.0.8.7,Nest 3.0.0.34,NetCam Plugin 1.0.0.5,PHLocation2 3.0.0.64,Pushover 4.0.10.0,Random 3.0.0.2,Restart 1.0.0.7,Ring 1.0.0.9,SDJ-Health 3.1.1.3,Sonos 3.1.0.59,Sonos4 4.0.1.12,UltraCID3 3.0.6681.34300,UltraMon3 3.0.6554.33094,UltraNetCam3 3.0.6413.20219,Unifi 4.0.32.0,Zigbee 4.0.11.0,Z-Wave 4.0.3.0, and Jon00 scripts.

                              Comment

                              Working...
                              X