﻿# ChirpStack device profile checklist (Harvestree HVT5)

## Before you start

1. Set the **LoRaWAN region** on the device with Harvestree Toolbox (USB). Factory delivery defaults to **EU868** or the regional SKU; on **US915** / **AU915** the factory channel plan is **hybrid sub-band 1**.
2. Create a **separate device profile per region** (and per US915/AU915 channel plan when you use non-default codes) on ChirpStack — do not reuse one region’s settings for another.

## Device profile (per region)

| Setting | Value |
|---------|-------|
| LoRaWAN MAC version | 1.0.3 |
| Regional parameters revision | RP002-1.0.3 |
| Regional band | Match Toolbox: **EU868** · **IN865** · **US915** · **AU915** · **AS923-1** |
| Device class | A |
| OTAA | Enabled |

### US915 / AU915 — match the device channel plan

Channel plan is selected with **PARAM_LORA_REGION** (Toolbox → Network). Gateway and LNS must use the **same** plan as the device:

| Device region code | Channel plan | 125 kHz | 500 kHz |
|--------------------|--------------|---------|---------|
| `US915 = 8` / `AU915 = 1` | Hybrid **sub-band 1** (**factory default**) | **0 – 7** | **64** |
| `9` / `17` | Standard full plan | **0 – 63** | **64 – 71** |
| `10..16` / `18..24` | Hybrid **sub-band 2..8** | eight consecutive channels of that sub-band | `64 + (sb − 1)` |

On ChirpStack:

- Gateway profile / gateway must include the channels of the **selected** plan.
- Mismatch (e.g. device on sub-band 3, gateway on sub-band 1) → the device will not be heard.

### AS923

- Use **AS923-1** (not AS923-2/3/4) unless you have a specific firmware/build that targets another AS923 group.

### IN865

- Use a standard **IN865** gateway / LNS profile (865–867 MHz).

## Codec (JavaScript)

1. Download [`harvestree_decoder.js`](../../docs/decoder/harvestree_decoder.js) from the Harvestree documentation portal and paste it into the ChirpStack codec editor.
2. ChirpStack v4 uses `decodeUplink(input)` — already present in the file.
3. Assign codec at **device profile** level.

## Device registration

| Field | Source |
|-------|--------|
| DevEUI | Device label |
| JoinEUI | Toolbox / factory provisioning |
| AppKey | Toolbox / factory provisioning |
| Device profile | Region-matched (and channel-plan-matched) profile from above |

Recommended tags: `site`, `line`, `asset_id`.

## Verify

1. Join event in device detail (OTAA)
2. Live frames → FPort 1 → decoded JSON (`serial_number`, `status`)
3. Optional: downlink `GET_VERSION` on FPort 4 — see [LoRaWAN remote configuration](../../docs/lorawan-remote-configuration.html)

## MQTT integration

Enable **application integration → MQTT**. Subscribe:

```
application/+/device/+/event/up
```

Example: `examples/python/mqtt_ingest.py` or `examples/node/mqtt_ingest.js`.

## HTTP integration

Enable **application integration → HTTP** and set the endpoint URL, for example:

```
http://your-ingest-host:8080/webhook/chirpstack/up
```

ChirpStack sends a `POST` with the same JSON body as the MQTT uplink event. Example: `examples/python/http_webhook.py` or `examples/node/http_webhook.js`.

See [examples/README.md](../README.md) for choosing MQTT vs HTTP and Python vs Node.js.
