homebridge / HAP-NodeJS

Node.js implementation of the HomeKit Accessory Protocol (HAP)
Apache License 2.0
2.69k stars 630 forks source link

Changing Lock status to locked after some time #450

Closed domagalaszymon closed 7 years ago

domagalaszymon commented 7 years ago

Hi, i have the code, that opens my door by the realy. It give High state for 3 seconds and after that i wanted to switch the status to Locked back. How can i do this? ;)

My code:

https://pastebin.com/b4EGy0gp

and the python code:

import RPi.GPIO as GPIO from time import sleep

this is the pin variable, change it if your relay is on a different pin

relay=36; GPIO.setmode(GPIO.BOARD) GPIO.setup(relay, GPIO.OUT) GPIO.output(relay, GPIO.HIGH) GPIO.output(relay, GPIO.LOW) sleep(3) GPIO.output(relay, GPIO.HIGH) GPIO.cleanup()

brownad commented 7 years ago

Its not a great example, but this worked for me: https://github.com/brownad/homebridge-doorbird/blob/master/index.js

Its set to locked by default, opens for a few seconds then locks again (I never know if its locked due to API I call, can only trigger an open event)

brownad commented 7 years ago

@KhaosT can probably close this now