Read keypad and check database

Could someone provide me with suggestions, or if anyone has already accomplished this, guide me on how to set up an ESP8266 to oversee a keypad’s input and verify if the entered digits are present in a database? If a match is found, I would like to trigger a relay.

ok , that key pad configuration with a matrix keyboard , where do i see the output from the key board , I am not sure what else is needed for it to compare this data with a value in the database
Thanks

It says this in the first paragraph:

The component outputs the result of the keypress sequence as a variable usable in automations.

Then later in the automation section, https://esphome.io/components/key_collector#automations it tells you that the variable is x.

You compare this x value to your stored value.

hi
Now that I have that working , comparing what is entered to what is in the text_sensor.state, and can trigger a relay. How can i now use the keyed in value and compare it with access code that is in a database or in a txt file some where , where the file can be updated dynamically
Thanks

You don’t mention what sort of database. Assuming SQL, you could use an SQL sensor in home assistant and bring that into esphome as a text sensor.

hi
I am planning on mysql, if i am using a text sensor can i use it to read a text file on a remote smb share, that saves running a database

Thanks

The ESPHome text sensor is for importing Home Assistant sensors into ESPHome.

Hi Michael,
Would you be willing to elaborate a bit more about how you ended up?
I want to do the same thing, have a wonderful simple, robust and working esp32 part with ZKteco RFID reader and keypad and now look for strategies how to query an SQL DB and activate a relay, or not using an SQL DB at all.
Cheers, Jan

sorry never got to finish the project, I have the hardware built with code comparing what’s being typed against an internal value and operating a relay