From 8d99e24481b9b2ad4d03d59fbd69d83b87ffc4e7 Mon Sep 17 00:00:00 2001 From: Peter-Bernd Otte Date: Sat, 17 Aug 2019 13:38:36 +0100 Subject: [PATCH] camelCase for luxThreshold --- python/relais-control/default.yml | 2 +- python/relais-control/relais-control.py | 12 ++++++------ python/relais-control/relais.py | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/python/relais-control/default.yml b/python/relais-control/default.yml index b4ceab3..f38907e 100644 --- a/python/relais-control/default.yml +++ b/python/relais-control/default.yml @@ -16,7 +16,7 @@ testraum/testrelais: toggleTopics: homie/enocean/test/schalter2 inverseSwitchOnTopics: homie/enocean/test/schalter6 prolongateStateTopics: homie/enocean/test/schalter5 - luxthreshold: 200 #below this threshold, lights get switched on. Default=100 + luxThreshold: 200 #below this threshold, lights get switched on. Default=100 testraum/testrelais2: MQTTRelaisTopic: homie/fsr-ww/3 diff --git a/python/relais-control/relais-control.py b/python/relais-control/relais-control.py index 4c0ddb6..6512dcf 100755 --- a/python/relais-control/relais-control.py +++ b/python/relais-control/relais-control.py @@ -123,11 +123,11 @@ for section in cfg: if x.MQTTRelaisTopic == cfg[section]["MQTTRelaisTopic"]: logger.error("MQTTRelaisTopic: "+str(cfg[section]["MQTTRelaisTopic"])+" does already exist. Will not be added.") continue - luxthreshold = 100 - if "luxthreshold" in cfg[section]: - luxthreshold = cfg[section]["luxthreshold"] - if type(luxthreshold) is not int: luxthreshold = 100 - logger.debug("luxthreshold used: "+str(luxthreshold)) + luxThreshold = 100 + if "luxThreshold" in cfg[section]: + luxThreshold = cfg[section]["luxThreshold"] + if type(luxThreshold) is not int: luxThreshold = 100 + logger.debug("luxThreshold used: "+str(luxThreshold)) defaultTopics = cfg[section]["defaultTopics"] if "defaultTopics" in cfg[section] and isinstance(cfg[section]["defaultTopics"],(list, str)) else [] toggleTopics = cfg[section]["toggleTopics"] if "toggleTopics" in cfg[section] and isinstance(cfg[section]["toggleTopics"],(list, str)) else [] @@ -152,7 +152,7 @@ for section in cfg: switchOffTopics=switchOffTopics, defaultTopics=defaultTopics, inverseSwitchOnTopics=inverseSwitchOnTopics, prolongateStateTopics=prolongateStateTopics, - defaultSwitchOffTime=defaultSwitchOffTime, debug=debugItem, relaisType=relaisType, luxthreshold=luxthreshold)) + defaultSwitchOffTime=defaultSwitchOffTime, debug=debugItem, relaisType=relaisType, luxThreshold=luxThreshold)) logger.info("Adding successfully.") diff --git a/python/relais-control/relais.py b/python/relais-control/relais.py index d5b28d4..6dc05ad 100644 --- a/python/relais-control/relais.py +++ b/python/relais-control/relais.py @@ -22,11 +22,11 @@ class rLightDesire(Enum): class relais: def __init__(self, MQTTClient, MQTTName, MQTTRelaisTopic, defaultTopics=None, toggleTopics=None, dimmTopics=None, switchOffTopics=None, - inverseSwitchOnTopics=None, prolongateStateTopics=None, defaultSwitchOffTime=None, debug=False, relaisType="relais", luxthreshold=100): + inverseSwitchOnTopics=None, prolongateStateTopics=None, defaultSwitchOffTime=None, debug=False, relaisType="relais", luxThreshold=100): self.MQTTname = MQTTName #string self.type = relaisType # possible: "relais" and "dimmer" self.debug = debug - self.luxthreshold = luxthreshold #below this threshold in lux the PIR switches on + self.luxThreshold = luxThreshold #below this threshold in lux the PIR switches on self.MQTTClient = MQTTClient #object self.MQTTRelaisTopic = MQTTRelaisTopic #string @@ -89,7 +89,7 @@ class relais: self.timeLastStateConfirm = time.time() if self.debug: print(self.MQTTname, "Check Motion Sensors") lux = msg['lux'] if 'lux' in msg else 100 - if msg['v'] > 0 and self.luxthreshold > lux: + if msg['v'] > 0 and self.luxThreshold > lux: self.lockingPIRs.add(topic) self.lightdesire = rLightDesire.lockedDueToPIR self.setV(1, reason="PIR motion") -- GitLab