We have moved at community.getvera.com

Author Topic: Text To Speech (TTS) With Sonos - Creating Dynamic Messages  (Read 89424 times)

Offline dp0100

  • Sr. Newbie
  • *
  • Posts: 30
  • Karma: +2/-2
Re: Text To Speech (TTS) With Sonos - Creating Dynamic Messages
« Reply #195 on: June 24, 2015, 08:54:31 am »
Sure, np..
I'm sure there is a much easier way via LUUP but I'm kinda of new to this so I'll use the trigger/schedule functionality.
Create a new scene that is scheduled to start every morning at a predetermined time (say 8am). Then update your existing scene to trigger off of this new one that launches every morning at 8am.
If you need to end it at another time, just create a new scene that triggers at say 9pm and terminates your scene that occurs every hour. Make sense?
« Last Edit: June 24, 2015, 08:56:21 am by dp0100 »

Offline MNB

  • Hero Member
  • *****
  • Posts: 689
  • Karma: +4/-9
Re: Text To Speech (TTS) With Sonos - Creating Dynamic Messages
« Reply #196 on: June 24, 2015, 12:49:11 pm »
David,
Makes sense, I will make the update in my scene to reflect. I'm also starting to use PLEG and will experiment with it to do the same. Mike
Edge-1.7.2607, VRI06-1LX Dimr (6), VS05-1LX Sw (4), GE ZW3002 Dimr (1), HA01C Outlet (12), HA02C Sw (6), HA04C Sw (4), GE Sw (2), HA05 Sw (3), MiniMote Contr (5), HSM200/100 Sensor (2), ZW100A Sensor (8), Nest thermostat (1) & Protect Fire/CO (6) Kwikset Locks (3), F18918W (1) & IP3M-9 (6) Cam's

Offline lemrock

  • Full Member
  • ***
  • Posts: 196
  • Karma: +6/-2
Re: Text To Speech (TTS) With Sonos - Creating Dynamic Messages
« Reply #197 on: July 27, 2015, 07:41:55 pm »
There was a software update for Sonos today and now the "Say" function does not work anymore. I get an error on the Sonos that says : Unable to play "Say.***.mp3"- file is encoded incorrectly". My Sonos  has been playing the same mp3 files on a daily basis flawlessly for many many months without any issues. Is there a cure for what ails my Sonos?

Offline lemrock

  • Full Member
  • ***
  • Posts: 196
  • Karma: +6/-2
Re: Text To Speech (TTS) With Sonos - Creating Dynamic Messages
« Reply #198 on: July 27, 2015, 08:32:01 pm »
Sorry, but I made a mistake and asked this question in the wrong forum.

Offline f1ip

  • Newbie
  • *
  • Posts: 15
  • Karma: +0/-0
Re: Text To Speech (TTS) With Sonos - Creating Dynamic Messages
« Reply #199 on: July 31, 2015, 02:40:06 am »
Sonos with Tts don't work now.
Have anyone this problem or it's only my ?

Offline lolodomo

  • Moderator
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: Text To Speech (TTS) With Sonos - Creating Dynamic Messages
« Reply #200 on: July 31, 2015, 02:43:30 am »
Sonos with Tts don't work now.
Have anyone this problem or it's only my ?
Yes, everyone using Google TTS.
Please take a look at the other topic at top of this section.

Offline lakewoodjazz

  • Jr. Member
  • **
  • Posts: 53
  • Karma: +1/-0
Re: Text To Speech (TTS) With Sonos - Creating Dynamic Messages
« Reply #201 on: July 31, 2015, 11:04:19 am »
Seems Sonos update 5.4 has limited all files to a minimum of 16k sample rates and Sonos support says the Sonos app audio text is probably not meeting that requirement now. Can lolodomo help? I have a ticket started with Vera support but they said the Sonos app is third party.......
I miss my talking house.

Offline lolodomo

  • Moderator
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: Text To Speech (TTS) With Sonos - Creating Dynamic Messages
« Reply #202 on: August 03, 2015, 03:38:02 am »
Seems Sonos update 5.4 has limited all files to a minimum of 16k sample rates and Sonos support says the Sonos app audio text is probably not meeting that requirement now. Can lolodomo help? I have a ticket started with Vera support but they said the Sonos app is third party.......
I miss my talking house.

The problem is with Google that changed its API. Please read the corresponding topic in this section. I provided a fix.

5.4 is installed on all my Sonos and TTS is working well for me (Google, Microsoft and Mary).

Offline simonclark

  • Full Member
  • ***
  • Posts: 147
  • Karma: +6/-9
Re: Text To Speech (TTS) With Sonos - Creating Dynamic Messages
« Reply #203 on: November 05, 2015, 06:28:22 pm »
I'd be happy to! Below are the lines that are specific to the calendar device. Make sure you have installed the Gcal3 device and the sonos device first. You have to do a little searching on the forum, but are excellent plugins and have really great documentation!! (kudos to the developers) You'll need to change my device numbers to reflect your own.

My code is a little sloppy, but it seems to work for us.
variable and device mumbo-jumbo:

url = require("socket.url")
local AV_DEV = 48
local LS_SID = "urn:micasaverde-com:serviceId:Sonos1"
local time = os.date('%I:%M')
local todaydate = os.date('%Y-%m-%d')
local SONOSZONES="ALL"
local SameVolume="true"
local TEMP_SID ="urn:upnp-org:serviceId:TemperatureSensor1"
local WUGTempHigh = luup.variable_get(TEMP_SID, "CurrentTemperature", 33)
local currentCondition = luup.variable_get("urn:upnp-micasaverde-com:serviceId:Weather1", "Forecast.1.Condition", 30)
local GS_SID = "urn:srs-com:serviceId:GCalIII"
local jsonEvents = luup.variable_get(GS_SID, "gc_jsonEvents",52)

checking to see if there are any events for the day. if not, tell us that there are no events for today.

if ((jsonEvents == "[]") or (jsonEvents == nil)) then
  TodaysEvents="There are no events for today."
else
 TodaysEvents="Todays events are "
end


unwrapping all the different variables in the device variable.

package.loaded.json = nil
local json = require("json")
local eventList =json.decode(jsonEvents)
local numberEvents = table.getn(eventList)
local startevent, startDate, startTime, endevent, endTime, eventname, event

looping around the dumping the variables into an array

for i = 1,numberEvents do
  startevent = eventList[ i ].eventStart
  startDate = os.date("%Y-%m-%d", startevent)
  startTime = os.date("%H:%M:%S", startevent)
  endevent = eventList[ i ].eventEnd
  endTime = os.date("%H:%M:%S", endevent)
  eventname = eventList[ i ].eventName

if the event happens today, add it to the TodaysEvents variable. if not, don't add it.

  if (startDate == todaydate) then
   TodaysEvents = TodaysEvents .. eventname ..  " .       "
   luup.log(event)
  end


end
package.loaded.json = nil


and then of course sending it all to the sonos device.

luup.call_action(LS_SID, "Say", {Text = string.format("Good morning, Kirkwoods!  It is now %s. Here is your daily morning report. Today will be %s with a high of %s degrees. %s. Have a great day.", time, currentCondition, WUGTempHigh, TodaysEvents), GroupZones=SONOSZONES, SameVolumeForAll=SameVolume, Volume=50}, AV_DEV)

I made one small change to make the list of events sound a little nicer.  Hope you dont mind Becky

Code: [Select]
for i = 1,numberEvents do
  startevent = eventList[ i ].eventStart
  startDate = os.date("%Y-%m-%d", startevent)
  startTime = os.date("%H:%M:%S", startevent)
  endevent = eventList[ i ].eventEnd
  endTime = os.date("%H:%M:%S", endevent)
  eventname = eventList[ i ].eventName
  if (i == 1) then
      TodaysEvents = TodaysEvents ..  eventname ..  " .       "
      else
      TodaysEvents = TodaysEvents .. " then " .. eventname ..  " .       "
  end
  luup.log(event)
end

Offline becky

  • Jr. Member
  • **
  • Posts: 74
  • Karma: +3/-0
Re: Text To Speech (TTS) With Sonos - Creating Dynamic Messages
« Reply #204 on: November 10, 2015, 01:04:10 pm »
Not at all! Modify away! In fact, add/change anything you want! I know I have since I last posted that.

Offline MNB

  • Hero Member
  • *****
  • Posts: 689
  • Karma: +4/-9
Re: Text To Speech (TTS) With Sonos - Creating Dynamic Messages
« Reply #205 on: November 10, 2015, 06:30:34 pm »
@becky,
Based on your last post you indicate that you've also made changes, anything you're willing to share... Question I'm assuming
that statement in the LUA example "checking to see if there are any events for the day. if not, tell us that there are no events for today." is a comment that is precursor with a double dash? Mike

Quote
I know I have since I last posted that.
Edge-1.7.2607, VRI06-1LX Dimr (6), VS05-1LX Sw (4), GE ZW3002 Dimr (1), HA01C Outlet (12), HA02C Sw (6), HA04C Sw (4), GE Sw (2), HA05 Sw (3), MiniMote Contr (5), HSM200/100 Sensor (2), ZW100A Sensor (8), Nest thermostat (1) & Protect Fire/CO (6) Kwikset Locks (3), F18918W (1) & IP3M-9 (6) Cam's

Offline MNB

  • Hero Member
  • *****
  • Posts: 689
  • Karma: +4/-9
Re: Text To Speech (TTS) With Sonos - Creating Dynamic Messages
« Reply #206 on: November 13, 2015, 08:11:12 pm »
Bump
Edge-1.7.2607, VRI06-1LX Dimr (6), VS05-1LX Sw (4), GE ZW3002 Dimr (1), HA01C Outlet (12), HA02C Sw (6), HA04C Sw (4), GE Sw (2), HA05 Sw (3), MiniMote Contr (5), HSM200/100 Sensor (2), ZW100A Sensor (8), Nest thermostat (1) & Protect Fire/CO (6) Kwikset Locks (3), F18918W (1) & IP3M-9 (6) Cam's

Offline becky

  • Jr. Member
  • **
  • Posts: 74
  • Karma: +3/-0
Re: Text To Speech (TTS) With Sonos - Creating Dynamic Messages
« Reply #207 on: November 20, 2015, 12:37:24 pm »
There hasn't been anything major that I think would be useful to anyone else but my family. I wanted to tell my son what homework he had to work on, so I found an online public calendar that his teachers keep up to date and I pull that in, then tell him what assignments/tests are happening for the week when he gets home. If I was really good, I would disable the TV and all his electronics until he gets it done. I'm not that good. LOL

Everything else has been clean-up. I would like a way to tell me how long my commute is for the day (via google), however that is a blue sky thing right now. Sorry I don't have anything major to contribute!

Offline Dnomyar220

  • Sr. Newbie
  • *
  • Posts: 30
  • Karma: +0/-0
Re: Text To Speech (TTS) With Sonos - Creating Dynamic Messages
« Reply #208 on: November 20, 2015, 01:20:45 pm »
Edit: disregard below message... apparently it's google limiting use of their TTS engine, I found out from another thread. Everyone is recommending Microsoft Translator TTS now.  Leaving below post unedited in case anyone else is having this issue.

Has anyone else been noticing problems with TTS not working 100% of the time?  I have two incredibly simple commands (Welcome home", and "Garage door open") set up currently.  When I started using this, it probably worked 95% of the time.  It would miss one every once in awhile, or repeat the same command 3-4 times.  I'm guessing it's just a memory management thing with Veralite? 

Lately (past month), it seems to only hit like 60% of the commands.  Maybe it's telling me it's time to restart my veralite... I just wish there was a way to increase the RAM in that thing and speed up the whole process. 
« Last Edit: November 20, 2015, 01:24:06 pm by Dnomyar220 »

Offline MNB

  • Hero Member
  • *****
  • Posts: 689
  • Karma: +4/-9
Re: Text To Speech (TTS) With Sonos - Creating Dynamic Messages
« Reply #209 on: November 20, 2015, 01:26:01 pm »
@becky, thanxs for the comeback. Understand what your saying, however what you take as benign someone like me is interested in the ability (technique(s) to pull in a public calendar and use it within the Speak capability. Mike
Edge-1.7.2607, VRI06-1LX Dimr (6), VS05-1LX Sw (4), GE ZW3002 Dimr (1), HA01C Outlet (12), HA02C Sw (6), HA04C Sw (4), GE Sw (2), HA05 Sw (3), MiniMote Contr (5), HSM200/100 Sensor (2), ZW100A Sensor (8), Nest thermostat (1) & Protect Fire/CO (6) Kwikset Locks (3), F18918W (1) & IP3M-9 (6) Cam's