I am running OH3.1 on a synology docker and i do have troubles with rules and timers.
As blockly does not support timers (yet?) i tried to just copy&paste my code from OH2.5 to OH3 but it did not work out. The code is as follows:
In the event monitor stream i could see that the trigger was touched, the rules started but it did not work at all (nothing happened inside the rule). Can you help me?
Do your “before” commands get issued, you’ve not said?
I think the timer code will fail at the first line when it executes, there are no global variables in GUI entered DSL rules, so Garagenlichttimer will not exist at that time.
There should be complaints in your openhab.log.
I am not sure what you meant with “before” … please see attached screenshot on how i jump into that rule.
Do you have an idea how to solve that issue with the variable?
(or any other solution)
Your script does a bunch of commands, then sets up a timer to do a bunch more commands later.
Is the ‘sooner’ or ‘later’ part going wrong?
Don’t use the (global) variable, you’re not doing anything useful with it. You can create ‘anonymous’ timers without a preceding variable = createTimer(...), just createTimer(...)
I tried this in my rule (in application/javascript editor), but it did not work out:
(first of all turn on the lights, wait 1 minute and switch it off again)
if (itemRegistry.getItem('UmgebungslichtGarten_Beleuchtungsstaerke').getState() > '200') {
events.sendCommand('LichtGarageSeite_Betrieb', 'ON');
}
var timer = ScriptExecution.createTimer(ZonedDateTime.now().plusMinutes(1), function(){
events.sendCommand('LichtGarageSeite_Betrieb', 'OFF');
});
Sorry, of course i should:
The rule starts accordingly and powers on the Light but after the timer should have finished, they dont power off.
Therefore i thought the timer part was/is not working