I am using HA and getting to enjoy it more and more. After using a number of MQTT devices, I am now experimenting with the PI’s GPIO pins.
I am using GPIO pin 17 as input. I have confirmed that wiring is correct by creating the following simple phyton script in jessie to read input.
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.IN, pull_up_down=GPIO.PUD_UP)
while True:
input_state = GPIO.input(17)
if input_state == False:
print('On')
time.sleep(0.2)
else:
print ('Off')
Output is correct. Depending on input, a message saying On or Off is displayed as expected.
However, these states are not reflected in HA.
The GPIO input is defined as a sensor (see below), and this shows on the dashboard.
binary_sensor:
- platform: rpi_gpio
ports:
17: IntruderAlarm
It does change state occasionally, but more often than not, it fails to update.
Looks like a HA issue, but being a relative newbie to HA I cannot be so sure.
Did anyone come across this issue or can offer some advice please?