# How create recurring scheduling event for specific time with API?

**URL:** <https://community.sixfab.com/t/how-create-recurring-scheduling-event-for-specific-time-with-api/459>\
**Category:** Power Software\
**Created:** [June 28, 2020, 8:59am UTC](https://community.sixfab.com/t/how-create-recurring-scheduling-event-for-specific-time-with-api/459 "2020-06-28T08:59:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![adm](https://community.sixfab.com/user_avatar/community.sixfab.com/adm/32/125_2.png) [@adm](https://community.sixfab.com/u/adm)\
**Post date:** [June 28, 2020, 8:59am UTC](https://community.sixfab.com/t/how-create-recurring-scheduling-event-for-specific-time-with-api/459/1 "2020-06-28T08:59:21Z")

</div>

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 _number **4** _ of the call to the function _`create_scheduled_event`_, but I do not know how to correct this.

Regard,  
Alexandre

---

<div class="post-metadata">

**Author:** ![ensar](https://community.sixfab.com/user_avatar/community.sixfab.com/ensar/32/8_2.png) [@ensar](https://community.sixfab.com/u/ensar)\
**Post date:** [July 3, 2020, 3:14pm UTC](https://community.sixfab.com/t/how-create-recurring-scheduling-event-for-specific-time-with-api/459/2 "2020-07-03T15:14:27Z")

</div>

Hi Alexandre,

> [@adm](#):
>
> _param 4, timeOrInterval = 1593239400 → exact time[epoch] ( Saturday, 27 June 2020 06:30:00 GMT)_

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.
