I want to do this in Python. However a simple loop is not looking very good I think. It would be better with a Timer? How could I do that in Python? Just do it how the usual Rules DSL pattern goes? Global timer and start it if the timer is null (None in Python) and clear the Timer when it is over?
I want to provide a live overview of the passed minutes since ‘Active’ state, because I might approximately know when it will finish. (So just storing the Start Date and End date and extracting them is not enough here).
There are Python examples at the supplied link. What is wrong with a loop? But if you’d rather implement it using timers, it would be pretty simple to convert the Rules DSL to Python. They’re is also a submission to the Helper libraries that does almost exactly this with a looping timer, only it’s counting down how much time is left in a timer and you want to count up. But you should be able to use it as a reference. https://github.com/openhab-scripters/openhab-helper-libraries/pull/237 IIRC, it’s based on rossko57’s DP.
A Timer is a must in Rules DSL because on the thread pool issue but it’s ok to block a rule in scripted automation.
You can always use the same approach as you would in rules DSL. Nothing prevents that. It’s just that with python you have more options.