Exemplo n.º 1
0
#print( "Return: " + str(api.set_fan_mode(2)))
print("Fan Mode: " + str(api.get_fan_mode()))

#print( "Return: " + str(api.set_battery_separation_status(1)))
print("Battery Separation: " + str(api.get_battery_separation_status()))

#print( "Return: " + str(api.set_rgb_animation(2,7,3)))
print("RGB Anim: " + str(api.get_rgb_animation()))

#print( "Return: " + str(api.set_fan_automation(50)))

#print( "Return: " + str(api.set_power_outage_event_status(1)))
print("POWER OUT. STAT: " + str(api.get_power_outage_event_status()))

#print( "Return: " + str(api.set_power_outage_params(5,30)))
print("POWER OUT. PARAMS: " + str(api.get_power_outage_params()))

#print( "Return: " + str(api.set_end_device_alive_threshold(250)))
print("Alive Threshold: " + str(api.get_end_device_alive_threshold()))

print("EDM: " + str(api.get_edm_status()))

print("LPM: " + str(api.get_lpm_status()))

print("WDT INTERVAL: " + str(api.get_watchdog_interval()))

print("Power Outage Status: " + str(api.get_power_outage_event_status()))

print("SE ID's: " + str(api.get_scheduled_event_ids()))

#print( "Factory Reset: " + str(api.restore_factory_defaults()))
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.º 3
0
# [monday] –> Bit 0 [tuesday] –> Bit 1 [wednesday] –> Bit 2 [thursday] –> Bit 3 [friday] –> Bit 4 [saturday] –> Bit 5 [sunday] –> Bit 6 [RESERVED] –> Bit 7 (Default 0)
# Example Calculation for every day : day_factor = 0b01111111 = 127
# Example Calculation for (sunday + monday + tuesday) : day_factor = 0b01000011 = 67
# -----------------------------------------------------------

from power_api import SixfabPower, Definition, Event
import time

api = SixfabPower()
epoch = time.time()

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

# set HARD_POWER_ON at 6:30AM everyday
# ------------------------------------
# see https://www.epochconverter.com
# daily_exact_time formula: epoch_time_local % (24x60x60)
# daily_exact_time :
#   –> Thursday, 30 July 2020 06:30:00
#   –> epoch_local = 1596090600 (In this case local : GMT)
#   –> daily exact_time = 1596090600 % 86400 = 23400
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)))