How create recurring scheduling event for specific time with API?

Hi,
I try to creating recurring scheduling event for specific time with Sixfab API, and I would like the system to start every day at 6.30 a.m.

My code is :

#cat sixfab_create_event.py

from power_api import SixfabPower, Definition, Event
import time

pms = SixfabPower()
epoch = time.time()

# Remove all events
print("Result removing all Scheduled Event: " + str(pms.remove_all_scheduled_events(200)))

# Start 6:30AM
print("Result creating Scheduled Event: " + str(pms.create_scheduled_event(1,1,2,1593239400,1,Definition.EVERYDAY,1,200)))

param 1, eventID = 1
param 2, scheduleType = 1 -> time
param 3, repeat = 2 -> repeated
param 4, timeOrInterval = 1593239400 -> exact time[epoch] ( Saturday, 27 June 2020 06:30:00 GMT)
param 5, interval_type = 1 -> second
param 6, repeatPeriod = Definition.EVERYDAY
param 7, action = 1 -> start

And yesterday (Saturday, 27 June) my system started well at 6:30 am.

But today (Sunday, 28 June) my system did not start at 6:30 am.

I think the correction is to be do with the parameter number4 of the call to the function create_scheduled_event, but I do not know how to correct this.

Regard,
Alexandre

Hi Alexandre,

The time_or_interval parameter is calculated as follows:

daily_exact_time formula: epoch_time_local % (24x60x60)

daily_exact_time example:
→ Friday, March 27, 2020 11:19:00 PM GMT+03:00
→ epoch_local = 1585340340 (In this case local : GMT+3)
→ daily exact_time = 1585340340 % 86400 = 73140

this parameter value according to your event: 1593239400 % 86400 = 23400

The sixfab-power-python-api package is available that is newer than the version(0.0.4) you have installed. You can upgrade:
pip3 install sixfab-power-python-api --upgrade

Thanks.