I have Co2 meter that controls a temperature relay that i have on a short interval timer.
And i have a window opener that i want to open for a few sec and then check again in 10 min.
The easiest would have been to have two meters on different clocks but they conflict since they read the same port as i have only one meter in reality.
I get it that the clock resets the long delay and I tried other delay posts but i cant figure it out. Pls help.
You leave a lot unsaid, and your code doesnāt quite match what you saidā¦
Assuming you open the window when CO2 is too low, your program currently waits 10 minutes, then opens window for 5 seconds.
If you are trying to prevent the window being open more than 5 seconds every 10 minutes, probably the simplest solution is to block signals to that part of the program for 10 minutes using a āgateā node.
While the 10-minute delay timer is NOT active, we pass the CO2 value to the ālessā node. The same time the 10-minute timer is started, we open the window for 5 seconds.
NOTE: the ādeferā node is needed any time you run a wire āupā the program to create a loop.
Sorry about being vague before and messing up the nodes. I just want the window to open for a few sec and quickly close so it does not get cold IF the co2 gets too high but i want to control how often he checks and how long the window remains open.
Hmmā¦the āgateā node quits updating CO2 levels to ālessā node, so it will be stuck on true, but since it is not āchangingā to true, it should not trigger relay to open the window again during that 10-minute time it is locked. There would be an issue if CO2 level is still out-of-bounds when 10-minute timer ends because the state of ālessā does not change to send another pulse.
This might fix the problem:
Now we trigger the window to open if CO2 levels are wrong AND we are outside the 10-minute pause.
I think this will work, but if the window never opens, you might need a ādeferā node between the ānotā and āandā, just to make sure the relay triggers before it goes into āpauseā state. The fact that ālessā links directly to āandā, while the other path goes through ādelayā and ānotā should mean you donāt need the extra ādeferā.
I cycles once, on off on and then stays like that forever. Maybe missing a defer for the second delay? Then again I am barely able to follow what you did. It seems easier to get another sensor / arduino. But thanks anyway.
Wellā¦call me confusedā¦ How can the relay stay on if it is only on when delay is active? I donāt see how the delay could keep getting triggered every 5 secondsā¦
You are saying the relay for D4 is staying on after doing one on-off-on cycle? How long is it on & off for?
It starts, stays on for the amount of the first delay, then off for the amount of the second delay and then once its done it turns on again and stays like that. And yes even when it says false but the main point is that it does not cycle, the gate is tripping.
Does it do the same for you? You donāt need a sensor, I unplugged it so it stays at 0 just in case.
This is why I hate coding, a simple thing will take days to figure out (if at al)l and from what i hear even then there is a lot of praying, begging and dark magic involved.
Pictured above is the full program you uploaded for this last test?
āIt starts onā means the relay that is connected to D4. What exactly is connected to D4 and how do you know it is on?
It stays on for 15 seconds, then turns off for 3 seconds, then turns on & stays on?
Is picture above at the end while relay was on?
The above picture shows both delays off, which should mean the relay is off, and likely means the longer delay is not getting re-triggered after it expires because output of ālessā is not changing (so it never pulses delay-SET again; the same problem we had with smaller delay and why we added the āandā node). If we have āandā nodes feeding each delay node, we probably donāt need the āgateā node because āandā node would basically do the same thing.
But yes, my bad, the green relay light goes out when it opens and not the other way round. Sorry about that! Weird design. My other relay has it the other way round. Lights up red when open. Anyway to answer your questions:
1: Yes
2: See above
3: Yes
4: Yes