Skip to content

Running Lion

  • Change default login
  • Enable PiFan
  • Set disks to spindown after 20 mins idle with hd-idle

GPIO

Physical Pin GPIO Func Connected Device
4 5V Fan 5V
6 GND Fan GND
12 PWM0 PWM Fan Control
3 GPIO Input Door Sensor In
9 GND Door Sensor GND
5 GPIO Output Buzzer Out
14 GND Buzzer Ground

Test Script

Not working

Buzzes properly but doesn't print when door opens and closes

from gpiozero import OutputDevice, Button
from time import sleep
from multiprocessing import Process
from signal import pause
try:
    door = Button("BOARD3")
    buzz = OutputDevice("BOARD5")

    def buzz_loop():
        while True:
            buzz.on()
            sleep(1)
            buzz.off()
            sleep(1)

    def door_open():
        print("Door open")

    def door_close():
        print("Door close")

    def contact_state_loop():
        door.when_pressed = door_open
        door.when_released = door_close
        pause()
    Process(target=buzz_loop).start()
    Process(target=contact_state_loop).start()
finally:
    buzz.off()

HomeAssistant

Runs as a docker-compose instance with home at /home/britton-charlie/homeassistant.

Comments