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.
self.run.at returns an DateTimeJobControl object.
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
Thank you, this did work perfectly, especially with a bit of added complexity to the rules so I have more family compliant timings :
# 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'))