Need some help with kwikset locks...

Hey everyone,
sorry to be a newb here. My boss asked me to program the office locks, and I know very very little about Lua. Anyway, he wants the locks to be auto locked from 5 to 8 in the morning, and not have them automatically lock back during business hours. I’ve seen the coding for the locks:
local t = os.date(‘*t’)
local current_second = t.hour * 3600 + t.min * 60 + t.sec – number of seconds since midnight
local min_time_in_seconds = 8 * 3600 + 0 * 60 – 08:00
local max_time_in_seconds = 17 * 3600 + 0 * 60 – 17:00

if (current_second > min_time_in_seconds) and (current_second < max_time_in_seconds)
else
return false
end

but I don’t know the correct name for the lock, or how to actually tell them to lock. Thanks for the help.

ok, i’ve gotten that the variable is 1 to lock and 0 to unlock. And that the device should be doorlock1

so i think i’m on the right track by putting this out here…

urn:micasaverde-com:serviceId:DoorLock1

local t = os.date('*t)
local current_second = t.hour * 3600 + t.min * 60 + t.sec
local min_time_in_seconds = 8 *3600 + 0 * 60
local max_time_in_seconds = 17 * 3600 + 0 * 60

if (current_second > min_time_in_seconds) and (current_second < max_time_in_seconds)
newTargetValue(1)
else
return false
end

I’m trying to figure this out…

ok, i’m working with this code right now just to test the locks. and it’s not working. any help would be appreciated. sorry i’m so new at this.

local lockState = luup.variable_get (“urn:micasaverde-com:serviceId:DoorLock1”, “Status”, 11)

if (lockState == “0”) then
return true
end

i got it figured out, thanks for all the help

@whitecp3, it looks like you’ve had a conversation with yourself (no help). Out of curiosity how did you solve your problem? Can you share your LUA code and steps you finally arrived at? thanxs Mike