onlize
February 27, 2020, 2:03am
1
Hello, I purchased https://www.amazon.com/gp/product/B0718T232Z
I connected GPIO13 to 3.3v using 2.2k resistor as it shown here:
I am trying to setup binary sensor for my door. This is the configuration that I use:
esphome:
name: ring_and_salt_system
platform: ESP32
board: nodemcu-32s
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
captive_portal:
# Enable logging
logger:
baud_rate: 0
uart:
rx_pin: RX
baud_rate: 4800
# Enable Home Assistant API
api:
ota:
binary_sensor:
- platform: gpio
pin:
number: GPIO13
mode: INPUT_PULLUP
inverted: True
name: "Front Door"
device_class: door
It does not work for me. It always show that the door is closed.
Can someone help me with this?
tom_l
February 27, 2020, 2:57am
2
From your wiring picture and the fact that you have internal pull-ups enabled, your GPIO pin will always be at 3.3v. Pull-up is at 3.3v and your switch connects it to 3.3v when closed.
Remove the external GPIO resistor.
Re-wire your door switch to short the the GPIO to GND.
Leave the configuration of esphome as you have it. It is correct.
1 Like
NK553
(Brian)
February 27, 2020, 4:52am
3
This is correct, switch should go to ground , not 3.3v.
onlize
February 27, 2020, 12:37pm
4
Basically, you are telling me that GPIO should have either GND or 3.3V connection, is this correct? I tried it too and it is always closed.
I use solderless breadboard and move cable that is connected to GPIO13 between GND and 3.3V connections, but status does not change.
Anything else should I try? I watched this video and it says that I have to have resistor: https://www.youtube.com/watch?v=c0tMGlJVmkw
tom_l
February 27, 2020, 12:53pm
5
Then you have the wrong pin.
I didn’t watch it but they’re wrong. Enabling pull-ups does the same thing as an external resistor (all be it a lot weaker).
onlize
February 27, 2020, 1:16pm
6
Interesting. It started working. I removed connection to 3.3v and connect GPIO pin to GND pin only.
Basically, GPIO pin either connected to GND or not. Nothing else. Is it normal? Can I leave it like this?
Thank you for your help.
tom_l
February 27, 2020, 1:32pm
7
Yes. That is exactly what I said in my last post.
onlize
February 27, 2020, 1:34pm
8
Sorry but f I wanted to be sure because that video tells me that I have to have connection to 3.3V.
Again, thank you very much for your help.
1 Like
tom_l
February 27, 2020, 1:36pm
9
Don’t believe everything you read - or watch on YouTube
hi, gays, i have a problem similar to that i have a door sensor i connect it to gnd then to the door sensor, and to d1 but when it changes from on to off it gets stuck on off.
but when i use the same code and wiring for rx or tx pin its works properly
captive_portal:
binary_sensor:
- platform: gpio
name: "test1"
pin:
number: 10
id: test_1