Loading peripherals from yaml file moved from server to seperate file.
This commit is contained in:
12
source/loader.py
Normal file
12
source/loader.py
Normal 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)
|
||||
|
||||
Reference in New Issue
Block a user