Page 1 of 1

New rules engine

Posted: 28 Jan 2019, 12:59
by Wiki
Hi,
I am trying to get the new rules engine to run.

- Adding new event named rule#1
- putting inside a rule, e.g.

Code: Select all

on Clock#Time=All,**:*0 do
Publish domoticz/in,{"idx":53,"nvalue":0,"svalue":"%uptime%"}
endon
- submitting, file "rules/rule/1.txt" is created
- nothing happens, I can see. edit and delete the rule, but the rule itself is never running

Tried with ESP_Easy_mega-20190108_normal_core_241_ESP8266_4096.bin

Re: New rules engine

Posted: 28 Jan 2019, 19:43
by grovkillen
The name of the file must be the name of the event. So in your case that will only trigger when the event "rules#1" happens.

Naming it "Clock#Time" and it will be triggered every minute.

Re: New rules engine

Posted: 29 Jan 2019, 01:04
by Wiki
Thank you, now the example works, the naming convention makes sence in this case.

But if I define my own event named "startwatering" to trigger it by

Code: Select all

http://<ip>/control?cmd=event,startwatering=1
how do I have to name the rule that it is saved without the formats error message and is running afterwards correctly?

Re: New rules engine

Posted: 29 Jan 2019, 05:38
by grovkillen
Yep, it's a work in progress... So the event need to be of the abc#def syntax. You can try to change the event to start#watering perhaps?

Re: New rules engine

Posted: 29 Jan 2019, 11:02
by Wiki
OK, I'll try and will report.

Re: New rules engine

Posted: 10 Apr 2020, 15:21
by arneman
I'm having the same issue. How to solve it? Is there any workaround?

If I call the cmd: "event,myevent=1", how should I call the event name in the rules tab to satisfy the naming conventions "name#value"

Re: New rules engine

Posted: 10 Apr 2020, 15:53
by TD-er
I'm not sure how to handle those event parameters with the "new rules engine"
When you don't succeed, please use the 'old' way of max. 4 rules files.

It is a bit slower, but at least it can handle the event variables.

Re: New rules engine

Posted: 31 May 2020, 23:20
by antro31
Hi all,
Same issue for me.
I would like a rule to trigger when I call
http://<myip>/control?cmd=event,open_cover

Unfortunatly, I don't know what to put as event name in the new rules engine.
Tried several things, none works (event#open_cover, http#open_cover) ...
Any clue, idea?

Re: New rules engine

Posted: 01 Jun 2020, 02:28
by TD-er
antro31 wrote: 31 May 2020, 23:20 [...]
Unfortunatly, I don't know what to put as event name in the new rules engine.
Tried several things, none works (event#open_cover, http#open_cover) ...
Any clue, idea?
Use the 'old' rules engine.

The event is just what you called it: "open_cover"
So in the rules you should make something like

Code: Select all

on open_cover do
...

Re: New rules engine

Posted: 01 Jun 2020, 11:44
by antro31
Thanks. No way to do it with the "new" rules engine?

Re: New rules engine

Posted: 01 Jun 2020, 11:58
by TD-er
antro31 wrote: 01 Jun 2020, 11:44 Thanks. No way to do it with the "new" rules engine?
If you don't use event variables to match a trigger, then I guess it can be done.
The "new" rule engine was mainly added to speed up rules parsing, but is found to be rather counter-intuitive and also missing a few features present in the "old" one.

Re: New rules engine

Posted: 11 Apr 2021, 19:59
by rcrack2k
When will events be supported?

Re: New rules engine

Posted: 11 Apr 2021, 20:35
by TD-er
The "new rules" will not be continued as they lack much more and also do not work very intuitively.
So please use the "old rules" system.