jwilson56
November 7th, 2008, 07:50 AM
Voice :Speak("The System will NOT be armed")
-- Change these to your zone names ['elk zone name']='spoken voice name'
local zones = {
['Front Door'] = 'Front Door',
['Back Door'] = 'Back Door',
['Kitchen Window E'] = 'Kitchen East Side Window',
['Kitchen Window S'] = 'Kitchen South Side Window',
['Living Room S'] = 'Living Room South Side Window',
['Guest Room E'] = 'Guest Room East Side Window',
['Bedroom E'] = 'Bedroom East Side Window',
['Den W'] = 'Den West Side Window',
['Den N'] = 'Den North Side Window',
}
-- builds device list control using filter list
-- filter = {location = ,name = , devicetype = )
local function BuildDeviceListControl (filterlist)
local changed = false
-- device list
local dl = {}
for _,filter in ipairs (filterlist) do
local list = DeviceManager:GetDevices (filter.Location,filter.Name,filter.DeviceType,fil ter.Abilities)
for _,device in ipairs (list) do
table.insert (dl,device)
end
end
table.sort (dl,function (a,b) return a:GetLocationName () < b:GetLocationName () end )
local locnamelist = {}
local devicesindextopath = {}
for i,d in ipairs (dl) do
table.insert (locnamelist, d:GetLocationName())
devicesindextopath [i-1] = d:GetPath () -- itemindex is 0 based
end
if table.getn (locnamelist) < 1 then -- no devices
table.insert (locnamelist,nodevices)
end
return locnamelist, devicesindextopath -- true if the any of the menus changed
end
local FilterList = {{DeviceType = 'Security\\Zone'}}
local Devices, Paths = BuildDeviceListControl (FilterList)
for k,v in ipairs(Paths) do
local device = DeviceManager:GetDeviceUsingPath (v)
if device then
if device:GetControl('Condition'):GetValue() == 'Violated' and zones[device:GetName()] then
print (zones[device:GetName()], device:GetName())
Voice :Speak(zones[device:GetName()]..' Violated')
end
end
end
-- Change these to your zone names ['elk zone name']='spoken voice name'
local zones = {
['Front Door'] = 'Front Door',
['Back Door'] = 'Back Door',
['Kitchen Window E'] = 'Kitchen East Side Window',
['Kitchen Window S'] = 'Kitchen South Side Window',
['Living Room S'] = 'Living Room South Side Window',
['Guest Room E'] = 'Guest Room East Side Window',
['Bedroom E'] = 'Bedroom East Side Window',
['Den W'] = 'Den West Side Window',
['Den N'] = 'Den North Side Window',
}
-- builds device list control using filter list
-- filter = {location = ,name = , devicetype = )
local function BuildDeviceListControl (filterlist)
local changed = false
-- device list
local dl = {}
for _,filter in ipairs (filterlist) do
local list = DeviceManager:GetDevices (filter.Location,filter.Name,filter.DeviceType,fil ter.Abilities)
for _,device in ipairs (list) do
table.insert (dl,device)
end
end
table.sort (dl,function (a,b) return a:GetLocationName () < b:GetLocationName () end )
local locnamelist = {}
local devicesindextopath = {}
for i,d in ipairs (dl) do
table.insert (locnamelist, d:GetLocationName())
devicesindextopath [i-1] = d:GetPath () -- itemindex is 0 based
end
if table.getn (locnamelist) < 1 then -- no devices
table.insert (locnamelist,nodevices)
end
return locnamelist, devicesindextopath -- true if the any of the menus changed
end
local FilterList = {{DeviceType = 'Security\\Zone'}}
local Devices, Paths = BuildDeviceListControl (FilterList)
for k,v in ipairs(Paths) do
local device = DeviceManager:GetDeviceUsingPath (v)
if device then
if device:GetControl('Condition'):GetValue() == 'Violated' and zones[device:GetName()] then
print (zones[device:GetName()], device:GetName())
Voice :Speak(zones[device:GetName()]..' Violated')
end
end
end