Mar-15-2023, 12:48 PM
OK, I feel stupid, I added the line to print the time readout, the function is running, however I am not seeing the print of LightsActivated, but the code proceeds to action the post requests.
from pushbullet import Pushbullet import RPi.GPIO as GPIO import requests from time import sleep from gpiozero import Button from datetime import datetime def lights(): now = datetime.now() if (2, 0, 0) <= (now.hour, now.minute, now.second) < (6, 0, 0): print("LightsActivated", now.hour, now.minute, now.second, now) requests.post('http://10.0.0.36/light/0?turn=on&brightness=100') requests.post('https://maker.ifttt.com/trigger/lights/json/with/key/key') sleep(3) requests.post('https://maker.ifttt.com/trigger/lights2/json/with/key/key') sleep(2) requests.post('https://maker.ifttt.com/trigger/lights3/json/with/key/key') sleep(3) button = Button(2) pb = Pushbullet("key") pbv = Pushbullet("key") print(pb.devices) print(pbv.devices) while True: if button.is_pressed: print("Trigger") push = pb.push_note("IR Detect", "Beams Detect") push = pbv.push_note("IR Detect", "Beams Detect") lights() sleep(21) else: print("NoTrigger")I also never get to the else when there isn't an activation. Appreciate the help for this noob!!