🐟 Feeder.py feeding script

When it comes to feeding the fish in the aquarium using the Raspberry Pi I had to come up with a simple Python script to control the relay connected to the electronic feeder. Below is a simple script to activate the relay so that the feeder can fire off. The GPIO in use is Pin 18, and then I am using Pushover to send me an alert to let me know that the fish have indeed been fed.

import RPi.GPIO as GPIO
import time
import http.client, urllib

GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(18, GPIO.OUT)

GPIO.output(18, GPIO.LOW)
time.sleep(2)
GPIO.output(18, GPIO.HIGH)

conn = http.client.HTTPSConnection("api.pushover.net:443")
conn.request("POST", "/1/messages.json",
  urllib.parse.urlencode({
    "token": "XXXXXX",
    "user": "XXXXXX",
    "message": "The fish have been fed.",
  }), { "Content-type": "application/x-www-form-urlencoded" })
conn.getresponse()

I have this script set up to run daily each morning via a cron on the Raspberry Pi.