Compare commits
1 Commits
85b14a73ed
...
a43c556341
Author | SHA1 | Date | |
---|---|---|---|
|
a43c556341 |
@ -1,3 +1,4 @@
|
|||||||
|
import os
|
||||||
import json
|
import json
|
||||||
import datetime
|
import datetime
|
||||||
import logging
|
import logging
|
||||||
@ -18,7 +19,7 @@ heat_pin = 26
|
|||||||
|
|
||||||
heat_state = False
|
heat_state = False
|
||||||
|
|
||||||
CONFIG_FILE = "/etc/greenhouse/greenhouse.json"
|
CONFIG_FILE = "greenhouse/config/greenhouse.json"
|
||||||
|
|
||||||
GPIO.setwarnings(False)
|
GPIO.setwarnings(False)
|
||||||
GPIO.setmode(GPIO.BCM)
|
GPIO.setmode(GPIO.BCM)
|
||||||
@ -94,6 +95,8 @@ class GreenControl(Thread):
|
|||||||
while self.__run_condition:
|
while self.__run_condition:
|
||||||
if self.__trigger_read_config:
|
if self.__trigger_read_config:
|
||||||
self.__trigger_read_config = False
|
self.__trigger_read_config = False
|
||||||
|
log.info(os.getcwd())
|
||||||
|
sleep(5)
|
||||||
with open(self.cfg_file, "r") as f:
|
with open(self.cfg_file, "r") as f:
|
||||||
self.config = json.load(f)
|
self.config = json.load(f)
|
||||||
now = datetime.datetime.now()
|
now = datetime.datetime.now()
|
||||||
|
13
setup.py
13
setup.py
@ -1,6 +1,3 @@
|
|||||||
import shutil
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
|
|
||||||
NAME = 'Greenhouse'
|
NAME = 'Greenhouse'
|
||||||
@ -11,16 +8,8 @@ PACKAGES = ['greenhouse']
|
|||||||
REQUIRES = ['Flask', 'w1thermsensor', 'RPi.GPIO']
|
REQUIRES = ['Flask', 'w1thermsensor', 'RPi.GPIO']
|
||||||
CONFIG_FOLDER = '/etc/greenhouse'
|
CONFIG_FOLDER = '/etc/greenhouse'
|
||||||
CONFIG_FILE = 'greenhouse.json'
|
CONFIG_FILE = 'greenhouse.json'
|
||||||
PACKAGE_DATA = {'greenhouse': ['templates/*', 'static/css/*', 'static/scripts/*']}
|
PACKAGE_DATA = {'greenhouse': ['templates/*', 'static/css/*', 'static/scripts/*', 'config/*']}
|
||||||
|
|
||||||
setup(name=NAME, version=VERSION, long_description=__doc__, author=AUTHOR, author_email=EMAIL,
|
setup(name=NAME, version=VERSION, long_description=__doc__, author=AUTHOR, author_email=EMAIL,
|
||||||
packages=PACKAGES, include_package_data=True, package_data=PACKAGE_DATA, zip_safe=False,
|
packages=PACKAGES, include_package_data=True, package_data=PACKAGE_DATA, zip_safe=False,
|
||||||
install_requires=REQUIRES)
|
install_requires=REQUIRES)
|
||||||
|
|
||||||
if sys.argv[1] == 'install':
|
|
||||||
try:
|
|
||||||
os.makedirs(CONFIG_FOLDER)
|
|
||||||
shutil.copyfile(CONFIG_FILE, os.path.join(CONFIG_FOLDER, CONFIG_FILE))
|
|
||||||
except FileExistsError:
|
|
||||||
#FIXME: handle overwriting the config file
|
|
||||||
pass
|
|
||||||
|
Loading…
Reference in New Issue
Block a user