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()))
print("Fan Mode set: " + str(api.set_fan_mode(3))) print("************* Mode *************") print("Send update: " + str(api.send_system_temp())) print("Work Mode: " + str(api.get_working_mode())) if api.get_working_mode( ) == Definition.BATTERY_POWERED and api.get_input_power() <= 1.: for i in range(4): print("BATTERY MODE") api.set_safe_shutdown_battery_level(15) api.set_safe_shutdown_status(2) # create power off event event = Event() event.id = 1 event.schedule_type = Definition.EVENT_INTERVAL event.repeat = Definition.EVENT_ONE_SHOT event.time_interval = 1 event.interval_type = Definition.INTERVAL_TYPE_SEC event.action = Definition.HARD_POWER_OFF print("Create event: " + str(api.create_scheduled_event_with_event(event, 1))) print("Power off: " + str(api.hard_power_off())) ''' '''