The rules.runRule() function is part of the openHAB JavaScript Scripting library, used to programmatically trigger another rule from within a script or rule.
I am wondering If there ist a similar function in Python Scripting. Any modules to be imported?
Searching the docs and the web was not helpful so far. Thanks.
following the javascript example, you must do the following things
Get the rule service
Check the rule
call runNow on the rule manager
from openhab.services import getService
ruleManager = getService('org.openhab.core.automation.RuleManager')
status = ruleManager.getStatus("<myruleid>")
if not status:
print("your rule does not exists")
if status == "UNINITIALIZED":
print("your rule is not initialized")
ruleManager.runNow("<myruleid>", True, {});
btw. the example on openhab scripters are outdatet since years and not maintained by any openhab dev.
Thanks a lot. Your example is working as expected and is solving my problem.
Where do I find related information in the docs? I don’t want to bother you in the future.