Createtimer and Logging to events.log

Hi guys,

Happy Holidays! Hope someone can help me out.

I’m working on some code that someone else typed up and I wasn’t sure what this line meant:
timer = createTimer(now.plusSeconds(5))[|sendCommand(Color_HueBulb, HSBType::RED)]

Also, what does createTimer do?

In addition, is there a way to get openhab to log something to the events.log file? I.e. whenever an if statement is run something is logged to the event saying that if statement was run. Also, when I do logInfo(“File”, “Test”) in the rules section, where does “Test” get logged to?


That chunk of code scedules a little bit of code (everything between the [ ]) to execute someone in the future.

In this case it will run that sendCommand five seconds from now.

creatTimer creates the object, a Timer, which implements executing the code at the scheduled time or, if you need to, cancelling the Timer so the code doesn’t run.

You shouldn’t log this stuff to events.log. Everything logged with logInfo et all gets logged to openhab.log which is in the same folder as events.log.