Easy way to do a light on/off when a door is open/closed

I have a walk in pantry and I’d like the light to come on when the door is opened and off when the door is closed.

I’ve put a door sensor on and I’m using two scenes to do this.

Light Off scene has an Event to turn the light off when Tripped = No.

Light On scene has an Event to turn the light on when Tripped = Yes

This works OK, but seems cumbersome, also it doesn’t “latch” the light, that is I was hoping to get the light to stay off when the door is closed even if I manually try to turn it on.

Has anyone got a better way to do this? and to solve my “Latching” problem.

Thanks, I’m new at this and still learning how this works.

If you associate the door sensor with the light switch, then you do not use scenes and what you are wanting to happen will happen automatically (and much quicker than using scenes).

If you have Vera2 with UI4:
On your door sensor go into Settings Tab, then Custom Z-Wave Settings.
Set Group ID to 1
And then Set To is the device ID of your light switch in the pantry.

It may take a while for the association to get to the door sensor, but then everything will work wonderfully.

Thanks

I’ll try that.