HABApp 1.2 Beta

yes, now it works, thank you very much!

Sorry - not yet.

As so often there was an unexpected request that made me stop - and then the “free sunday” was gone.

I’ll try again later.

Greetings, I’m slowly working through converting my last few DSL rules to HABapp and then will begin tackling my jython rules, which will hopefully go faster. @Spaceman_Spiff thank you so much for your work on this. Quite incredible!

I have a question regarding every_minute() rules. Currently when I save a rule that has an every_minute() in it the rule runs at some arbitrary time within the next minute and then exactly a minute after that time continuing. How do I make every_minute() rules run exactly on the minute, like a cron “every minute” rule would run in jython or dsl? (and I’m guessing this would also extend to every_hour as well).

I tried using every() and specifying 60 sec as the interval, but that does approximately the same thing, except that it fires the rule immediately after saving, and then every [interval] after that.

I’ve tried searching the python time, timedelta, etc. docs for a generic “on the minute” type of entry to put in the start_time argument, but can’t figure it out.

Also, please let me know if I should have started a new thread for this, or if it’s OK for me to ask this on a release announcement thread. Thank you!

It’s okay to ask and I’m happy to help but I would have preferred a fresh thread so other users can find the answer more easily.

If you look at the docs you can see that you can specify a start time for every. If you omit the start time (None) it’ll run immediately. So you have to pass a time or a datetime which has 0 seconds (e.g. 11:33:00).
To achieve this we go one minute in the future and then replace the seconds with 0. Then we have the next minute (e.g. 11:32:59 + 00:01:0011:33:5911:33:00)

(datetime.now() + timedelta(minutes=1)).replace(second=0, microsecond=0)

Excellent, I didn’t consider doing that, very clever. Thank you so much for the response. And, if there’s a way to move my question and your answer to a separate thread, I’m happy to do it.

Has anyone observed strange behavior when reconnecting or starting HABApp + openHAB?
If not I’ll probably make a release in a couple of days … .

i did a couple of restarts (of the complete raspberry) today. for me everything seems fine :slightly_smiling_face: :+1:

1 Like