Dear all,
I just started my new OH3 setup today after two years of OH2. I somehow made it through the old rules system, mainly by studying rules of others.
Now OH3 leaves me completely helpless, feeling like an idiot when it comes to Python rules. I simply wanted to program a switch that is set to ON after 3sec. Clearly, this requires a little script, and I want to trigger it within one of the new graphical rules.
I fail even at the very beginning.
I copied some code to the script within the graphical rule editor that should at least give an info somewhere in the logs and - I hope - in the event monitor.
from org.joda.time import DateTime
from core.rules import rule
from core.triggers import when
from core.actions import ScriptExecution
@rule("my First Rule", description="A first rule", tags=["Tag1", "Tag2"])
def my_rule_function(event):
my_rule_function.log.info("Hello World!")
But when I press the “Play” button, simply nothing happens. How is debugging intended to happen in OH3? And could someone propose a piece of code to start from for a bloody beginner?
And are the helper libraries (https://openhab-scripters.github.io/openhab-helper-libraries) already included in OH3 basic installation?
Or would someone give me a hint to do the delayed switching in Blockly? I could not find a timer there.
Sorry for giving dumb questions, but OH3 seems to have turned into an expert tool when it comes to rules. I know the @rlkoshak does an excellent job in preparing documentation, but a tutorial to a very first script would help me a lot!
Thanks a lot for helping