rc522 component allows you to use RC522 RFID controllers
(datasheet, Ali Express)
with ESPHome. This component is a global hub that establishes the connection to the RC522 via either SPI or
I²C and outputs its data. Using the RC522 binary sensors you can then
create individual binary sensors that track if an RFID tag is currently detected by the RC522.
See Setting Up Tags for information on how to setup individual binary sensors for this component.
The RC522 supports SPI, I²C and UART communication protocols, ESPHome can use either SPI or I²C.
If you have a RC522 which communicates via I²C like in the M5 Stack then you need to have an I²C bus configured.
spi: rc522_spi: cs_pin: GPIO15 binary_sensor: - platform: rc522 uid: 74-10-37-94 name: "RC522 RFID Tag"
i2c: rc522_i2c: cs_pin: GPIO2 binary_sensor: - platform: rc522 uid: 74-10-37-94 name: "RC522 RFID Tag"
reset_pin (Optional, Pin Schema): The pin connected to the RST line. Some tests shows the RC522 working okay without this.
update_interval (Optional, Time): The duration of each scan on the RC522. This affects the duration that the individual binary sensors stay active when they’re found. If a device is not found within this time window, it will be marked as not present. Defaults to
id (Optional, ID): Manually specify the ID for this component.
This automation will be triggered when the RC522 module responds with a tag. Please note that this
can be called quite often (with an interval of
update_interval) as it’s triggered repeatedly
if the tag is re-read many times.
x this trigger provides is of type
std::string and is the tag UID in the format
74-10-37-94. The configuration below will for example publish the tag ID on the MQTT topic
rc522_spi: # or rc522_i2c # ... on_tag: then: - mqtt.publish: topic: rc522/tag payload: !lambda 'return x;'
A tag scanned event can also be sent to the Home Assistant tag component using homeassistant.tag_scanned Action.
rc522_spi: # or rc522_i2c # ... on_tag: then: - homeassistant.tag_scanned: !lambda 'return x;'
rc522 binary sensor platform lets you track if an RFID tag with a given
unique id (
uid) is currently being detected by the RC522 or not.
# Example configuration entry spi: clk_pin: D0 miso_pin: D1 mosi_pin: D2 rc522_spi: # or rc522_i2c cs_pin: D3 update_interval: 1s binary_sensor: - platform: rc522 uid: 74-10-37-94 name: "RC522 RFID Tag"