# HABApp 25.02.x scheduler - how do I show the execution times?

**URL:** <https://community.openhab.org/t/habapp-25-02-x-scheduler-how-do-i-show-the-execution-times/162750>\
**Category:** 3rd Party\
**Tags:** python, habapp\
**Created:** [February 26, 2025, 3:43pm UTC](https://community.openhab.org/t/habapp-25-02-x-scheduler-how-do-i-show-the-execution-times/162750 "2025-02-26T15:43:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hakan](https://community.openhab.org/user_avatar/community.openhab.org/hakan/32/70815_2.png) [@hakan](https://community.openhab.org/u/hakan)\
**Post date:** [February 26, 2025, 3:43pm UTC](https://community.openhab.org/t/habapp-25-02-x-scheduler-how-do-i-show-the-execution-times/162750/1 "2025-02-26T15:43:29Z")

</div>

I’m operating my window blinds with (among other triggers) with the sunset and sunrise triggers:

```yaml
        self.run.at(self.run.trigger.sunset(), self.run_sunset)
        self.run.at(self.run.trigger.sunrise(), self.run_sunrise)

```

The code executes successfully, so no issues with that, but how would I go about telling when the _next_ execution would take place?

Ideally, I would have a DatetimeItem on the openHAB side which I could update with the expected execution times. Just using the astro binding would be one possible workaround but I’m looking for the general solution.

---

<div class="post-metadata">

**Author:** ![Spaceman\_Spiff](https://community.openhab.org/user_avatar/community.openhab.org/spaceman_spiff/32/56883_2.png) [@Spaceman\_Spiff](https://community.openhab.org/u/Spaceman_Spiff)\
**Post date:** [February 26, 2025, 3:51pm UTC](https://community.openhab.org/t/habapp-25-02-x-scheduler-how-do-i-show-the-execution-times/162750/2 "2025-02-26T15:51:56Z")

</div>

[self.run.at](https://habapp.readthedocs.io/en/latest/rule.html#HABApp.rule.scheduler.job_builder.HABAppJobBuilder.at) returns an [DateTimeJobControl object](https://habapp.readthedocs.io/en/latest/rule.html#HABApp.rule.scheduler.job_builder.DateTimeJobControl).  
There you can use `.last_run_datetime` or `.next_run_datetime`.  
You can also use `.to_item(item)` to automatically send the next execution time to a HABApp or openHAB item.  
So

```auto
sunset_job = self.run.at(self.run.trigger.sunset(), self.run_sunset)
sunset_job.to_item(DatetimeItem.get_item('DtItemName'))

```

That way you can automatically show the next execution time, even if you have complex triggers (e.g. with a trigger group and/or filters).

---

<div class="post-metadata">

**Author:** ![hakan](https://community.openhab.org/user_avatar/community.openhab.org/hakan/32/70815_2.png) [@hakan](https://community.openhab.org/u/hakan)\
**Post date:** [February 26, 2025, 6:45pm UTC](https://community.openhab.org/t/habapp-25-02-x-scheduler-how-do-i-show-the-execution-times/162750/3 "2025-02-26T18:45:11Z")

</div>

> [@Spaceman\_Spiff](#):
>
> That way you can automatically show the next execution time, even if you have complex triggers (e.g. with a trigger group and/or filters).

Thank you, this did work perfectly, especially with a bit of added complexity to the rules so I have more family compliant timings :

```yaml
# Open the blinds at sunrise, but but earliest at 07:15
sunrise_job = self.run.at(self.run.trigger.sunrise().earliest('07:15:00'), self.run_daily_open)
sunrise_job.to_item(DatetimeItem.get_item('HABApp_Windows_Blinds_Opening_Time'))

# Close the blinds at 15 minutes before sunset
sunset_job = self.run.at(self.run.trigger.sunset().offset(-900), self.run_daily_close)
sunset_job.to_item(DatetimeItem.get_item('HABApp_Windows_Blinds_Closing_Time'))

```
