Ok, I’ve scoured the community and documentation for help on this but I admit defeat
Can someone point me to the “right” way to use timers in Python under OH3. I am currently using datetime and threading.Timer (which works fine) but I am also seeing that I should be using the native OH timers like ScriptExecution.createTimer. I’m getting the error:
TypeError: createTimer(): 1st arg can't be coerced to java.time.ZonedDateTime
Is there a simple example for say, setting a timer for 10 seconds from now and calling a function? Also want to be able to start/stop the timer. (obviously)
Thanks! I hope I’m not the only one confused by this
Thanks - Yes I have timers working fine with threading.Timer but thought that there were OH native timers that were preferred … I’ll assume no, and just continue with what I have.
Preferred is up to the implementer. Certainly, the advice I received some time back was to use the OH native timers (presumably you saw the examples in the link I posted?).
I still use threading.timer though, as explained above.