Moved brewfiles to source folder & add /source to sys path from __init__

This commit is contained in:
2021-10-03 19:26:22 +02:00
parent f58b33f08a
commit 7bdbf0b4dc
7 changed files with 10 additions and 2 deletions

View File

@@ -2,6 +2,8 @@ import os
import sys import sys
import yaml import yaml
from flask import Flask, request, render_template, send_file, redirect, send_from_directory from flask import Flask, request, render_template, send_file, redirect, send_from_directory
import source # take a look in source/__init__.py
from brewSensor import BCM600Sensor, DHT11Sensor, BrewSensor from brewSensor import BCM600Sensor, DHT11Sensor, BrewSensor
from brewCamera import BrewCamera from brewCamera import BrewCamera
from brewRelay import BrewRelay from brewRelay import BrewRelay

5
source/__init__.py Normal file
View File

@@ -0,0 +1,5 @@
print('at init')
import sys
sys.path.append('/home/pi/brewLogger/source')
print('added to source')

View File

@@ -183,7 +183,8 @@ class BCM600Sensor(BrewSensor):
if __name__ == '__main__': if __name__ == '__main__':
brewSensor = DHT11Sensor(13, 'outside', 30) # brewSensor = DHT11Sensor(13, 'outside', 30)
brewSensor = BCM600Sensor('inside', 2)
while True: while True:
print(brewSensor.temp) print(brewSensor.temp)

View File

@@ -12,7 +12,7 @@ def loadYaml(filePath):
def getConfig(): def getConfig():
pwd = os.path.dirname(os.path.abspath(__file__)) pwd = os.path.dirname(os.path.abspath(__file__))
path = os.path.join(pwd, 'config.yaml') path = os.path.join(pwd,'../', 'config.yaml')
if not os.path.isfile(path): if not os.path.isfile(path):
print('Please fill out and rename config file. Check README for more info.') print('Please fill out and rename config file. Check README for more info.')