I recently purchased my first (and likely not my last!) Pimoroni product: an Automation pHAT. I was tinkering with it and a Pi Zero W with a PiNoir camera to make a garage door controller. It was pretty easy to set up a simple configuration with a reed switch to tell if the door was closed, use the relay to control the garage door opener, and set the camera up with motion-mmal for alerts.
I recently discovered Home Assistant, and started setting that up on a rPi 2 b. Somewhere along the way I got the bright idea to combine the two projects. I was able to get the relay working natively within Home Assistant using the instructions at https://www.home-assistant.io/components/switch.rpi_gpio/. Essentially I just added a section to my configuration file that tells the software to use GPIO 16 as a switch. Doing so added a switch to the Home Assistant GUI, and clicking it toggles the relay. Couldn’t be simpler, really. I can even add it to automations and easily control it from my phone.
I’m hoping to get some help doing something similar using the three input channels on GPIO 26 (input 1), 20 (input 2), and 21 (input 3) on the pHAT. I’m wondering if I can use them as binary sensors using the instructions at https://www.home-assistant.io/components/binary_sensor.rpi_gpio/. I did try just adding the three GPIOs as sensors, but Home Assistant always thinks they are on, no matter what I do to change the physical state of the inputs.
actually I am trying to get Automation pHat running too, but without full success. The config above incl. pull_mode: “DOWN” works, but only after original Pimoroni’s demo script is started after HA. This looks like the HA’s GPIO configuration still differs. When trying to find the difference, there looks that the original code uses no pull up/down configuration. The same happens also with plain python code (see below) or configuration with raspi-gpio. But what I am missing is - how to configure binary_sensor WITHOUT pull_mode? (as the default is “UP”).
Anyone has an idea what might be wrong or how to configure “no pull up/down” from HA’s binary_sensor? @Ezrem - does it really work for you with this config without any further GPIO (re)config?