Help with luup code for Fibaro RGBW controller with VeraPlus

Hi all, I’m trying to program a scene such that I can use a single button on my NodOn soft remote to toggle a specific channel (red) on my Fibaro RGBW controller on/off. However, I couldn’t get the following code to work as it keeps giving me an error in my lua code. Can anyone kindly assist me to tell me what’s wrong with the code? Thanks!

status = luup.variable_get("urn:upnp-org:serviceId:SwitchPower1", "Status", 162) if(status == "0") then luup.call_action("urn:upnp-org:serviceId:SwitchPower1", "SetTarget", {newTargetValue = "1"}, 162) else luup.call_action("urn:upnp-org:serviceId:SwitchPower1", "SetTarget", {newTargetValue = "0"}, 162) end

There is no syntax error in that code.

This is what frustrates me. I took the code from elsewhere and adapted it and expected it to work. However, there isn’t any built-in debugging capability and 3rd party debuggers cost too much for such a single function that I need…

If you just want the button to toggle the power state of the red channel, you can do this easiest in the scene. Using the web interface to Vera (not an app) at the last stage of scene creation, go into the advanced editor. Then you can select the red channel and one of the resulting options is “toggle state”.
I just checked on mine, and the option is there.

1 Like

You mentioned you saw an error. What exactly did you see? Maybe there’s a clue there?

OMG!!! That’s what ToggleState is for!!! Thanks!!

That was my reaction too, when I first saw that :slight_smile: