Port JSR223 bundle to openHAB 2

No. I haven’t dug into it since I just launch functions on script startup, rather than using a rule.

The tricky part is getting the uid, which is a string. You could paste them in from Paper UI, or if you know the name of the rule and you’ve kept them unique, you can do this…

scriptExtension.importPreset("RuleSupport")
ruleUID = filter(lambda rule: rule.name == "Alert: TV turn off timer alert", rules.getAll())[0].UID

from openhab import osgi
ruleEngine = osgi.get_service("org.eclipse.smarthome.automation.RuleManager")
ruleEngine.setEnabled(ruleUID, True)# enable rule
ruleEngine.setEnabled(ruleUID, False)# disable rule