Hi All,
New to this forum, but have used information in past to setup up my grow room.
I was hoping could assist with a issue i have. I’m currently using the DHT-22 temp//humidity sensors to monitor my room, but quickly found these fail quite regularly when the relays are switching. I have full separation from AC and control cables, i have used shielded cables form control wiring. all these measures and still couldn’t get reliability from these sensors.
I have just ordered some SHT40 sensors to replace the DHT-22. While i wait for these come i need to ensure these sensors are still working, so what i have done is wired the DHT-22 5v power through its own relay, and planed to use a conditional function to turn this relay on for 1 second and off again when ever the sensor fails.
I thought this would be simple function with only few lines of code, but i can’t seem to get it to work. is anyone have any help me to get this to work?
below are the screen shots of my configuration and code.
1: import os
2: import sys
3: sys.path.append(os.path.abspath(’/var/mycodo-root’))
4: from mycodo.controllers.base_conditional import AbstractConditional
5: from mycodo.mycodo_client import DaemonControl
6: control = DaemonControl(pyro_timeout=60.0)
7:
8: class ConditionalRun(AbstractConditional):
9: def init(self, logger, function_id, message):
10: super(ConditionalRun, self).init(logger, function_id, message, timeout=60.0)
11:
12: self.logger = logger
13: self.function_id = function_id
14: self.variables = {}
15: self.message = message
16: self.running = True
17:
18: def conditional_code_run(self):
19: measurement = self.condition(“49819628-7c71-4887-9444-daaad8cc4ca2”)
20:
21:
22: if measurement == 0 or measurement is None:
23: self.run_all_actions()