What am I doing wrong?

I’, still working on sending an email with the light level every fifteen minutes. Got everytign working and decided to only send that email during the day. For some reason, I can’t get is_night working. If I comment out the If statement checking is_night, the email goes right through. Any ideas? I thought is should be easy!

--starting out, strLightLevel could be nil and that causes a problem - can't add a nil value --so, lets set it so something non-nil if (strLightLevel == nil) then strLightLevel = " " end

–go get light level

local curLightLevel = luup.variable_get(“urn:micasaverde-com:serviceId:LightSensor1”, “CurrentLevel”, 45)

–make curLightLevel non nil just in case
if (curLightLevel == nil) then
curLightLevel = " "
end

strLightLevel = strLightLevel…" , "…curLightLevel

–now send email
–we only want emails during the day, so check…
if not luup.is_night() then

luup.call_action(“urn:richardgreen:serviceId:VeraAlert1”, “SendAlert”, {Message = strLightLevel, Recipients = “xxxxxxxx”}, 18)

–todo reset curLightLevel by setting to nil or to " "

end – end check for night

return true

Well, it is working now. That is strange. Sorry to bother, but I’m glad it is working now.

Try if (not luup.is_night()) then instead