Hi,
I’m trying to use the Matrix keypad component, but the documentation example is giving me trouble, the yaml processor doesn’t recognize the “on_key:” automation.
You have hyphen - in the id section that is not in the example. But doesnt sound to be the problem.
Hi taikapanu,
the red hyphen is not part of the yaml, it is the yaml processor that uses it to identify the problematic section.
Post your original yaml file then…
Well, numbers after “keys” are not in quotation, although it compiles fine here without them it might be the problem for you, depending on compiler, i guess (official manual have those in quotation).
Did you try clean build ? Often it helps. I suppose you have latest esphome version…?
(but post yaml’s as text in the future, not as picture, it’s easier to copy/paste your case in my file and see if that’s a problem).
If you look at the original you asked me for, you will see that the numbers after “keys” are in quotes. And as I said, I copied and pasted from the manual, so that is not the problem. ESPHome version 2024.11.3 and Home Assistant version 2024.12.5 . Cleaning the build, gives exactly the same problem.
esphome:
name: teclado
platform: esp32
board: esp32dev
api:
encryption:
key: “…”
globals:
- id: texto
type: char[12]
restore_value: yes
ota:
- platform: …
password: …
wifi:
ssid: …
password: …
manual_ip:
static_ip: 192.168.0.8
gateway: 192.168.0.1
subnet: 255.255.255.0
logger:
baud_rate: 9600
matrix_keypad:
id: mykeypad
rows:
- pin: GPIO14
- pin: GPIO25
- pin: GPIO27
- pin: GPIO26
columns:
- pin: GPIO32
- pin: GPIO33
- pin: GPIO34
- pin: GPIO35
keys: “123A456B789C*0#D”
has_diodes: false
on_key:
- lambda: ESP_LOGI(“KEY”, “key %d pressed”, x);
We found your problem: “on_key” was introduced only in esphome 2024.12. So, update your esphome and you’re done.
(yeah, i know… you copied from online manual. But that manual assumes you have the latest version installed…)
OK, I updated ESPHome and now everything is fine. Thanks for your help.