I’m using OpenHAB 3.1 on a Raspberry Pi 4 running Raspberry Pi OS.
I wanted to know if there is an option to define OpenHAB Rules that run when an iPhone sleep/wakeup alarm is triggered?
for instance, if I set a wakup alarm for 07:00 AM, the OpenHABB Rule will automatically turn on the water boiler at 06:00 for 1 hour.
Hope someone can help
Do you wan‘t to switch on your boiler when the alarm gets triggered or do you want to switch on the boiler before e.g. 1h the alarm gets triggered?
The first task is pretty easy to realize, the second one is more complex with an iPhone.
I was hoping both are possible.
For the second scenario, I was hoping it is possible to set the rule to: alarm trigger time minus 1 hour.
You can create a personal automation on your iPhone which gets triggered with your alarm.
Within this automation you can switch on your boiler.
If you want to use the alarm -1h you need to tell openhab your next alarm clock time. This is way more complex.
If possible stay with the first scenario
I just want to add that there might be some help for you from the Marketplace, assuming you can figure out how to get the time of the next alarm from your phone to openHAB (for Android users look in settings of the openbHAB app).
If you are running OH 3.2 M3 or later you will see a number of rule templates you can install just like an add-on. The one you are interested in is Alarm Clock Rule.
First create a rule that does what you want it to do at the alarm clock time. Next install the Alarm Clock Rule template. Then open Rules and add a new Rule and choose Alarm Clock Rule as the template. Fill in the properties and save and you will now how a rule that will call your rule at the date and time specified by the state of the DateTime Item populated from your phone.
To handle the minus one hour (assuming that the phone reports the alarm time at least an hour before the alarm goes off) you might need a proxy DateTime Item and a rule to subtract an hour from the reported time. The proxy DateTime Item would be chosen as the Item to trigger the Alarm Clock Rule template.