This repository has been archived on 2024-02-23. You can view files and clone it, but cannot push or open issues or pull requests.
memberPlumbing/common.py

27 lines
924 B
Python

from ruamel.yaml import YAML
import os
from lib.hid.DoorController import DoorController
from lib.MembershipWorks import MembershipWorks
from passwords import DOOR_USERNAME, DOOR_PASSWORD
from passwords import MEMBERSHIPWORKS_USERNAME, MEMBERSHIPWORKS_PASSWORD
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)