Use phones with the NFC-1¶
Difficulty: Level 1
Your Apollo NFC-1 can tell a phone apart from an NFC tag. This guide shows you what happens when a phone taps the NFC-1, how to run an automation from that tap, why phones can't be written, and how to have phones open a link instead.
Before you start
Add your NFC-1 to Home Assistant first. The getting started guide walks you through it.
How the NFC-1 spots a phone¶
A phone held to the NFC-1 shows a new random UID (the ID number the reader sees) that starts with 08- every time it's read. Because that UID never repeats, it can't work as a tag for automations. The NFC-1 treats it as a phone instead:
- Phone Present turns on.
- NFC Event fires
phone_detectedonce per visit, not once per read. A tap within about 5 seconds of taking the phone away is the same visit. - With Card Emulation off (the default; see Have phones open a link), the LED flashes purple once and the buzzer plays one low beep.
- Nothing is added to Settings → Tags. Last Tag, Last Tag UID, Last Tag Content, and Tag Present don't change, and no
tag_scannedevent fires. - About 5 seconds after you take the phone away, Phone Present turns off. With Card Emulation on, it can stay on a little longer while the phone finishes reading.
Tags with fixed UIDs, like NTAG stickers and key fobs, show a green flash and a higher beep instead. See Supported tags for which tags the NFC-1 reads.
Some cards act like phones
Some contactless bank cards and other cards that use random UIDs also show a UID that starts with 08-. The NFC-1 treats them the same way as a phone.
Check that your phone is detected¶
Test a tap before you build anything, so you know the NFC-1 sees your phone.
1. Open your NFC-1 in Home Assistant: go to Settings → Devices & services → ESPHome and select it.
2. Unlock your phone, make sure NFC is turned on, and hold the back of the phone flat against the NFC-1.
On Android, NFC is under Settings → Connected devices (or search Settings for NFC). iPhones have NFC on all the time.
3. Watch for one purple flash and one low beep. (If Card Emulation is on, there's no purple flash. Go by Phone Present instead.)
4. Check that Phone Present under Sensors reads On.
5. Take the phone away. Phone Present turns off about 5 seconds later.
If you see the purple flash and Phone Present turns on, your NFC-1 is detecting phones.
Run an automation when a phone is tapped¶
Use Phone Present or the phone_detected event as a trigger. Both happen once per visit, so the automation doesn't repeat while the phone stays on the reader. A visit ends about 5 seconds after you take the phone away. If you tap again before then, it counts as the same visit and the automation doesn't run again.
Because every phone shows a different random UID, the NFC-1 can't tell which phone was tapped. Use a phone tap for things anyone may trigger, like a doorbell chime or a welcome light. For actions tied to one person, give them an NFC tag instead. See Scan tags.
1. Go to Settings → Automations & scenes and click Create automation, then Create new automation.
2. Click the three dots in the top right and pick Edit in YAML (the text view of the automation).
3. Paste one of the examples below. Phone Present is the simplest. Use phone_detected event if you already trigger other automations from NFC Event.
4. Replace xxxxxx with the end of your device's name. In your NFC-1's entity IDs, the device name is the apollo_nfc_1_xxxxxx part. To find it, select Phone Present or NFC Event on the device page, open its settings (the cog icon), and copy the Entity ID.
5. Change the action to what you want to happen, then click Save.
alias: Phone tapped on NFC-1
triggers:
- trigger: state
entity_id: event.apollo_nfc_1_xxxxxx_nfc_event
conditions:
- condition: state
entity_id: event.apollo_nfc_1_xxxxxx_nfc_event
attribute: event_type
state: phone_detected
actions:
- action: light.turn_on
target:
entity_id: light.hallway
Tap your phone on the NFC-1. The light turns on.
Make it your own
- Do something when the phone leaves: add a second automation that triggers when Phone Present changes to
"off". - Quiet the cue: under Configuration, turn off Buzzer for a silent tap, or LED Feedback to skip the flash.
Phones can't be written¶
A phone isn't a tag, so the NFC-1 won't write, clean, or format it.
- If a phone is on the reader when you press Write URL Tag, Write New HA Tag, Clean Tag, or Format Tag, the task is refused. Last Operation reads Write refused: remove the phone and present an NFC tag, Clean refused: remove the phone and present an NFC tag, or Format refused: remove the phone and present an NFC tag, the LED flashes red three times, and Mode goes back to Read.
- If you arm a write (press Write URL Tag or another task button so the NFC-1 waits for a tag) and then tap a phone, Last Operation ends on Write failed: a phone is not a writable tag. A clean or format ends on Clean failed: a phone is not a writable tag or Format failed: a phone is not a writable tag.
Take the phone away, arm the task again, and hold an NFC tag on the reader. See Write tags and Clean and format tags.
Have phones open a link¶
To have a phone open a web page or the Home Assistant app when it taps the NFC-1, turn on card emulation. The NFC-1 then acts as a tag that phones can read, and a phone read shows a light-blue flash and two beeps in place of the purple flash. The card emulation guide walks you through it.
Troubleshooting¶
| What you see | What to do |
|---|---|
| No purple flash when a phone is tapped | Check that NFC is on in the phone's settings and hold the back of the phone flat on the NFC-1. If Card Emulation is on, the purple flash is skipped, but Phone Present still turns on as long as Tag Polling is on. |
| The flash shows, but there's no beep | Turn on Buzzer under Configuration and raise Volume. |
| The beep plays, but there's no flash | Turn on LED Feedback under Configuration and raise Feedback Brightness. |
| Phone Present never turns on | Check that Tag Polling under Configuration is on. When it's off, the NFC-1 doesn't read tags or phones. Tag Polling is disabled by default. Under Configuration, select the +1 entity not shown line, enable Tag Polling, then turn it on. |
| The phone doesn't show up in Settings → Tags | This is expected. Phones show a new UID every time, so they're never added. Use an NFC tag for tag automations. |
| A contactless bank card shows the purple flash | This is expected. Some cards use random 08- UIDs, and the NFC-1 treats them like a phone. |
| Write refused: remove the phone and present an NFC tag | Take the phone off the reader, wait for Phone Present to turn off, then arm the task again. |
| Write failed: a phone is not a writable tag | A phone was tapped while a write was armed. Arm the write again and hold an NFC tag on the reader. |
Next step: have phones open a link
Your NFC-1 now recognizes phones. Next, turn on card emulation so a phone tap opens a web page or the Home Assistant app.