I had a PN532 NFC Reader device on an ESP32 running ESPHome and wanted a way to notify Home Assistant if the Reader became unavailable (and therefore stop functioning).
Always use legit Elechouse PN532 devices, most online stores are selling counterfeits that fail to perform.
Place the following blob in your ESPHome Device Config.
binary_sensor:
- platform: template
name: "NFC Reader Availability"
lambda: |-
if (id(my_pn532).status_has_warning()) {
return false;
} else {
return true;
}
The entity will appear in Home Assistant as “NFC Reader Availability” under the ESPHome Device.