www.homeseer.com    
 

Go Back   HomeSeer Message Board > Media Plug-ins > Media Discussion > PI-SonosController (3P)

PI-SonosController (3P) Discussion of Sonos Controller Plug-in

Reply
 
Thread Tools Display Modes
  #1  
Old March 9th, 2018, 03:50 PM
mikesnook's Avatar
mikesnook mikesnook is offline
Seer
 
Join Date: Jan 2007
Location: Westminster - MD
Posts: 56
Repeat Last spoken phrase ?

Hi Dirk, First of thank you for all the work that has gone into this plugin, its easily the most used one in my environment. Great job!

Is there a way to maybe populate a global variable with the last phrase spoken so we could have an option to repeat the last announcement if it was missed?

I see the announcements are stored in the C:\Program Files (x86)\HomeSeer HS3\html\Sonos\Announcements folder, so some scripting could be done to play the last group of wav files played for a linkgroup but modified dates of the files don't always make sense, (maybe it uses the original modified date of the wav file as your plugin isn't changing the file) I just wanted to check that something like this isn't already possible without another script.

Hope this makes sense.

Thank you,
Mike
Reply With Quote
  #2  
Old March 9th, 2018, 05:40 PM
dcorsus dcorsus is offline
OverSeer
 
Join Date: Mar 2010
Location: California
Posts: 3,737
Quote:
Originally Posted by mikesnook View Post
Hi Dirk, First of thank you for all the work that has gone into this plugin, its easily the most used one in my environment. Great job!

Is there a way to maybe populate a global variable with the last phrase spoken so we could have an option to repeat the last announcement if it was missed?

I see the announcements are stored in the C:\Program Files (x86)\HomeSeer HS3\html\Sonos\Announcements folder, so some scripting could be done to play the last group of wav files played for a linkgroup but modified dates of the files don't always make sense, (maybe it uses the original modified date of the wav file as your plugin isn't changing the file) I just wanted to check that something like this isn't already possible without another script.

Hope this makes sense.

Thank you,
Mike
Are these announcements "fixed" or "variable" ie an event that has some static text or the output of some PI or Service that is variable in nature (ex weather announcement, news ...). If the former, I'd recommend you make announcement files and use those to play on any player in any linkgroup (see help file how to play files). If the latter, the PI always overwrites existing files, so the name tend to stay the same. You could however write a script that copies the .wav file into another file and now you can play that file as many times as you want. The tricky part here is to synchronize your script with the actions happening during the TTS event. Example: you copy to early and you have the wrong info, you copy while it happens, you are likely to get multiple access errors; you copy too late and you may have the next announcement starting to overwrite the announcement file. I do believe that you can add variables like time etc to the announcement string, maybe you can do a global string (virtual device). Now all of this requires scripting SOOOO I'm sure you can script it by storing the string somewhere and the script retrieves it and issues an HS.Speak command with that string. No need to copy .wav files etc.

Dirk
Reply With Quote
  #3  
Old March 10th, 2018, 12:26 AM
mikesnook's Avatar
mikesnook mikesnook is offline
Seer
 
Join Date: Jan 2007
Location: Westminster - MD
Posts: 56
Thanks Dirk, they are almost all using variables., weather, device status etc

if others require a similar option the below vbs seems to be working, it just gets the most recently created announcement from the folder specified below and plays it as a wav file to a custom link group.

This allows me to have a button on our touch screens to click if we missed an announcement.


Code:
  
 Sub Main(Parm As Object)
 Dim fso, path, file, recentDate, recentFile, announcementLocation
 announcementLocation = "C:\Program Files (x86)\HomeSeer HS3\html\Sonos\Announcements"
 fso = CreateObject("Scripting.FileSystemObject")
recentFile = Nothing
For Each file in fso.GetFolder(announcementLocation).Files
  If (recentFile is Nothing) Then
    recentFile = file
  ElseIf (file.DateLastModified > recentFile.DateLastModified) Then
    recentFile = file
  End If
Next
 If recentFile is Nothing Then
  hs.WriteLog("Repeat Last Speech", "no recent files")
Else
  hs.speak (recentFile.path, False, "$SONOS$repeatLinkGroup$DEFAULT:*")
  hs.WriteLog("Repeat Last Speech", "Recent file to speak will be:" & recentFile.path)
End If
 End Sub
Cheers!
Mike
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Extract phrase before phrase travisdh Script & Plug-In Development 4 October 22nd, 2013 07:13 AM
OMG - I got spoken commands to this Dafunktyfunk Clients - Apple iPhone/iPod/iPad 9 December 26th, 2010 10:58 AM
Reminders not being spoken gsanders01 HSTV 8 January 7th, 2009 09:28 PM
Getting last spoken phrase rmasonjr Script & Plug-In Development 0 December 16th, 2007 06:14 PM
Period spoken as dot? ncoscia HomeSeer Voices 3 June 16th, 2003 12:31 PM


All times are GMT -4. The time now is 12:55 AM.


Copyright HomeSeer Technologies, LLC