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)))

# create power off event to power off the device in 20 seconds
event = Event()
event.id = 1
event.schedule_type = Definition.EVENT_INTERVAL
event.repeat = Definition.EVENT_ONE_SHOT
event.time_interval = 20
event.interval_type = Definition.INTERVAL_TYPE_SEC
event.action = Definition.HARD_POWER_OFF

result = pms.create_scheduled_event_with_event(event, 500)

print("Create S. Event Result: " + str(result))
print("IDs of Scheduled Events: " + str(pms.get_scheduled_event_ids()))
Exemplo n.º 2
0
print("RTC Time: " +
      str(api.get_rtc_time(Definition.TIME_FORMAT_DATE_AND_TIME)))

#print("Ask Watchdog Alarm: " + str(api.askWatchdogAlarm()))

# Battery Design Cap
print("\r\n")
print("************* Battery Design Cap **************")
print("set Battery Design Capacity Result: " +
      str(api.set_battery_design_capacity(3400, 10)))
print("get Battery Design Capacity: " +
      str(api.get_battery_design_capacity(10)))

# Firmware Ver
print("\r\n")
print("************* Firmware Ver **************")
print("Firmware Ver: " + str(api.get_firmware_ver()))

# Event
print("\r\n")
print("************* Event **************")
print("Result removing all Scheduled Event: " +
      str(api.remove_all_scheduled_events(200)))
#print("Result creating Scheduled Event: " + str(api.create_scheduled_event(1,Definition.EVENT_TIME,Definition.EVENT_REPEATED,23400,1,Definition.EVERYDAY,Definition.HARD_POWER_ON,200)))
#print("IDs of Scheduled Events: " + str(api.get_scheduled_event_ids(50)))

# Actions
#print("Hard Power Off: " + str(api.hardPowerOff()))
#print("Soft Power Off: " + str(api.softPowerOff()))
#print("Hard Reboot: " + str(api.hardReboot()))
#print("Soft Reboot: " + str(api.softReboot()))