Hey guys,
New to openhab so take it easy on me. I just spent the past several days doing initial setup on a Rpi 3B+. I have I installed another Rpi in my garage with several relays and reed sensors connected to the GPIO for control and status of the garage doors and all is working well.
Now the issue is I am running into is making a rule for my arrival home from work that will turn on several lights, open the garage door ect (right now it is just set to open the door) as I am coming down my street. I would like this rule to only push the garage door button (relay) if the door is closed in case the wife is outside and has it opened so I do not close it on her ect. I am using the following .py script / exec binding to check door status in openhab and all works well during manual operations, however when an attempt is made to make it conditional on door status the rule will not work.
What am I missing?
Door status .py script
import RPi.GPIO as GPIO #import the GPIO library
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(20, GPIO.IN, pull_up_down=GPIO.PUD_UP)
while True:
if GPIO.input(20):
print("Closed")
exit()
if GPIO.input(20) == False:
print("Open")
exit()
.rule file
rule "Arrival"
when
Item im_home changed from OFF to ON
then
if( CenterDoorStatus_Output.state == Closed ){
centerdoorbutton.sendCommand(ON)
}
End