ESPHome Doorbell Project help

hi,

i am making a doorbell project with esphome. When the D5 and GND pins are short-circuited, the system runs smoothly. I will input 1.2 V to this system through the A0 pin, and if the current is over 1 volt, I want to do the same by short-circuiting the d5 and gnd pins. If this is not possible, I can create a separate virtual switch and trigger it. Thanks in advance for the help.

binary_sensor:

  • platform: gpio
    pin:
    number: D5
    mode: INPUT_PULLUP
    inverted: True
    name: “Kapı Zili”
    device_class: window
    filters:

    • delayed_on: 10ms
  • platform: template
    id: diskapivoltage
    lambda: return (analogRead(A0) > 1.1);
    on_press:
    then:
    - switch.toggle: diskapi

switch:

  • platform: gpio
    pin: D5
    name: “Sokak Kapısı”
    id: diskapi

1 volt is not a measure of current.

and if the voltage is over 1 volt,