Yale DeadBolt Notifications - Polling for UserCode

I have several Yale locks that we managed to get email notifications when a user unlocks them.
The problem is that regardless of user, it sends the previous user’s info.
John unlocks the lock the very first time… I get John’s info…
Now Jane comes by and unlocks the door… I get John’s info…
But if Jane unlocks it again, I then get Jane’s info…

Basically, I have a Door Entry scene, that has LUUP Event triggers for Bad_PIN… Door_Unlock…etc…

Can anyone see what I’m doing wrong in this LUA? And/or scene?

[code]local smtp = require(“socket.smtp”)
local SMTP_SERVER = “”
local SMTP_PORT = “25”
local USER_SENDING = “email@domain.com
local USER_RECEIVING = “email@domain.com

            local DEVICE_NO  = 15
            local LS_SID     = "urn:micasaverde-com:serviceId:DoorLock1"        

– local nill = luup.call_action(LS_SID, “Poll”, {}, DEVICE_NO)

– luup.sleep(10000)

    local userinfo = luup.variable_get (LS_SID, "sl_UserCode", DEVICE_NO) or 0

    local from = USER_SENDING
    local rcpt = {USER_RECEIVING}

    local mesgt = {
        headers = {
            to = USER_RECEIVING,
            subject = "Door Unlock"
        body = "Door Unlocked - Date: " .. os.date("%c") ..  " - User Information: " .. userinfo

    local e = smtp.send{
        from = from,
        rcpt = rcpt, 
        source = smtp.message(mesgt),
        server = SMTP_SERVER,
        port = SMTP_PORT

    if (e) then
        luup.log("Broke?" ..  e)

Do you figure it’s a Yale issue? ???

It could be a timing issue. What do you get if you read the sl_UserCode variable after waiting a while? The new code may not get sent immediately. If it gets sent on the next poll, it could take a minute or two.

If you run the following code in Test Luup code (Lua), it will show the latest user on the task display. See how long it takes for a new user to appear. Also see what happens if you do a manual Poll.

local DEVICE_NO = 15 local LS_SID = "urn:micasaverde-com:serviceId:DoorLock1" local userinfo = luup.variable_get (LS_SID, "sl_UserCode", DEVICE_NO) or "nil" local handle = luup.task(userinfo,1,"User",-1) luup.call_delay("clrTaskMsg",3,handle) function clrTaskMsg(handle) luup.task("",4,"",tonumber(handle)) end

Man… thanks again RexBeckett

Unfortunately, I just updated my local Vera to UI7 beta, and can only test locally…
And given that, I have no idea where to even place this code anymore…LOL

My UI5 unit resides in a remote rental… So I cannot test it at this time…

But it worked perfectly/instant within the Test LUUP Code (LUA) on my UI7… So either it’s my code, or a bug within UI5…

My guess, is that it’s my code, and in which can be fixed by your code…(looking at it, I don’t understand what I did wrong)
I’m green to this stuff and it’s workings…

Big thanks to you and your time/effort…

Has this issue been resolved?

I have a Vision ZM1701 which is a Yale OEM version. On the list of variables I don’t have sl_usercode or sl_username.

if I execute code above I get ‘Nil’ in response.

p.s. I have four users defined and the lock works fine, even with time restrictions.

Have you guys tried this ?

Anyone knows if Yale fixed this problem ?