Dimmable light on with door lock PIN code ONLY if light currently off??

Hi all!

This is my first real attempt at some real automation with my VeraLite, so please be gentle - I have no idea where to start!

What I want to do is have my kitchen light (which is on a dimmer) come on when I unlock the garage entryway door with my personal PIN but ONLY if the light is currently off and it’s after sunset. In other words if it’s dark, and I come home, and my wife isn’t already in the kitchen with the light turned on, I want the light to come on 50% brightness so that I can safely find my way to the kitchen in the dark.

Does that sound possible???

Thanks in advance for your help!

Create a scene that turns on the light at 50%. Go to the triggers section and create a new trigger selecting the lock and the type of trigger being “A pin code is entered”. You can enter the index number of your pin code or enter * for all pin codes. In the Luup section add the following:

light = luup.variable_get("urn:upnp-org:serviceId:SwitchPower1","Status",18) if ( luup.is_night() and light == "0") then return true end

Change 18 to the device number of the kitchen dimmer. As I am new to writing lua code, can someone verify that it is correct?

  • Garrett

Added the else branch:

light = luup.variable_get("urn:upnp-org:serviceId:SwitchPower1","Status",18) if ( luup.is_night() and light == "0") then return true else return false end

Thanks, I forgot to add them. That is what happens when still trying to wake up.

  • Garrett

Fantastic!!!

Thanks so much for helping me out - works like a charm.

;D