[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]
Becky, This look great, however Newbie question, how does one make this work if you would be so kind and provide a short tutorial would be greatly appreciated. Mike