ESP32 / Wemos D32 won't boot when Input pulled low

Hello group,

I have a gate which has two relay (zero-potential) contacts and I am trying to interface it with a Wemos D32. I have a self developed board with array of Schmitt triggers to do some input filtering:

The relay contacts connect the Schmitt input to Ground (at the ESP, not some random ground).

My config in ESPHome is like this:

binary_sensor:

  - platform: gpio
    pin:
      number: 13
      mode: INPUT
    id: "brana_k1_in"

  - platform: gpio
    pin:
      number: 27
      mode: INPUT
    id: "brana_k2_in"

The problem now is that the ESP won’t boot when any of the inputs is grounded by the relay, therefore driving the Schmitt output pin HIGH.

Any ideas? The pins 13 or 27 do not seem to be the usual suspects. (I have tried connecting only one pin at a time and the outcome was the same.)