Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added docs/assets/nfc-1-case.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/nfc-1-hero.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
179 changes: 179 additions & 0 deletions docs/products/nfc1/examples/read-and-write-tags.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
---
title: Read and write tags with the NFC-1
description: Run Home Assistant automations from NFC tag scans, write URLs, text, and Home Assistant tags, clean and format tags, and use card emulation on the Apollo NFC-1.
---
# Read and write tags with the NFC-1

<span class="difficulty lvl-1">Difficulty: Level 1</span>

Your NFC-1 does more than read tags. This guide covers running automations from a scan, writing your own tags from Home Assistant, reusing old tags, and letting phones tap the NFC-1 itself.

!!! note "Before you start"

Add your NFC-1 to Home Assistant first. The [getting started guide](../setup/getting-started.md) walks you through it.

## Run an automation from a tag

Every tag you scan is reported to Home Assistant and listed under **Settings → Tags**. A tag that holds a Home Assistant tag is listed by that tag's ID, and any other tag by its UID.

[![Open your Home Assistant instance and show your tags.](https://my.home-assistant.io/badges/tags.svg)](https://my.home-assistant.io/redirect/tags/)

1\. Scan the tag on your NFC-1.

2\. Go to **Settings → Tags** in Home Assistant and click the tag at the top of the list. Give it a name you'll recognize, such as **Front door**.

3\. Click **Create automation** in the tag's dialog. Home Assistant starts a new automation with a **Tag** trigger for that tag.

4\. Add the actions you want, such as arming the alarm or starting a scene, then click **Save**.

The automation now runs every time that tag is scanned. In YAML, the trigger looks like this:

```yaml
triggers:
- trigger: tag
tag_id: your-tag-id
```

!!! tip "Phones show up as a different tag each time"

A phone held to the NFC-1 can show up as a tag with a random UID that starts with `08-`. Because that UID changes every time, the NFC-1 doesn't report it to **Settings → Tags**. Use a real tag or card for automations.

You can also trigger on the **NFC Event** entity, for example on `tag_scanned` or `tag_removed`, and read **Last Tag**, **Last Tag UID**, or **Last Tag Content** in your automation.

## Write a tag

The NFC-1 writes a tag in three steps: you arm the write, hold a tag on the reader, and the NFC-1 reads the tag back to check it. While a write is armed, the LED pulses blue. You have 30 seconds to present a tag, which you can change with **Mode Timeout**.

!!! warning "Keep the tag on the reader until it's checked"

After writing, the NFC-1 reads the tag again to make sure the data matches. If you lift the tag too soon, **Last Operation** reads **Write unverified (tag removed)**. Hold the tag in place until you hear the three-note chime and **Last Operation** reads **Write verified**.

### Write a Home Assistant tag

A Home Assistant tag holds a URL with a random tag ID. Phones with the Home Assistant app report it to Home Assistant when you tap them on the tag, and the NFC-1 reports it too.

1\. On the NFC-1's device page, press **Write New HA Tag**.

2\. Hold a tag flat against the NFC-1.

3\. Wait for two green flashes and the three-note chime, then check that **Last Operation** reads **Write verified**.

The new tag shows up under **Settings → Tags** right away, ready for an automation.

With **HA App Record** on (the default), the tag also tells Android phones to open the Home Assistant app when tapped.

### Write a URL

1\. Under **Configuration**, type the URL into **Write URL**. It can be up to 120 characters, which fits on an NTAG213 tag.

2\. Press **Write URL Tag**, or set **Mode** to **Write**.

3\. Hold a tag flat against the NFC-1 until **Last Operation** reads **Write verified**.

### Write text

Text tags are written with the `write_text` action. See [Use actions in automations](#use-actions-in-automations).

## Clean or format a tag

Clean a tag to remove its data so you can write it again. Press **Clean Tag**, or set **Mode** to **Clean**, then hold the tag on the reader. The LED pulses orange while a clean is armed.

**Format Tag** works the same way, and the LED pulses magenta while it's armed. On NTAG and MIFARE Ultralight tags, format does the same as clean.

Like a write, the NFC-1 reads the tag back afterward. **Last Operation** reads **Clean done (no readable data)** or **Format done (no readable data)** once it's checked.

To stop an armed write, clean, or format, press **Cancel Tag Operation** or set **Mode** back to **Read**.

## Check the result

**Last Operation** on the device page tells you how the last task went:

| Last Operation | What it means |
| --- | --- |
| **Waiting for tag** | A write, clean, or format is armed. Hold a tag on the reader. |
| **Write done, verifying**, **Clean done, verifying**, **Format done, verifying** | The task ran. Keep the tag on the reader while the NFC-1 checks it. |
| **Write verified** | The NFC-1 read the tag back and the data matches. |
| **Write mismatch** | The tag was read back, but the data doesn't match. Try writing it again. |
| **Write failed (tag not formatted or unsupported)** | The write didn't go through. Clean or format the tag, or try another tag. |
| **Write refused: nothing to write** | There was nothing to write, for example **Write URL** is empty. Fill it in and try again. |
| **Write refused: no message set** | The NFC-1 couldn't arm the write. Try again. |
| **Clean done (no readable data)**, **Format done (no readable data)** | The tag is empty and ready to reuse. |
| **Clean failed (data remains)**, **Format failed (data remains)** | Data is still on the tag. Try again. |
| **Write unverified (tag removed)**, **Clean unverified (tag removed)**, **Format unverified (tag removed)** | The tag was lifted before the NFC-1 could check it. Scan it to see what's on it. |
| **Write unverified (cancelled)**, **Clean unverified (cancelled)**, **Format unverified (cancelled)** | The task was cancelled before the NFC-1 could check the tag. Scan it to see what's on it. |
| **Timed out** | No tag was presented before **Mode Timeout** ran out. |
| **Cancelled** | The task was cancelled. |
| **Emulation off: Emulation URL is empty** | **Card Emulation** was turned on without an **Emulation URL**. |

## Card emulation

With card emulation on, the NFC-1 acts as a tag. A phone tapped on it opens the link you set, with no app needed, which makes it handy for a guest page or a menu.

1\. Under **Configuration**, type the link into **Emulation URL**. It can be up to 120 characters.

2\. Turn on **Card Emulation**.

3\. Tap a phone on the NFC-1. The LED flashes cyan, the buzzer beeps twice, and **NFC Event** fires `emulated_tag_scanned`.

If the **Emulation URL** is a Home Assistant tag URL and **HA App Record** is on, Android phones open the Home Assistant app when they tap. To change the link later, edit **Emulation URL**. The NFC-1 picks it up while emulation stays on.

## Use actions in automations

The NFC-1 adds these actions to Home Assistant, so automations and scripts can write tags and set the emulated link. Each one is named after your device, for example `esphome.apollo_nfc_1_xxxxxx_write_url`, where `xxxxxx` is the end of your NFC-1's MAC address. Find yours under **Settings → Tools → Actions** by typing `nfc`.

[![Open your Home Assistant instance and show your action tools.](https://my.home-assistant.io/badges/tools_actions.svg)](https://my.home-assistant.io/redirect/tools_actions/)

| Action | Field | What it does |
| --- | --- | --- |
| `write_url` | `url` | Arms a write of a URL to the next tag. |
| `write_text` | `text_str` | Arms a write of a line of text to the next tag. |
| `write_ha_tag` | `tag_id` | Arms a write of a Home Assistant tag. Leave `tag_id` empty for a new random ID, or give an existing tag ID to make a second tag that runs the same automations. |
| `clean_tag` | none | Arms a clean of the next tag. |
| `format_tag` | none | Arms a format of the next tag. |
| `cancel_tag_operation` | none | Cancels an armed task. |
| `set_emulation_url` | `url` | Sets the **Emulation URL**. |
| `play_buzzer` | `song_str` | Plays an RTTTL tune on the buzzer. See [Piezo buzzer](../../general/piezo.md) for tunes to try. |

For example, this action arms a write of a URL to the next tag:

```yaml
action: esphome.apollo_nfc_1_xxxxxx_write_url
data:
url: "https://wiki.apolloautomation.com"
```

## What the LED and buzzer mean

| LED | Buzzer | What happened |
| --- | --- | --- |
| One green flash | One beep | A tag was scanned. |
| One cyan flash | Two beeps | A phone read the emulated tag. |
| Pulsing blue | Two rising notes | A write is armed and waiting for a tag. |
| Pulsing orange | Two rising notes | A clean is armed and waiting for a tag. |
| Pulsing magenta | Two rising notes | A format is armed and waiting for a tag. |
| Two green flashes | Three rising notes | The write, clean, or format ran. Keep the tag on the reader while it's checked. |
| Three red flashes | Two falling notes | The task failed or the check didn't match. |
| Two orange flashes | Two beeps | The armed task timed out. |
| Pulse stops | Two falling notes | The armed task was cancelled. |

Turn the sounds off with **Buzzer** or lower them with **Volume**. Turn the flashes off with **LED Feedback** or dim them with **Feedback Brightness**.

## NFC Event types

The **NFC Event** entity fires one of these event types. Use them as triggers in automations.

| Event type | When it fires |
| --- | --- |
| `tag_scanned` | A tag was scanned in **Read** mode. |
| `tag_removed` | The scanned tag was taken off the reader. |
| `emulated_tag_scanned` | A phone read the emulated tag. |
| `armed` | A write, clean, or format was armed. |
| `written`, `cleaned`, `formatted` | The task ran, and the NFC-1 is about to check the tag. |
| `write_verified`, `clean_verified`, `format_verified` | The check passed. |
| `write_mismatch`, `clean_failed`, `format_failed` | The check found the wrong data on the tag. |
| `write_failed` | The write didn't go through, or there was nothing to write. |
| `unverified` | The tag was removed, or the task cancelled, before the check. |
| `timed_out` | No tag was presented before **Mode Timeout** ran out. |
| `cancelled` | The armed task was cancelled. |

[Join our Discord if you need more help! :simple-discord:](https://link.apolloautomation.com/discord){ .md-button }
45 changes: 45 additions & 0 deletions docs/products/nfc1/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
title: NFC-1 introduction
description: Meet the Apollo NFC-1, an ESPHome NFC reader, writer, and emulator for Home Assistant built on the NXP PN7160 and an ESP32-C6.
---
# NFC-1 introduction

![The Apollo NFC-1 with its white case open on a wooden table, showing the green circuit board with the Apollo logo and NFC-1 REV-1 printed on it](/assets/nfc-1-hero.jpg)

The Apollo NFC-1 is an NFC reader, writer, and emulator that runs ESPHome and connects to Home Assistant. Tap a tag or card on it and Home Assistant gets a tag scan, ready to run an automation.

**Scan tags into Home Assistant:** Every tag you tap shows up under **Settings → Tags** in Home Assistant, and its UID and content land on the NFC-1's device page. Use a tag by the door, the bed, or your desk to arm the alarm, start a bedtime scene, or switch on work mode.

**Write, clean, and format tags:** Write a URL, a line of text, or a brand-new Home Assistant tag from your dashboard, with no phone app needed. After every write, the NFC-1 reads the tag back to check it. Clean or format a tag to reuse it.

**Card emulation:** Turn on **Card Emulation** and the NFC-1 acts as a tag itself. Visitors tap their phone on it to open a link, such as your guest page or a menu. On Android, it can open the Home Assistant app.

**Feedback you can see and hear:** An RGB LED and a buzzer confirm every scan, write, and error. Adjust the brightness and volume, or turn either one off.

**Bluetooth proxy:** Place the NFC-1 where Bluetooth is weak and switch on its Bluetooth proxy to relay nearby BLE sensors and devices to Home Assistant.

**Updates over the air:** Update the firmware from Home Assistant, on the Stable or Beta channel.

## What's in the box

- NFC-1

![The Apollo NFC-1 in its closed white case on a wooden table](/assets/nfc-1-case.jpg)

## Product details

| Spec | Detail |
| --- | --- |
| **NFC controller** | NXP PN7160 |
| **Microcontroller** | ESP32-C6 with 8MB flash |
| **Connectivity** | Wi-Fi and Bluetooth LE (Zigbee and Thread capable at chip level) |
| **Tag modes** | Read, Write, Clean, Format |
| **Write types** | URLs (up to 120 characters), text, and Home Assistant tags, with an automatic check after each write |
| **Card emulation** | Acts as a tag for phones to tap, with an optional Home Assistant app launch on Android |
| **Supported tags** | NTAG / MIFARE Ultralight and MIFARE Classic |
| **Feedback** | RGB LED and buzzer, with adjustable brightness and volume |
| **Setup** | Improv over Bluetooth or USB serial, plus a Wi-Fi fallback hotspot |
| **Firmware** | Open source ESPHome. Custom builds need ESPHome 2026.8 or newer. Source on [GitHub](https://github.com/ApolloAutomation/NFC-1). |

[Get started with your NFC-1 :material-arrow-right:](setup/getting-started.md){ .md-button .md-button--primary }
[Join our Discord if you need more help! :simple-discord:](https://link.apolloautomation.com/discord){ .md-button }
112 changes: 112 additions & 0 deletions docs/products/nfc1/setup/getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
---
title: NFC-1 getting started
description: Step by step guide to getting your Apollo NFC-1 on Wi-Fi, adding it to Home Assistant, and scanning your first tag.
---
# NFC-1 getting started

This guide takes your Apollo NFC-1 from the box to a working tag reader in Home Assistant: you'll get it on your Wi-Fi, add it through the ESPHome integration, and scan your first tag.

## Connect to your network

There are three ways to get your NFC-1 on Wi-Fi. Pick whichever suits you, you only need to do one.

- **Improv via BLE** sets the NFC-1 up over Bluetooth straight from Home Assistant. It needs Bluetooth on your Home Assistant host or an ESP32 Bluetooth proxy.
- **USB** uses the Apollo installer in your browser. It also installs the latest firmware, so it's the way to go if you want to reflash the NFC-1.
- **Hotspot** works on any phone or computer. The NFC-1 broadcasts its own Wi-Fi network, you join it, then enter your Wi-Fi details.

=== "Improv via BLE"

!!! note "Pre-requirement: Bluetooth proxy or Bluetooth Home Assistant hardware required"

Bluetooth built in, such as on a Raspberry Pi, or at least one [ESP32 Bluetooth proxy](../../general/setup/bluetooth-proxy.md) is required to set up your NFC-1 this way.

1\. Plug in your NFC-1 and keep it within Bluetooth range of your Home Assistant host or proxy.

2\. Open your integrations page in Home Assistant (**Settings → Devices & services**).

[![Open your Home Assistant instance and show your integrations.](https://my.home-assistant.io/badges/integrations.svg)](https://my.home-assistant.io/redirect/integrations/)

3\. Click **Add** on the discovered NFC-1, type in your Wi-Fi SSID and password, then click **Submit**. The NFC-1 doesn't ask you to press a button to approve the setup.

4\. Click **Submit** again, give it an **Area**, then click **Finish**.

Improv adds your NFC-1 to Home Assistant as part of setup, so skip ahead to [scan your first tag](#scan-your-first-tag).

=== "USB"

!!! note "Use Chrome, Edge, or a recent version of Firefox on a computer"

The installer needs a browser that can talk to the USB serial port, and a USB cable that carries data, not only power.

1\. Plug the NFC-1 into your computer with a USB data cable.

2\. Open the [Apollo installer for the NFC-1](https://install.apolloautomation.com/#/nfc-1) and click **Connect & Install**.

3\. Pick the NFC-1's serial port in the browser popup and click **Connect**. (1)
{ .annotate }

1. If no port appears, try a different USB cable. Many cables only carry power.

4\. If the installer shows a menu, click **Install ApolloAutomation.NFC-1** (it reads **Update ApolloAutomation.NFC-1** if the NFC-1 already runs Apollo's firmware). Click **Install** to confirm.

5\. When you see **Installation complete!**, click **Next**. If the installer shows its menu again, click **Connect to Wi-Fi**. Under **Configure Wi-Fi**, pick your **Network**, type the **Password**, and click **Connect**.

6\. Once you see **Device connected to the network!**, click **Add to Home Assistant** or carry on with [Add to Home Assistant](#add-to-home-assistant) below.

=== "Hotspot"

1\. Plug in your NFC-1.

2\. On your phone or computer, open the Wi-Fi settings and connect to **Apollo NFC1 Hotspot**.

!!! tip "Setup page didn't open?"

Your phone should open the Wi-Fi setup page on its own after you join the hotspot. If it doesn't, go to [http://192.168.4.1](http://192.168.4.1).

3\. Select the Wi-Fi network you want your NFC-1 to join, type in your Wi-Fi password, then click **Save**.

4\. Once the NFC-1 joins your Wi-Fi, its hotspot goes away and your phone switches back to your own network. Your NFC-1 is now on your Wi-Fi.

## Add to Home Assistant

Once the NFC-1 is on your Wi-Fi, Home Assistant discovers it through the ESPHome integration. This is where it becomes a real, working device on your dashboard.

1\. Open the ESPHome integration in Home Assistant (**Settings → Devices & services → ESPHome**).

[![Open your Home Assistant instance and show an integration.](https://my.home-assistant.io/badges/integration.svg)](https://my.home-assistant.io/redirect/integration/?domain=esphome)

2\. Find the discovered **Apollo NFC-1** and click **Add**, then **Submit**.

3\. Edit the name if you like, choose an **Area**, then click **Finish**.

Your NFC-1 now has its own device page with controls, sensors, and settings. [Sensor definitions](sensor-definitions.md) explains each one.

## Check the status light

Each time the NFC-1 starts up, its LED shows how it's connected for 5 seconds, then turns off:

| Color | What it means |
| --- | --- |
| Blue | Connected to Home Assistant |
| Green | Connected to Wi-Fi, but not to Home Assistant yet |
| Yellow | Not connected to Wi-Fi |

On its first start after a fresh install, the LED stays a soft green instead, until you scan your first tag. If it lights red, the NFC reader didn't start. Reach out on [Discord](https://link.apolloautomation.com/discord) or at support@apolloautomation.com so we can help.

## Scan your first tag

1\. Hold an NFC tag or card flat against the NFC-1. NTAG, MIFARE Ultralight, and MIFARE Classic tags all work.

2\. The LED flashes green and the buzzer beeps once.

3\. On the NFC-1's device page, **Last Tag UID** shows the tag's UID and **Tag Present** turns on while the tag stays on the reader.

Home Assistant also lists the tag under **Settings → Tags**, so you can name it and use it to trigger automations.

[![Open your Home Assistant instance and show your tags.](https://my.home-assistant.io/badges/tags.svg)](https://my.home-assistant.io/redirect/tags/)

!!! success "Next step: read and write tags"

Your NFC-1 is reading tags. Next, run an automation from a tap, write your own tags, and turn on card emulation.

[Read and write tags](../examples/read-and-write-tags.md){ .md-button .md-button--primary }
Loading
Loading