Loading peripherals from yaml file moved from server to seperate file.

This commit is contained in:
2021-10-06 22:19:51 +02:00
parent 95a8fb7a77
commit 32416ca243
2 changed files with 17 additions and 12 deletions

12
source/loader.py Normal file
View File

@@ -0,0 +1,12 @@
import yaml
from brewSensor import BME680Sensor, DHT11Sensor
from brewRelay import BrewRelay
def load(filePath):
loader = yaml.SafeLoader
loader.add_constructor('!Relay', BrewRelay.fromYaml)
loader.add_constructor('!bme680', BME680Sensor.fromYaml)
loader.add_constructor('!dht11', DHT11Sensor.fromYaml)
return yaml.load(open(filePath, "rb"), Loader=loader)