From e5f421bb49f8ad63cbc69f08f7597772bf260ca1 Mon Sep 17 00:00:00 2001 From: wez3 Date: Tue, 3 Jan 2017 20:14:00 +0100 Subject: [PATCH] Some code tweaks --- modules/api.py | 11 +++-------- templates/switches.html | 2 -- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/modules/api.py b/modules/api.py index 5b20489..e16ef7d 100644 --- a/modules/api.py +++ b/modules/api.py @@ -121,15 +121,12 @@ def checkDomoticzStatus(config): result = json.loads(queryDomoticz("?type=devices&filter=all")) resultScene = json.loads(queryDomoticz("?type=scenes&filter=all")) except: - print "Domoticz is not reachable." - sys.exit() + sys.exit("Domoticz is not reachable.") for device in result["result"]: domoticzDevices.append(device["idx"]) for device in resultScene["result"]: domoticzScenes.append(device["idx"]) - configuredDevicesInDomoticz(config, domoticzDevices, domoticzScenes) - #configuredDevicesInDomoticz(config, domoticzScenes) def configuredDevicesInDomoticz(config, domoticzDevices, domoticzScenes): for k, v in config.iteritems(): @@ -138,12 +135,10 @@ def configuredDevicesInDomoticz(config, domoticzDevices, domoticzScenes): else: if isinstance(v, int): if v not in domoticzDevices and v not in domoticzScenes: - print "Device with " + v + " is not available in Domoticz" - sys.exit() + sys.exit("Device and/or scene with IDX {} is not available in Domoticz".format(v)) elif isinstance(v, list): if (v[0].isdigit()) and (v[0] not in domoticzDevices and v[0] not in domoticzScenes): - print "Device with " + v[0] + " is not available in Domoticz" - sys.exit() + sys.exit("Device and/or scene with IDX {} is not available in Domoticz".format(v[0])) def getPluginDict(): global indexes diff --git a/templates/switches.html b/templates/switches.html index 0669aa6..0491ae6 100644 --- a/templates/switches.html +++ b/templates/switches.html @@ -114,12 +114,10 @@ $(document).ready(function() { {% elif (v[1] == "group") or (v[1] == "scene") %} $('button[id="groupon_{{v[0]}}_block_{{count}}"]').click(function(e) { e.preventDefault(); - console.log('group on'); changeScene({{v[0]}}, 'on'); }); $('button[id="groupoff_{{v[0]}}_block_{{count}}"]').click(function(e) { e.preventDefault(); - console.log('group off'); changeScene({{v[0]}}, 'off'); }); $('button[id="scene_{{v[0]}}_block_{{count}}"]').click(function(e) {