SetValue and calling custom action

I have a bunch of variables that represent the state of a device that is connected with a relay board to a remote Raspberry Pi. For the RPi I’ve written a small custom REST API, with which I can essentially control the GPIO pins. In Symcon, I have a variable of type boolean that has a custom action in which I call the REST API and update the state of the variable with SetValue(). In the Web UI, when I enable or disable the button, the device is switched on/off. So far so good.

But now I want to switch the state of these devices based on a timer. When I use SetValue() on that variable, the custom action that is associated with it isn’t called. I’ve resorted to calling all the logic that happens inside the custom action from the location I want to switch the device on/off, but that’ll get unwieldy very soon obviously.

So, how do I set the state of a variable in such a way that the custom action associated with it is called?

You need to dispatch a RunScript to your Actionscript.

                IPS_RunScriptEx($actionScript, Array("VARIABLE" => $targetID, "VALUE" => $value));


PS: The best way would be to rebuild the function in a PHP module :wink: