small lua code not working

Hi,
I created my first lua code and . . .it is not working. I need a little help with it please.
The scene is supposed to turn ON a light (bedroom light) if another light (office light) is OFF. I read that lua code execute first and if lua returns true the action is executed. If lua returns false the action is not executed.
So, in Scenes/Devices I clicked on the On button of my Fibaro switch I want to turn ON. Then I go to LUUP and I wrote to following code:

local lightID = 40
local status = luup.variable_get(“urn:upnp-org:serviceId:SwitchPower1”,“Status”,40)
return status == “0”

When I execute the scene the bedroom light is turned on no matter if the office light is on or off.
Thanks for help,

Have a look at this thread http://forum.micasaverde.com/index.php/topic,18679.0.html

Already checked that post. I am missing something? I even changed to code with:

local dID = 40
local allow = true
local status = luup.variable_get(“urn:upnp-org:serviceId:SwitchPower1”,“Status”,dID)
return ((status == “1”) == allow)

and still not working. With this second version the light is NOT turning on no matter the status of office light.
Where I am doing wrong?

The behaviour that you are reporting is consistent with one of these:

  • Misspelling the service ID.
  • Using the wrong device number.

The service ID looks right, so double check that device 40 is actually the device you think it is. Do that on the device’s Advanced tab; it’s printed at top left. While you are there make sure that this device has a Status variable with the matching service ID. Hover the mouse over the word Status to check.

Thanks for taking time and solve my problem.
I was confusing the deviceId with the Node#.
Now is working perfectly. ;D ;D ;D ;D