2019-12-20 18:42:06 -05:00
|
|
|
from ruamel.yaml import YAML
|
2018-08-13 15:46:00 -04:00
|
|
|
import os
|
2020-02-06 17:54:33 -05:00
|
|
|
|
|
|
|
from lib.hid.DoorController import DoorController
|
|
|
|
from lib.MembershipWorks import MembershipWorks
|
2018-05-12 09:49:51 -04:00
|
|
|
|
2020-02-06 17:48:09 -05:00
|
|
|
from passwords import DOOR_USERNAME, DOOR_PASSWORD
|
|
|
|
from passwords import MEMBERSHIPWORKS_USERNAME, MEMBERSHIPWORKS_PASSWORD
|
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
|
|
|
|
2018-08-16 14:01:42 -04:00
|
|
|
doors = {doorName: DoorController(doorData['ip'],
|
|
|
|
DOOR_USERNAME, DOOR_PASSWORD,
|
|
|
|
name=doorName, access=doorData['access'])
|
|
|
|
for doorName, doorData in config["doors"].items()}
|
|
|
|
|
2019-12-20 18:42:06 -05:00
|
|
|
memberLevels = config['memberLevels']
|
2019-12-18 18:47:36 -05:00
|
|
|
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)
|