Connect sensor directly via gpio to the ha-raspberry

I am looking for a solution to connect a simple ambient light sensor directly (!) via gpio to the raspberry, which also runs home Assistant. I usually only use external ESP, so I am a bit unsure. So far I have found in the forums some things to MySensors integration or approaches like:

  - platform: ?? 
    i2c_address: 0x20
    scan_interval: 1

Thanks for hints!

You need a custom component for this since a few months ago.

After some searching I found this: Rpi GPIO not working - #9 by lexridge and I’ll try to connect the sensor with this Integration…

Do you think, it’s possible to integrate it by I2C-Bus? Like esphome? It looks very ‘binary’…

ok, it seems to be at least very complicated, or even no longer possible. I had found some more contributions on this (link). I think I will have to use a D1 mini again. But it’s a pity that the GPIOs on the HA-Raspberry are so bad to use.

I have never used any of the GPIO on the pi.
I’m not of any help

@rr19-hub It’s really not as complicated as it appears on the surface. Make sure you do not already have a binary_sensor section in your yaml config file. If you do, you need to add it UNDER what is already there. If you have two binary_sensor sections, it will not work and it will also probably complain that your configuration.yaml is not correct. Once you decompress the zip file, be sure to only put the rpi_gpio folder inside of custom_components. The other stuff is not needed. Here is my entry in configuration.yaml

#Line Power Sensor relay
# GPIO: rpi_gpio platform
  - platform: rpi_gpio
      18: Home Power Monitor
#    invert_logic: true
    pull_mode: DOWN

Hope this helps.

What about analog sensors? I have a photoresistor. How can I use it with the GPIO pins?