Dear all,
I just started with Esphome and want to integrate a 4x4 matrix keypad.
So far the ESP8266 (nodemcu V3) is connected to Esphome, but I dont see any keys pressed in the log. Dont know if it is a configuration problem or a hardware problem.
my yaml is as follow
esphome:
name: esphome-keypad
friendly_name: esphome-keypad
esp8266:
board: nodemcuv2
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "*"
ota:
password: "*"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esphome-Keypad Fallback Hotspot"
password: "zRphTnExtTJE"
captive_portal:
matrix_keypad:
id: mykeypad
rows:
- pin: D1
- pin: D2
- pin: D3
- pin: D4
columns:
- pin: D5
- pin: D6
- pin: D7
- pin: D8
keys: "123A456B789C*0#D"
has_diodes: false
key_collector:
- id: pincode_reader
source_id: mykeypad
# min_length: 4
max_length: 4
# end_keys: "#"
# end_key_required: true
# back_keys: "*"
# clear_keys: "C"
# allowed_keys: "0123456789"
# timeout: 5s
on_progress:
- logger.log:
format: "input progress: '%s', started by '%c'"
args: [ 'x.c_str()', "(start == 0 ? '~' : start)" ]
on_result:
- logger.log:
format: "input result: '%s', started by '%c', ended by '%c'"
args: [ 'x.c_str()', "(start == 0 ? '~' : start)", "(end == 0 ? '~' : end)" ]
- text_sensor.template.publish:
id: keypad
state: !lambda "return x.c_str();"
on_timeout:
- logger.log:
format: "input timeout: '%s', started by '%c'"
args: [ 'x.c_str()', "(start == 0 ? '~' : start)" ]
text_sensor:
- platform: template
name: "Keypad Code"
id: keypad
Log
[23:05:38][I][app:102]: ESPHome version 2023.12.9 compiled on Jan 29 2024, 23:02:50
[23:05:38][C][wifi:573]: WiFi:
[23:05:38][C][wifi:405]: Local MAC: *
[23:05:38][C][wifi:410]: SSID: [redacted]
[23:05:38][C][wifi:411]: IP Address: 192.168.178.225
[23:05:38][C][wifi:412]: BSSID: [redacted]
[23:05:38][C][wifi:414]: Hostname: 'esphome-keypad'
[23:05:38][C][wifi:416]: Signal strength: -56 dB ▂▄▆█
[23:05:38][C][wifi:420]: Channel: 11
[23:05:38][C][wifi:421]: Subnet: 255.255.255.0
[23:05:38][C][wifi:422]: Gateway: 192.168.178.1
[23:05:38][C][wifi:423]: DNS1: 192.168.178.128
[23:05:38][C][wifi:424]: DNS2: 0.0.0.0
[23:05:38][C][logger:439]: Logger:
[23:05:38][C][logger:440]: Level: DEBUG
[23:05:38][C][logger:441]: Log Baud Rate: 115200
[23:05:38][C][logger:443]: Hardware UART: UART0
[23:05:38][C][template.text_sensor:020]: Template Sensor 'Keypad Code'
[23:05:38][C][matrix_keypad:095]: Matrix Keypad:
[23:05:38][C][matrix_keypad:096]: Rows:
[23:05:38][C][matrix_keypad:098]: Pin: GPIO5
[23:05:38][C][matrix_keypad:098]: Pin: GPIO4
[23:05:38][C][matrix_keypad:098]: Pin: GPIO0
[23:05:39][C][matrix_keypad:098]: Pin: GPIO2
[23:05:39][C][matrix_keypad:100]: Cols:
[23:05:39][C][matrix_keypad:102]: Pin: GPIO14
[23:05:39][C][matrix_keypad:102]: Pin: GPIO12
[23:05:39][C][matrix_keypad:102]: Pin: GPIO13
[23:05:39][C][matrix_keypad:102]: Pin: GPIO15
[23:05:39][C][key_collector:023]: Key Collector:
[23:05:39][C][key_collector:027]: max length: 4
[23:05:39][C][captive_portal:088]: Captive Portal:
[23:05:39][C][mdns:115]: mDNS:
[23:05:39][C][mdns:116]: Hostname: esphome-keypad
[23:05:39][C][ota:097]: Over-The-Air Updates:
[23:05:39][C][ota:098]: Address: esphome-keypad.local:8266
[23:05:39][C][ota:101]: Using Password.
[23:05:39][C][api:139]: API Server:
[23:05:39][C][api:140]: Address: esphome-keypad.local:6053
[23:05:39][C][api:142]: Using noise encryption: YES
[23:08:18][I][ota:117]: Boot seems successful, resetting boot loop counter.
This is the keypad
I connected from the left to the right
D1 to D8
like the pad on the right
not sure if it is 100% correct, but at least is should see some output even it is the wrong key.
Any ideas ?