check modules

This commit is contained in:
Kai Wansart 2018-02-02 18:03:38 +01:00
parent 2d55f4ddfe
commit 9783fd07ee

View File

@ -39,7 +39,7 @@ class Webserver(object):
##-----------------------------------------------------------------------------------## ##-----------------------------------------------------------------------------------##
app = Flask(__name__) app = Flask(__name__)
if(self.devices['yeelight'] != None): if('yeelight' in self.devices):
print("Enabled Yeelight") print("Enabled Yeelight")
from app.devices import yeelight from app.devices import yeelight
self.yeelight = yeelight.Yeelight(self.devices['yeelight']) self.yeelight = yeelight.Yeelight(self.devices['yeelight'])
@ -60,7 +60,7 @@ class Webserver(object):
else: else:
print("Disabled Yeelight") print("Disabled Yeelight")
if(self.devices['ssh'] != None): if('ssh' in self.devices):
print("Enabled SSH") print("Enabled SSH")
from app.devices import ssh from app.devices import ssh
self.ssh = ssh.SSH(self.devices['ssh']) self.ssh = ssh.SSH(self.devices['ssh'])
@ -81,7 +81,7 @@ class Webserver(object):
else: else:
print("Disabled SSH") print("Disabled SSH")
if(self.devices['wol'] != None): if('wol' in self.devices):
print("Enabled WOL") print("Enabled WOL")
from app.devices import wol from app.devices import wol
self.wol = wol.WOL(self.devices['wol']) self.wol = wol.WOL(self.devices['wol'])