[quote=“f1ip, post:200, topic:173177”]Sonos with Tts don’t work now.
Have anyone this problem or it’s only my ?[/quote]
Yes, everyone using Google TTS.
Please take a look at the other topic at top of this section.
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.
[quote=“lakewoodjazz, post:202, topic:173177”]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.[/quote]
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).
[quote=“becky, post:172, topic:173177”]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.
[b]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[/b]
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)[/quote]
I made one small change to make the list of events sound a little nicer. Hope you dont mind Becky
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
Not at all! Modify away! In fact, add/change anything you want! I know I have since I last posted that.
@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
I know I have since I last posted that.
Bump
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!
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.
@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
And if i want Sonos to check and Say only battery level what i have to change?
[quote=“Borat, post:110, topic:173177”]Sure here you go:
– Door/Window sensor check and speech annotation by Pasqual Zottola
local vol = 60
local son = 23
local devcnt = 0
local devno = 0
local numopen = 0
local isare = “is”
local opensensors = " "
luup.log(‘Commencing sensor device search loop’)
for deviceNo,d in pairs(luup.devices) do
if d.category_num == 4 and d.subcategory_num == 1 then
local tripped = luup.variable_get("urn:micasaverde-com:serviceId:SecuritySensor1", "Tripped", deviceNo) or "Nil"
if (tripped == "1") then
opensensors = opensensors .. ". " .. d.description .. ","
numopen = numopen + 1
end
luup.log(d.description … ’ status:’ … tripped … ’ Dev #’ … deviceNo … ’ id:’ … d.id … ’ cat #:’ … d.category_num … ’ type:’ … d.device_type)
devcnt = devcnt + 1
end
end
if numopen == 0 then --If there are no sensors tripped, log and announce!
luup.log(‘There were ’ … devcnt … ’ door and window sensors found and all are closed’)
luup.call_action(“urn:micasaverde-com:serviceId:Sonos1”, “Say”, {Text=devcnt … " sensors were checked, and all are closed. House is secure. Goodbye!", Language=“en”, Volume=vol}, son)
else --If there are any sensors tripped, log and announce!
if numopen > 1 then
isare = “are”
end
luup.log(‘There were ’ … devcnt … ’ door and window sensors found and ’ … numopen … " " … isare … ’ open’ … opensensors)
luup.call_action(“urn:micasaverde-com:serviceId:Sonos1”, “Say”, {Text=“Warning! House may not be secure,” … devcnt … " sensors were checked and " … numopen … " " … isare … " open. Check," … opensensors, Language=“en”, GroupDevices=“32”, Volume=vol}, son)
end[/quote]
[quote=“parkerc, post:16, topic:173177”]Another new one for anyone who is interested…
[size=12pt]Sonos Period Of The Day Greetings [/size]
This one will check the time of day and then great you with either Good Morning, Good Afternoon or Good Evening
[code]url = require(“socket.url”)
local t = os.date(‘*t’)
local AV_DEV = 5
local LS_SID = “urn:micasaverde-com:serviceId:Sonos1”
local current_second = t.hour * 3600 + t.min * 60 – number of sec since midnight
local morning = 0 * 3600 + 0 * 60 – 00:00
local afternoon = 12 * 3600 + 0 * 60 – 12:00
local evening = 18 * 3600 + 0 * 60 – 18:00
local name = “Chris”
if (current_second > morning) and (current_second < afternoon) then
luup.call_action(LS_SID, “Say”, {Text = string.format("Good Morning %s ", name)}, AV_DEV)
else
if (current_second > afternoon) and (current_second < evening) then
luup.call_action(LS_SID, "Say", {Text = string.format("Good Afternoon %s ", name)}, AV_DEV)
else
luup.call_action(LS_SID, "Say", {Text = string.format("Good Evening %s ", name)}, AV_DEV)
end
end[/code][/quote]
Hi everyone, I know this is an old thread but I am new to Veraplus and I wanted to get this code working with my sonos.
I have the Microsoft TTS setup and working as I tested this but when I copy the above code and change out my Sonos ID , this does not execute when i run it.
Can somone tell me where they are applying this code to get it read aloud?
Thanks
I am hoping someone that could help me out is still reading this thread. I have been using Becky’s code for sometime. I recently upgraded from a vera 3 on UI5 to a vera plus on UI7. When i added the scene to my new vera it doesn’t work I put the code in the test area ofthe vera plus and it states CODE FAILED. Could someone help with this. [code]url = require(“socket.url”)
local AV_DEV = 42,17
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”, 20)
local currentCondition = luup.variable_get(“urn:upnp-micasaverde-com:serviceId:Weather1”, “Forecast.1.Condition”, 19)
local GS_SID = “urn:srs-com:serviceId:GCalIII”
local jsonEvents = luup.variable_get(GS_SID, “gc_jsonEvents”, 55)
if ((jsonEvents == “[]”) or (jsonEvents == nil)) then
TodaysEvents=“There are no events for today.”
else
TodaysEvents="Todays events are "
end
package.loaded.json = nil
local json = require(“json”)
local eventList =json.decode(jsonEvents) <--------I think the issue could be here
local numberEvents = table.getn(eventList)
local startevent, startDate, startTime, endevent, endTime, eventname, event
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 (startDate == todaydate) then
TodaysEvents = TodaysEvents … eventname … " . "
luup.log(event)
end
end
package.loaded.json = nil
luup.call_action(LS_SID, “Say”, {Text = string.format(“Hello, Rumbold family! It is now %s. Here is your daily calendar. Today will be %s with a high of %s degrees. %s. Have a great day.”, time, currentCondition, WUGTempHigh, TodaysEvents), GroupZones=SONOSZONES, SameVolumeForAll=SameVolume, Volume=40}, AV_DEV)[/code]
Try looking at this forum topic - http://forum.micasaverde.com/index.php/topic,26692.480.html Page 33, post #480. It has the following code snippet
local json = require("dkjson") -- depending on your vera version you may need to use require("json")
local eventList =json.decode(jsonEvents)
package.loaded.json = nil
Maybe you need the dkjson “version”
Well i changed that line and the code did not fail. However i’m not home so I will have to wait until later to see if it is working.
Thanks for the tip!!!
Hi
i am using the great piece of code posted in this forum to do a security sensor check. the code is below. Does anyone know how to delay the execution of this code. I need the delay because i am triggering the scene from a amazon echo through HA-Bridge, and the echo is responding ok as the code starts to respond over the sonos system in the same room, i know its trivial but its a bit annoying.
Thanks in advance
Lloyd
local vol = 100
local son =399
local devcnt = 0
local devno = 0
local numopen = 0
local isare = “is”
local opensensors = " "
luup.log(‘Commencing sensor device search loop’)
for deviceNo,d in pairs(luup.devices) do
if d.category_num == 4 and d.subcategory_num == 1 then
local tripped = luup.variable_get("urn:micasaverde-com:serviceId:SecuritySensor1", "Tripped", deviceNo) or "Nil"
if (tripped == "1") then
opensensors = opensensors .. ". " .. d.description .. ","
numopen = numopen + 1
end
luup.log(d.description … ’ status:’ … tripped … ’ Dev #’ … deviceNo … ’ id:’ … d.id … ’ cat #:’ … d.category_num … ’ type:’ … d.device_type)
devcnt = devcnt + 1
end
end
if numopen == 0 then --If there are no sensors tripped, log and announce!
luup.log(‘There were ’ … devcnt … ’ door and window sensors found and all are closed’)
luup.call_action(“urn:micasaverde-com:serviceId:Sonos1”, “Say”, {Text=devcnt … " sensors were checked, and all are closed. House is secure. ", Language=“en”, Volume=vol}, son)
else --If there are any sensors tripped, log and announce!
if numopen > 1 then
isare = “are”
end
luup.log(‘There were ’ … devcnt … ’ door and window sensors found and ’ … numopen … " " … isare … ’ open’ … opensensors)
luup.call_action(“urn:micasaverde-com:serviceId:Sonos1”, “Say”, {Text=“Warning! House may not be secure,” … devcnt … " sensors were checked and " … numopen … " " … isare … " open. Check," … opensensors, Language=“en”, GroupDevices=“Basement, Kitchen”, Volume=vol}, son)
end
Add an appropriate delay before the luup.call_action commands…
ie:
luup.sleep(1000) – delay 1 second
Just remember … the total for any delay by a single function (loops included) should not be much more than 1 second without destabilizing Vera.
In this case this should work … in general luup.sleep is a very bad function.
Thanks very much, worked perfectly
[quote=“lloydshearer, post:216, topic:173177”]Hi
i am using the great piece of code posted in this forum to do a security sensor check. the code is below. Does anyone know how to delay the execution of this code. I need the delay because i am triggering the scene from a amazon echo through HA-Bridge, and the echo is responding ok as the code starts to respond over the sonos system in the same room, i know its trivial but its a bit annoying.
Thanks in advance
Lloyd
local vol = 100
local son =399
local devcnt = 0
local devno = 0
local numopen = 0
local isare = “is”
local opensensors = " "
luup.log(‘Commencing sensor device search loop’)
for deviceNo,d in pairs(luup.devices) do
if d.category_num == 4 and d.subcategory_num == 1 then
local tripped = luup.variable_get("urn:micasaverde-com:serviceId:SecuritySensor1", "Tripped", deviceNo) or "Nil"
if (tripped == "1") then
opensensors = opensensors .. ". " .. d.description .. ","
numopen = numopen + 1
end
luup.log(d.description … ’ status:’ … tripped … ’ Dev #’ … deviceNo … ’ id:’ … d.id … ’ cat #:’ … d.category_num … ’ type:’ … d.device_type)
devcnt = devcnt + 1
end
end
if numopen == 0 then --If there are no sensors tripped, log and announce!
luup.log(‘There were ’ … devcnt … ’ door and window sensors found and all are closed’)
luup.call_action(“urn:micasaverde-com:serviceId:Sonos1”, “Say”, {Text=devcnt … " sensors were checked, and all are closed. House is secure. ", Language=“en”, Volume=vol}, son)
else --If there are any sensors tripped, log and announce!
if numopen > 1 then
isare = “are”
end
luup.log(‘There were ’ … devcnt … ’ door and window sensors found and ’ … numopen … " " … isare … ’ open’ … opensensors)
luup.call_action(“urn:micasaverde-com:serviceId:Sonos1”, “Say”, {Text=“Warning! House may not be secure,” … devcnt … " sensors were checked and " … numopen … " " … isare … " open. Check," … opensensors, Language=“en”, GroupDevices=“Basement, Kitchen”, Volume=vol}, son)
end[/quote]
I have setup the sonos api by jishi to use amazon poly for a tts engine, the voice implementation is very very good, does anyone know how i would this tts engine in the above code. The execution line is http://192.168.10.112:5005/sayall/this is the spoken text
Thanks in advance