Run rule on save - OH3

In OH2 - making changes to a rule and saving caused the trigger “System startup” to trigger. That appears to be gone in OH3 (specifically OH 3.0.1 on Mac OS 10.15.7). For testing a rule, what is the trigger in OH3 to run a particular rule when the rule file is saved, or is there another way to do this?

The “System started” trigger has been reworked to actually do what it says. It triggers a rule when the system has started. The system is already started when you change and reload a file. At some point (soon?) there may be a Rule loaded trigger. In the mean time if you are using Python or JavaScript rules in files you can use the scriptLoaded function. If using Rules DSL, you can manually trigger the rule to run through MainUI or from the Karaf Console.

Thanks - I’m not finding an example of using the scriptLoaded function, but I created a script in the Main UI/Settings/Scripts like so:

var theVolume = new PercentType(50)
var fileName = "Chime2.mp3"
playSound(fileName, theVolume)

And then “Run now”. All good but it would be nice to see the run on load put back into rules. It was quicker to just use commenting out items in rules to isolate issues.