Paperui rules engine usage

Tags: #<Tag:0x00007f015a2e9a70> #<Tag:0x00007f015a2e97f0>

(Ali) #41

@5iver Okie so I have got two things as my two phones, I have linked online items with the phones, the items are part of the parent group switch, the parent group switch item has the logic of All ON --> ON else OFF and still the rule is not firing when both phones are disconnected from wifi.
Here are the screenshots

(Scott Rushworth) #42

Rules won’t trigger on ItemUpdateEventTrigger when group members update or change. Use the item changed trigger, which is really the only time you’d want the rule to trigger.

(Ali) #43

@5iver Thank you so much for the support, the rules are working as expected now. I am using all off -> OFF else ON and it checks for both Phones and if they are off then it sends the command to turn the soundbar off.

I was wondering if I need to put some delays etc then for that I may have to go for command prompt and have to update the rule in the rule files because PaperUI rules engine doesn’t support that.

(Rich Koshak) #44

It’s supported.

(Ali) #45

Thanks for the update. One quick thing though, if I have created a rule from Paper UI and in order to add java.lang.Thread.sleep(1000); I might have to do it from command prompt right? but since the rule was created from Paper UI so I don’t find it in the rules folder.

(Scott Rushworth) #46

Rich is speaking of the scripted Action. Your whole Action (then then part) can be in Javascript. But IMO at that point, you should just write the whole rule in JS, or Jython, or Groovy, or the Rules DSL. Have you tried changing the settings in the network binding? IIRC, you can set the poll interval and a retry count, which may add the delay your looking for.

(Ali) #47

Thanks for the update, seems like I’ll have to explore a lot of this to learn more.

Here’s an achievement that I did using the Rules Engine.

With the gPhones group “If Item State Changes” and with the condition “If previous state is ON and if next state is OFF” then I am executing this condition and it seems to be working perfect. Looks like you can pass values in the command as long as the item is capable enough to accept those.