GrowSystem/growsystem.py

42 lines
1.1 KiB
Python

from gs.setup import Setup
import os
class GrowSystem:
version = "1.0"
def __init__(self):
print("Initialize Growsystem", self.version)
if self._is_config_existing():
print("Skip Setup. Config existing.")
elif self._is_initial_config_existing():
self._activate()
else:
print("No config existing. Start setup ...")
self._setup()
def _setup(self):
setup = Setup()
setup.setup_pico()
def _activate(self):
print("Start activation!")
def _is_config_existing(self):
return self._is_file_existing('/gs/config/config.py')
def _is_initial_config_existing(self):
return self._is_file_existing('/gs/config/initial_config.py')
def _is_file_existing(self, filepath):
try:
f = open(filepath, "r")
f.close()
# continue with the file.
return True
except OSError: # open failed
# handle the file open cas
return False