Commit 8d99e244 authored by Peter-Bernd Otte's avatar Peter-Bernd Otte

camelCase for luxThreshold

parent fa34e222
...@@ -16,7 +16,7 @@ testraum/testrelais: ...@@ -16,7 +16,7 @@ testraum/testrelais:
toggleTopics: homie/enocean/test/schalter2 toggleTopics: homie/enocean/test/schalter2
inverseSwitchOnTopics: homie/enocean/test/schalter6 inverseSwitchOnTopics: homie/enocean/test/schalter6
prolongateStateTopics: homie/enocean/test/schalter5 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: testraum/testrelais2:
MQTTRelaisTopic: homie/fsr-ww/3 MQTTRelaisTopic: homie/fsr-ww/3
......
...@@ -123,11 +123,11 @@ for section in cfg: ...@@ -123,11 +123,11 @@ for section in cfg:
if x.MQTTRelaisTopic == cfg[section]["MQTTRelaisTopic"]: if x.MQTTRelaisTopic == cfg[section]["MQTTRelaisTopic"]:
logger.error("MQTTRelaisTopic: "+str(cfg[section]["MQTTRelaisTopic"])+" does already exist. Will not be added.") logger.error("MQTTRelaisTopic: "+str(cfg[section]["MQTTRelaisTopic"])+" does already exist. Will not be added.")
continue continue
luxthreshold = 100 luxThreshold = 100
if "luxthreshold" in cfg[section]: if "luxThreshold" in cfg[section]:
luxthreshold = cfg[section]["luxthreshold"] luxThreshold = cfg[section]["luxThreshold"]
if type(luxthreshold) is not int: luxthreshold = 100 if type(luxThreshold) is not int: luxThreshold = 100
logger.debug("luxthreshold used: "+str(luxthreshold)) logger.debug("luxThreshold used: "+str(luxThreshold))
defaultTopics = cfg[section]["defaultTopics"] if "defaultTopics" in cfg[section] and isinstance(cfg[section]["defaultTopics"],(list, str)) else [] 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 [] 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: ...@@ -152,7 +152,7 @@ for section in cfg:
switchOffTopics=switchOffTopics, switchOffTopics=switchOffTopics,
defaultTopics=defaultTopics, inverseSwitchOnTopics=inverseSwitchOnTopics, defaultTopics=defaultTopics, inverseSwitchOnTopics=inverseSwitchOnTopics,
prolongateStateTopics=prolongateStateTopics, prolongateStateTopics=prolongateStateTopics,
defaultSwitchOffTime=defaultSwitchOffTime, debug=debugItem, relaisType=relaisType, luxthreshold=luxthreshold)) defaultSwitchOffTime=defaultSwitchOffTime, debug=debugItem, relaisType=relaisType, luxThreshold=luxThreshold))
logger.info("Adding successfully.") logger.info("Adding successfully.")
......
...@@ -22,11 +22,11 @@ class rLightDesire(Enum): ...@@ -22,11 +22,11 @@ class rLightDesire(Enum):
class relais: class relais:
def __init__(self, MQTTClient, MQTTName, MQTTRelaisTopic, defaultTopics=None, toggleTopics=None, dimmTopics=None, def __init__(self, MQTTClient, MQTTName, MQTTRelaisTopic, defaultTopics=None, toggleTopics=None, dimmTopics=None,
switchOffTopics=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.MQTTname = MQTTName #string
self.type = relaisType # possible: "relais" and "dimmer" self.type = relaisType # possible: "relais" and "dimmer"
self.debug = debug 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.MQTTClient = MQTTClient #object
self.MQTTRelaisTopic = MQTTRelaisTopic #string self.MQTTRelaisTopic = MQTTRelaisTopic #string
...@@ -89,7 +89,7 @@ class relais: ...@@ -89,7 +89,7 @@ class relais:
self.timeLastStateConfirm = time.time() self.timeLastStateConfirm = time.time()
if self.debug: print(self.MQTTname, "Check Motion Sensors") if self.debug: print(self.MQTTname, "Check Motion Sensors")
lux = msg['lux'] if 'lux' in msg else 100 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.lockingPIRs.add(topic)
self.lightdesire = rLightDesire.lockedDueToPIR self.lightdesire = rLightDesire.lockedDueToPIR
self.setV(1, reason="PIR motion") self.setV(1, reason="PIR motion")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment