How to know the status of a ligth device??

Hello hope any one can help me with this, I have a scene that I want to be ejecuted at certain time of the night only if the kitchen lights are ON, but how I can get the satus of the kitchen device if its currently on or off?? thansk alot!!!

Add the following code to your scene’s Luup tab. It will prevent it from running if the light is off.

local dID = <id of your Kitchen light device> local klstatus = luup.variable_get("urn:upnp-org:serviceId:SwitchPower1","Status",dID) return klstatus == "1"
Replace with the device ID number of your Kitchen light. Eg. local dID = 57

Changing the last line to return klstatus == “0” would prevent the scene running if the light is on.

Thnks Rex, I’ll try to run your example today!! :slight_smile:

the scene works perfect! thanks!!