Closed niciBume closed 4 months ago
After 3 long weeks i have successfully the system up and running. but do you have maybe a sample code to actuate my servo? i cant get it to work on my own :(
Kann mir vlt jemand helfen? Wie bekomme ich diese Funktion nun in die Katzenklappe eingebaut? Ich möchte nur ein Servo steuern :(
` import RPi.GPIO as gpio import time
servo = 18 gpio.setmode(gpio.BCM) gpio.setup(servo, gpio.OUT)
p = gpio.PWM(servo, 50) p.start(2.5) try: while True: p.ChangeDutyCycle(7.5) time.sleep(3) p.ChangeDutyCycle(2.5) time.sleep(3) except KeyboardInterrupt: p.stop() `
Hi
Vorausgesetzt dein Servo code funktioniert, so würde ich aus dem Kopf heraus folgende Code Fragmente in die entsprechenden Zeilen einfügen:
gpio.setup(18, gpio.OUT)
-> Board setup
p = gpio.PWM(servo, 50)
p.start(2.5)
try:
while True:
p.ChangeDutyCycle(7.5)
time.sleep(3)
p.ChangeDutyCycle(2.5)
time.sleep(3)
except KeyboardInterrupt:
p.stop()
hi I'm not familiar with python, but if I wanted to send a webhook to my homeassistant, woud a line (674), in cascade.py, like
def node_let_in(self, bot, update):
self.node_let_in_flag = True
contents = urllib.request.urlopen("http://192.168.1.22:8123/api/webhook/-bla_di_blah-").read
do the trick? Plus import urllib.request
at the top, of course.
I didn't install/test any of this yet, still waiting for my raspi 5 to arrive, so I can use the raspi 4 for it.
I have a 'surepet connect catflap' and the sureha integration in hassio. There probably is a way to send an unlock request directly to the surepetcare.io API, maybe use the https://github.com/benleb/surepy library, so I could even avoid going through homeassistant in the first place, I'll have a look into that later.. btw, very nice system :) I can try to provide some more training pictures, as they come in :)
Hi there,
I'm not familiar with how the surepet api works but seems reasonable to me. But perhaps also check Sequential_Cascade_Feeder.send_no_prey_message()
if that would be suitable for you :)
Thanks and cheers
The system is built to just run the cascade and notify you via telegram for now. You would have to add the code to actuate the GPIO's of the RPI on your own, until I add this feature. Easiest way would be to call a function that opens the door in
Sequential_Cascade_Feeder.send_no_prey_message()
at line 193 in cascade.py