Use parameter to choose device or action All questions


New to Sequematic

I have Smart Life with a few smart plug.  I'm trying to set up Sequematic webhook to turn each one on and off.

In the action section, the device and action are selected from the drop down list.  So it seems that I have to set up 2 sequence for each smart plug, one to turn it on and the other to turn it off.

Ideally, I'd like to have just 1 sequence with webhook trigger and 2 parameters, one specifying which smart plug and the other specifying the action (turning on or off).

Is this possible?


Asked by cheerful on December 18, 2020, at 9:12am

An option would be to use variables and the variable webhooks.

For a particular device (let's call it switch_1) create a new variable called switch_1_status with a value of on or off.

Now, create a new sequence that looks something like the following. In this example I'm using it to control an eWeLink device named Christmas tree but you could also use a Tuya or Philips Hue device as well.

You can import this sequence directly into your account from here.

Now, you should head back to the variables page and click the little plug icon next to switch_1_status. This will take you to the variables webhook page where you can retrieve a webhook to either toggle the value, or specifically set it to on or off.

Something to be aware of is that if you also control this device outside of SEQUEmatic the value of switch_1_status may not stay in sync with your actual device.  You might want to change the trigger to check if the variable is modified rather than changed.  It's a subtle difference, but changed only triggers if the value changes - ie from on to off or off to on.  Modified will trigger if it's modified but doesn't actually change - eg on to on or off to off.

Hopefully that helps, but if you have any questions don't hesitate to ask!

i have another idea that i think is better then using a variable,

trigger; webhook

action; check tuya device status, if the tuya device x is on;

action; turn off the tuya device x


action; turn on the tuya device x

thats how ive been doing it and works really well, this way it will always toggle the light.

sorry, i did not read it properly, you can remove my previous post, and this one also.

Actually, that's a good idea Vinny!  You could set up something like the sequence below, and then specify the action in the url.

The trigger here is a custom webhook, configured as follows:

What this means is you can specify the action in the webhook URL as follows:


If I understands this correctly, use custom webhook with schema1 (GET) to pass ON/OFF as parameter.  Then extract the parameter and use if-else to perform the action (turn on/off).  So the on/off is now coming from one sequence.  This is not ideal but there is built-in support for way to choose action by parameter.  So this works.

This still leaves the question how to use parameter to choose which device to switch on/off.  If that must be done via if-else, then we will have many cases (number of device * number of state).


im still confused on how to use parameters aswell, but i have another solution that might work for you.

you can create a variable, name it "lights" or whatever else you want, use webhook to set it to a certain value for example; 1,2,3,4

create a sequence thats triggered when variable "lights" changes or is modified,

create the steps that check if variable "lights" = 1 or 2 or 3 or 4, and add the steps you want to run below them.

now you have one sequence with multiple triggers.

You can then use parameter two to capture the device to be triggered.  When setting up the custom webhook trigger, enter a name for parameter two (eg device) then you can add another condition in the sequence to check the value of {device} to work out which device should be triggered.

The sequence will look like this

Trigger 1 = device variable change

Trigger 2 = action variable change (on/off)

If device is plug 1

  if action is on

    switch plug 1 on -- this comes from drop down selection, so no way to use variables directly


    switch plug 1 off

else if device is plug 2

  if action is on

    switch plug 2 on -- this comes from drop down selection, so no way to use variables directly


    switch plug 2 off


This has to be repeated for every device.

Ideally, I'd want to do the following

Trigger 1 = device variable change

Trigger 2 = action variable change (on/off)

Switch {device} {action} -- just one line

Sequematic can save the sequence, including Tuya/Smart-Life device and action.  So it definitely have ways to refer to device and action from Tuya.  It should just be some way to expose their names so that we can use them directly.

Is it possible?

Post a reply

The SEQUEmatic bot is still new and learning. If you don't get the answer you need, just ask to speak with Derek and your chat will be transferred.