NFC with Home Assistant
Home Assistant's NFC integration enables physical-world triggers for smart home automations — tap a tag by the door to arm the alarm, or tap a tag on the nightstand to run a bedtime scene. This guide covers setup via the Home Assistant mobile app, automations, and advanced integrations.
The NFC tags used are standard nfc-tag inlays — typically nfc-a (ISO 14443ISO 14443Standard for contactless smart cards at 13.56 MHz (Types A and B)View full →-A) chips such as NTAG213/215. The tag stores either a plain ndef-uri record that the HA app recognises, or a Home Assistant-specific ndef deep-link URL. The uid is used as the persistent identifier in HA's tag registry.
Integration Architecture
NFC Tag → Phone (HA Mobile App) → Home Assistant Core → Automation → Devices
The Home Assistant mobile app (Android and iOS) handles NFC scanning. When a tag is scanned, it fires a tag_scanned event in Home Assistant with the tag's ID and device name. Automations listen for this event to trigger actions.
Step 1: Register an NFC Tag
- Open Home Assistant mobile app → ⋮ Menu → NFC Tags
- Tap + → Add Tag
- Hold phone near an NFC tagNFC tagPassive unpowered device storing data, powered by reader's RF fieldView full → to register its UID
- Name the tag (e.g., "Front Door", "Nightstand")
- HA registers the tag and stores its UID
Alternatively, tap an unregistered tag — HA mobile app prompts to register it automatically on first scan.
Step 2: Trigger an Automation from a Tag
In Home Assistant, create an automation with the tag scan as trigger:
# configuration.yaml or via UI
automation:
- alias: "Bedtime Routine — Nightstand Tag"
trigger:
platform: tag
tag_id: "abc12345-de67-89fg-hijk-lmnopqrstuvw"
action:
- service: scene.turn_on
target:
entity_id: scene.bedtime
- service: alarm_control_panel.alarm_arm_away
target:
entity_id: alarm_control_panel.home
Finding your tag ID: After scanning in the HA app, the tag ID appears in Developer Tools → Events — look for tag_scanned events and note the tag_id value.
Step 3: Device-Specific Automations
The tag_scanned event includes the device that scanned the tag, enabling per-person automations:
automation:
- alias: "Kitchen Tag — John's Phone"
trigger:
platform: tag
tag_id: "kitchen-tag-uid-here"
condition:
condition: template
value_template: "{{ trigger.device_id == 'johns_phone_device_id' }}"
action:
- service: scene.turn_on
target:
entity_id: scene.johns_kitchen_preference
This allows the same physical tag to trigger different scenes for different family members.
Common NFC Automation Recipes
| Tag Location | Automation | Services Called |
|---|---|---|
| Front door inside | Away mode | alarm_control_panel.arm_away, light.turn_off all, lock.lock |
| Front door outside | Arrive home | alarm_control_panel.disarm, light.turn_on entry, media_player.play |
| Nightstand | Bedtime | scene.bedtime, media_player.turn_off all, climate.set_temperature |
| Kitchen | Morning routine | light.turn_on kitchen bright, media_player.play news |
| TV area | Movie mode | scene.movie, media_player.play_media Plex |
| Medicine cabinet | Log medication | input_datetime.set_datetime to now, notify phone |
Write Tag Action (Mobile App → Tag)
HA mobile app can write to NFC tags — useful for encodingencodingData writing to NFC tags during manufacturing productionView full → the HA-specific deep link URL:
- HA app → NFC Tags → select a registered tag → Write Tag
- The app writes an NDEF URI recordURI recordNDEF record encoding URIs with compact prefix compressionView full →:
https://www.home-assistant.io/tag/{tag_id} - When any HA app user scans this tag, it fires the
tag_scannedevent automatically
This URL is recognised by the HA app on any phone — even devices that haven't pre-registered the tag. It does not work in a browser (it requires the HA app).
Advanced: NFC Tag Presence Detection
For room presence detection, place tags at strategic locations and build a input_select or device_tracker that updates when tags are scanned:
input_select:
family_location:
name: "Family Location"
options:
- Kitchen
- Living Room
- Bedroom
- Away
automation:
- alias: "Update location — Kitchen tag"
trigger:
platform: tag
tag_id: "kitchen-tag-id"
action:
service: input_select.select_option
target:
entity_id: input_select.family_location
data:
option: Kitchen
Integrating with Tasker and Shortcuts
If you prefer a more powerful automation app on the phone side, use Tasker (Android) or Shortcuts (iOS) to call the HA REST API directly instead of using the HA mobile app NFC integration:
Tasker NFC trigger → HTTP POST to HA REST API
POST https://homeassistant.local:8123/api/events/tag_scanned
Headers: Authorization: Bearer {token}
Body: {"tag_id": "my-tag-id"}
This fires the same tag_scanned event as the HA mobile app, keeping all automation logic in HA while using Tasker for advanced mobile-side logic.
See NFC Tasker for Android and NFC Apple Shortcuts for device-side automation guides.
Troubleshooting
| Issue | Cause | Fix |
|---|---|---|
| Tag scan not triggering automation | Tag not registered in HA | Check NFC Tags list; register tag |
| Automation fires but nothing happens | Service call error | Check HA logs; verify entity IDs |
| iOS scan not detected | Background reading not active | Open HA app first; iOS 14+ required |
| Multiple automations fire | Same tag ID in multiple triggers | Use device condition to filter |
| Tag ID changes | Tag replaced with different UID | Re-register new tag; update automation |