new to rules have a couple of basic ones using if / then statements
I have a tesla model 3 and my solar on openhab
When Im not in a rush for it to charge id like to activate a rule to match my charge level to my solar production.
but need to be able to deactivate this rule if in a rush
You might have a switch on your UI marked “In a hurry”.
When your charge rule runs, check to see if the switch Item is on.
You might also want to re-run the rule when the switch changes.
How so? In the old rule engine, you can’t enable/disable rules, so this seems like a perfectly valid solution when asked how to activate/deactivate a rule.
Do you mean the UI rule editor, scripted automation, or both? NGRE encompasses both. The UI rules need some help, which they will get a lot of in OH3. Scripted automation is solid.
It is a valid option, regarding to actually activate/deactive a rule.
But is it really worth it in his situation to actually do it like that? (activate/deactive the rule). In my opinion, it´s not.
For a Rule like this it’s fine. It needs more work in the UI before it’s generally useful, but for really simple stuff like this it’s just fine. I don’t think the user would even need to write any code at all for this. Just set up the trigger and add a sendCommand Action to update the charge rate Item. Then in another Rule you can trigger based on the “in a hurry” switch and have the Action disable/enable the Rule. Neither Rule would require hand written code at all and PaperUI is sufficient to set up something simple like this.
I suspect I’ll be writing this reply over an over again in the coming years.
NGRE is super mature and fully capable. There are two ways to write Rules in NGRE:
Previously called JSR223, more properly called Scripted Automation
Through the REST API (e.g. PaperUI)
Both run using the NGRE.
The only part that is immature is the PaperUI part. Everything else is rock solid and ready for use.
Given that OP needs some very simple Rules, even in it’s current state, PaperUI is more than adequate to solve this problem.
Of course, it is not the only way to solve the problem, but it is not a poor choice to solve this problem either.
It’s officially been a part of OH since OH 2.0 or 2.1. The use of the JSR223 languages has been officially part of OH since at least OH 1.6 IIRC. It’s main and only weakness is PaperUI. But PaperUI is not NGRE, it’s just one possible way to build NGRE Rules.
You can decide not to use it, but I think “beta” is a very significant mischaracterization of what NGRE is.
That is probably an oversight as I saw the Issue and PR to remove “Experimental” from the name quite some time ago. Maybe @5iver remembers better than I do.
I remember a PR to add the experimental logo to the docs, but I don’t recall anything to remove it. TMK, there was no plan to pull it out of experimental before OH3. My understanding is that OH3 will come right after 2.5 and the new rule engine can finally be moved to the mainstream. The rules DSL will be removed or possibly made an optional feature.