Access control with ESPHome, Home Assistant and Node Red

Hi im getting this error when trying to install your smaller version of code on the d1 mini. I dont know much about coding i barely get by on some of the harder stuff with hours of googling lol

function:
/config/esphome/rfid-reader.yaml:41:26: error: expected type-specifier before ‘WiegandReader’
41 | auto wiegand = new WiegandReader(GPIO5, GPIO4);
| ^~~~~~~~~~~~~
/config/esphome/rfid-reader.yaml:43:22: error: could not convert ‘{wiegand}’ from ‘’ to ‘std::vectoresphome::sensor::Sensor*
43 | return {wiegand};
| ^
| |
|
*** [/data/rfid-reader/.pioenvs/rfid-reader/src/main.cpp.o] Error 1
========================== [FAILED] Took 2.60 seconds ==========================