OH3 - which rule option to choose

In OH2 I had some rules (in .rules files) which sends a Pushover message when one of the items of a group turns off (or another state). The group is also configured as a switch and is turned off if one of the items is off. In OH3 I configured the group the same way and additionally I used the semantic model.

What is the best way of doing this in OH3? Still in .rules files? Or with scripts? I don’t think this is possible with the UI rule engine or blocky?

Depends on what your goals are. If you just want it to work, then stick with what works, the .rules files. If you want to change, it depends on what you want to change. There is no “best” option, only options which each have some advantages and disadvantages.

Indeed, this is not yet possible using Blockly.

If I’m correct the .rules files are the dsl rules in OH3 (I know that the trigger (When) is configured in the UI)? But the language is not completely the same? eg DateTime has been changed ( as you saw in other topics where I reacted)

I would like to use Python, but I don’t find any documentation how this is integrated with openHAB. I also saw different custom Python modules, are they needed to use it properly?

image

.rules files are Rules DSL in all versions of openHAB.

Yes, it’s the exact same language. If you write a rule in a .rules file or create a Script Action in the UI and select Rules DSL as the language, it’s exactly the same language. There are some breaking changes between OH 2.5 and OH 3 which are covered in the release notes, docs, and several posts here on the forum. But those changes apply whether you are using .rules files or creating rules in the UI.

You install is as an add-on, which is what appears you have already done. Then you write the code you want to execute when the rule is triggered in the Script Action using Python. There are some Helper Libraries you can find at GitHub - CrazyIvan359/openhab-helper-libraries: JSR223-Jython scripts and modules for use with openHAB. Look at the docs for the Helper Libraries for how to o various things with them. Or you can look at the code itself to see how to do things without using the Helper Libraries. There are tons and tons of tutorials and examples on the forum for writing Python rules in .py files. Almost everything that you see in these examples will also work in the UI, only you won’t have to use the decorators to define the rule.

That’s all there is for docs right now.