1
0
Fork 0
Browse Source

increase light threshold to 39 in gallery1.

I, commented out print statements and changed formating out print strings -- they were used for
testing.

Having ran the relays for a sustained period of time. It became apparent, the threshold for the light
levels in gallery1 was too low. What ended up happening was the light would remain on for long periods
of time through out the day but the light levels (Light Wave and Eyes and Ears) would show no welding
was occuring. What made this a little tricky to pick it apart, though, was some days the light levels
would rest at 38 and others at 39. Because it fluctuates, I couldn't tell if gallery1 would miss some
'welding triggers'. I decided to increase it to 39 in the end because the charts produced by Light Wave
suggests the change in light brought on by the welding increases the light levels by at least 2 -- most
of the time. So, by increasing the threshold to 39, the light levels must pass it which means the light
level must now hit 40+ effectively (not worrying about decimal values). This is still reachable on days
when the natural light level is at 38. The tradeoff is the system might miss the very short welding
bursts but the charts produced by Light Wave suggests they are too rare to interfere with the intended
effect/outcome of the system in a significant way. I say all this but I wouldn't be surprised if I
backtrack on everything I said here in a future commit.
unstable
gallery1 3 years ago
parent
commit
de3573cd21
  1. 8
      relay.py

8
relay.py

@ -26,17 +26,16 @@ api_url = get_api_url() # Saves having to do the if-check every call.
def main():
try:
s = requests.Session()
while True:
# Make sure the U.R.L. is valid.
s = requests.Session()
r = s.get(api_url, timeout=5)
# print(r.status_code) # For testing.
data = r.json()
# print(data) # For testing.
# print(f"{datetime.datetime.now()} -> {data}") # For testing.
the_reading = data.get("reading")
# print(the_reading) # For testing.
if (device_id == "gallery1"):
if (the_reading > 38):
if (the_reading > 39):
# print(f"[INFO: FACTORY1] Light is on -- {the_reading}.")
GPIO.output(relay_pin, GPIO.HIGH)
else:
@ -49,6 +48,7 @@ def main():
else:
# print(f"[INFO: FACTORY2] Light is off -- {the_reading}.")
GPIO.output(relay_pin, GPIO.LOW)
time.sleep(0.3)
except KeyboardInterrupt:
print("[INFO] KEYBOARD INTERRUPT: quitting program.")
except requests.exceptions.ConnectionError: