New rules engine

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Wiki
Normal user
Posts: 413
Joined: 23 Apr 2018, 17:55
Location: Germany

New rules engine

#1 Post by Wiki » 28 Jan 2019, 12:59

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

Code: Select all

pi@raspberrypi:~ $ man woman
No manual entry for woman
pi@raspberrypi:~ $

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: New rules engine

#2 Post by grovkillen » 28 Jan 2019, 19:43

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.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Wiki
Normal user
Posts: 413
Joined: 23 Apr 2018, 17:55
Location: Germany

Re: New rules engine

#3 Post by Wiki » 29 Jan 2019, 01:04

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?

Code: Select all

pi@raspberrypi:~ $ man woman
No manual entry for woman
pi@raspberrypi:~ $

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: New rules engine

#4 Post by grovkillen » 29 Jan 2019, 05:38

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?
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Wiki
Normal user
Posts: 413
Joined: 23 Apr 2018, 17:55
Location: Germany

Re: New rules engine

#5 Post by Wiki » 29 Jan 2019, 11:02

OK, I'll try and will report.

Code: Select all

pi@raspberrypi:~ $ man woman
No manual entry for woman
pi@raspberrypi:~ $

arneman
New user
Posts: 1
Joined: 10 Apr 2020, 15:18

Re: New rules engine

#6 Post by arneman » 10 Apr 2020, 15:21

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"

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

Re: New rules engine

#7 Post by TD-er » 10 Apr 2020, 15:53

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.

antro31
New user
Posts: 2
Joined: 31 May 2020, 23:17

Re: New rules engine

#8 Post by antro31 » 31 May 2020, 23:20

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?

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

Re: New rules engine

#9 Post by TD-er » 01 Jun 2020, 02:28

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
...

antro31
New user
Posts: 2
Joined: 31 May 2020, 23:17

Re: New rules engine

#10 Post by antro31 » 01 Jun 2020, 11:44

Thanks. No way to do it with the "new" rules engine?

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

Re: New rules engine

#11 Post by TD-er » 01 Jun 2020, 11:58

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.

rcrack2k
New user
Posts: 4
Joined: 11 Apr 2021, 19:10

Re: New rules engine

#12 Post by rcrack2k » 11 Apr 2021, 19:59

When will events be supported?

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

Re: New rules engine

#13 Post by TD-er » 11 Apr 2021, 20:35

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 32 guests