forked from CMS/memberPlumbing
37 lines
904 B
Python
37 lines
904 B
Python
import os
|
|
|
|
from ruamel.yaml import YAML
|
|
|
|
from lib.hid.DoorController import DoorController
|
|
from lib.MembershipWorks import MembershipWorks
|
|
from passwords import (
|
|
DOOR_PASSWORD,
|
|
DOOR_USERNAME,
|
|
MEMBERSHIPWORKS_PASSWORD,
|
|
MEMBERSHIPWORKS_USERNAME,
|
|
)
|
|
|
|
try:
|
|
with open(os.path.dirname(os.path.abspath(__file__)) + "/config.yaml") as f:
|
|
config = YAML().load(f)
|
|
except NameError:
|
|
with open("config.yaml") as f:
|
|
config = YAML().load(f)
|
|
|
|
doors = {
|
|
doorName: DoorController(
|
|
doorData["ip"],
|
|
DOOR_USERNAME,
|
|
DOOR_PASSWORD,
|
|
name=doorName,
|
|
access=doorData["access"],
|
|
)
|
|
for doorName, doorData in config["doors"].items()
|
|
}
|
|
|
|
memberLevels = config["memberLevels"]
|
|
doorSpecificSchedules = config["doorSpecificSchedules"]
|
|
|
|
membershipworks = MembershipWorks()
|
|
membershipworks.login(MEMBERSHIPWORKS_USERNAME, MEMBERSHIPWORKS_PASSWORD)
|