Multiple condition on event

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
skarab
New user
Posts: 4
Joined: 06 Jun 2019, 08:54

Multiple condition on event

#1 Post by skarab » 18 Jan 2021, 10:58

Hello everyone.

I'd like to control a Dummy device with a rule on boot and every time a GPIO change of state. So I created two Switch input for my GPI. I'm asking if there a way to combine multiple trigger conditions.

If I've got input switch named GPIO_5 and GPIO_4, I'd like to write something like that :

Code: Select all

On System#boot or GPIO_5#state or GPIO_4#state
...
Obviously I tried and It doesn't work. Is it possible ?

User avatar
Ath
Normal user
Posts: 3515
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Multiple condition on event

#2 Post by Ath » 18 Jan 2021, 11:16

No, that's not possible, but

Code: Select all

On System#boot do
  Event,ProcessState
EndOn
On GPIO_5#state do
  Event,ProcessState
EndOn
On GPIO_4#state do
  Event,ProcessState
EndOn

On ProcessState do
// Do what you need to do
EndOn
should work as desired.
You can pass on any arguments if needed as well.
/Ton (PayPal.me)

skarab
New user
Posts: 4
Joined: 06 Jun 2019, 08:54

Re: Multiple condition on event

#3 Post by skarab » 18 Jan 2021, 12:04

Oh great ! You use ProcessState as a function and called it on each trigger!

Thanks for all !

A quick other question :
" Is there a way to duplicate configuration on oher devices"
Because it seem to me that when I use save to upload .dat file, it save the name of the device

User avatar
Ath
Normal user
Posts: 3515
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Multiple condition on event

#4 Post by Ath » 18 Jan 2021, 12:20

It does save the unit name, as it is intended to be restored on the same unit. But if your unit-names are exactly the same length you can update (only) that, using a proper binary compatible editor like Notepad++, and restore on the next device.
Be sure to update the unit-number as well after the restore, as those have to be unique as well, but you can't easily edit that in the file.

I haven't found how to export and import this config in JSON format, as that would be much easier to edit.
/Ton (PayPal.me)

TD-er
Core team member
Posts: 8752
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Multiple condition on event

#5 Post by TD-er » 18 Jan 2021, 14:13

There isn't (yet) a proper JSON import/export.
We do have a "Settings Archive" (see tools page on "normal" or "custom" builds) which I also used to clone nodes.
When cloning you indeed clone the hostname and unit nr, so after cloning you need to fix that.

When cloning a node, you have to enter the IP of the other node as hostname.
It also supports a set password.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 131 guests