2018-08-13 15:46:00 -04:00
|
|
|
import os
|
2020-02-06 17:54:33 -05:00
|
|
|
|
2020-03-30 14:01:39 -04:00
|
|
|
from ruamel.yaml import YAML
|
|
|
|
|
2020-02-06 17:54:33 -05:00
|
|
|
from lib.hid.DoorController import DoorController
|
|
|
|
from lib.MembershipWorks import MembershipWorks
|
2020-03-30 14:01:39 -04:00
|
|
|
from passwords import (
|
|
|
|
DOOR_PASSWORD,
|
|
|
|
DOOR_USERNAME,
|
|
|
|
MEMBERSHIPWORKS_PASSWORD,
|
|
|
|
MEMBERSHIPWORKS_USERNAME,
|
|
|
|
)
|
2018-05-12 09:49:51 -04:00
|
|
|
|
2018-08-16 12:52:25 -04:00
|
|
|
try:
|
2019-12-20 18:42:06 -05:00
|
|
|
with open(os.path.dirname(os.path.abspath(__file__)) + "/config.yaml") as f:
|
|
|
|
config = YAML().load(f)
|
2018-08-16 12:52:25 -04:00
|
|
|
except NameError:
|
2019-12-20 18:42:06 -05:00
|
|
|
with open("config.yaml") as f:
|
|
|
|
config = YAML().load(f)
|
2018-05-14 22:36:24 -04:00
|
|
|
|
2020-03-30 14:01:39 -04:00
|
|
|
doors = {
|
|
|
|
doorName: DoorController(
|
|
|
|
doorData["ip"],
|
|
|
|
DOOR_USERNAME,
|
|
|
|
DOOR_PASSWORD,
|
|
|
|
name=doorName,
|
|
|
|
access=doorData["access"],
|
|
|
|
)
|
|
|
|
for doorName, doorData in config["doors"].items()
|
|
|
|
}
|
2018-08-16 14:01:42 -04:00
|
|
|
|
2020-03-30 14:01:39 -04:00
|
|
|
memberLevels = config["memberLevels"]
|
|
|
|
doorSpecificSchedules = config["doorSpecificSchedules"]
|
2018-05-12 09:49:51 -04:00
|
|
|
|
2020-02-06 17:48:09 -05:00
|
|
|
membershipworks = MembershipWorks()
|
|
|
|
membershipworks.login(MEMBERSHIPWORKS_USERNAME, MEMBERSHIPWORKS_PASSWORD)
|