Check presence sensor over time

I have a device that sometimes goes offline. I have set it up with a HTTP presence sensor that checks if it is online, and if it goes away, it reboots the device (using a z-wave outlet). The problem is that sometimes 1 reboot isn't enough and it doesn't come back. Since the presence sensor already reported that it 'left', it doesn't reboot it again after a period of time.
What I would like is:

  1. If the presence sensor 'leaves', reboot the device.
  2. Wait 15 minutes
  3. Check if the presence sensor is still there
  4. If not, reboot again and go to step 3.
  5. If it is, then continue as normal.

How do I set that up?

RM is your friend. I'd use the presence sensor leaving as the trigger, then use a REPEAT/UNTIL statement to keep rebooting until the presence sensor arrives again. The REPEAT allows both for number of retries and delay between retries.

Here's a similar rule... this one uses variable retries and delays so I can fiddle with them. You could use the same logic.