# [EN] Become ADS-B.Pro Feeder!

# ADS-B.Pro Feeder Setup Guide

## 1. Requirements

You will need:

- Raspberry Pi / Debian / Ubuntu with internet access.
- RTL-SDR or another ADS-B receiver.
- Working `dump1090-fa`, `dump1090-mutability`, `dump1090`, or `readsb`.
- ADS-B.Pro account.
- Your private feeder token.

The feeder token is unique per account. In the account panel it is shown as **Your Feeder Token** and has this format:

```text
ADS-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
```

That means `ADS-` plus 32 hexadecimal characters. The setup script expects lowercase `a-f`.

## 2. Where To Find Your Token

1. Log in to ADS-B.Pro.
2. Open **My Account**.
3. Copy the value from **Your Feeder Token**.
4. Do not publish this token in logs, screenshots, GitHub issues, or config examples.

The frontend displays this token from your account data. The actual feeder sends it to the backend through `/opt/radarview.py`.

## 3. Recommended Installation

Use `radarview_setup-nogit.sh`. It does not require cloning the repository and downloads the current `radarview.py` automatically.

```bash
sudo apt update
sudo apt install -y curl wget ca-certificates

curl -fsSL https://raw.githubusercontent.com/br3jski/radarview/refs/heads/main/radarview_setup-nogit.sh -o radarview_setup-nogit.sh
chmod +x radarview_setup-nogit.sh

sudo ./radarview_setup-nogit.sh
```

The script will ask for your token:

```text
Please enter your RadarView token (format: ADS-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX):
```

Paste the token from **My Account**.

## 4. What The Script Does

The script:

1. Checks that it is running as `root`.
2. Validates the user token.
3. Checks whether a local ADS-B source exists:
   - `dump1090-fa`
   - `dump1090-mutability`
   - `dump1090`
   - `readsb`
4. If no dump1090/readsb installation is found, it asks whether to install `dump1090-fa`.
5. Downloads `radarview.py` to:

```text
/opt/radarview.py
```

6. Inserts your token into:

```python
USER_TOKEN = 'ADS-...'
```

7. Creates a systemd service:

```text
/etc/systemd/system/radarview.service
```

8. Starts and enables the service:

```bash
systemctl start radarview
systemctl enable radarview
```

## 5. How Data Forwarding Works

`radarview.py` connects to your local ADS-B receiver on the SBS/BaseStation port:

```text
127.0.0.1:30003
```

Then it forwards the data to ADS-B.Pro:

```text
feed.ads-b.pro:48581
```

Before every aircraft data line, the script sends your token:

```text
TOKEN:ADS-...
```

So two things are required:

- local `dump1090` / `readsb` must expose SBS data on `127.0.0.1:30003`,
- the feeder machine must be able to make an outbound TCP connection to `feed.ads-b.pro:48581`.

## 6. Verify The Installation

Check service status:

```bash
sudo systemctl status radarview
```

Watch live logs:

```bash
sudo journalctl -u radarview -f
```

Healthy logs should look similar to:

```text
Connected to source 127.0.0.1:30003
Connected to destination feed.ads-b.pro:48581
Data sent with token
```

Check local ADS-B source:

```bash
nc -vz 127.0.0.1 30003
```

Check ADS-B.Pro connectivity:

```bash
nc -vz feed.ads-b.pro 48581
```

## 7. If You Use readsb

Make sure `readsb` exposes SBS/BaseStation output on port `30003`. The feeder script does not read JSON or Beast directly. It expects text SBS data from port `30003`.

Your `readsb` configuration should include the equivalent of:

```text
--net
--net-sbs-port 30003
```

Restart `readsb` after changing its configuration.

## 8. Changing The Token Later

If the token was pasted incorrectly or regenerated, the easiest option is to run the setup script again.

You can also edit `/opt/radarview.py` manually, update:

```python
USER_TOKEN = 'ADS-...'
```

and restart the service:

```bash
sudo systemctl restart radarview
```

## 9. Common Problems

**Invalid token format**  
The token does not match `ADS-` plus 32 hex characters. Copy it again from **My Account**.

**Error: User token not set**  
`USER_TOKEN` in `/opt/radarview.py` is empty. Run the setup again or edit the file manually.

**Socket error for `127.0.0.1:30003`**  
`dump1090` / `readsb` is not running or SBS output is not enabled on port `30003`.

**Socket error for `feed.ads-b.pro:48581`**  
Likely DNS, internet, firewall, or outbound TCP port `48581` connectivity issue.

**Account does not show Feeder status yet**  
The feeder needs to send stable data first. The frontend account status comes from the backend account data, so after approval you may need to log out and back in, or refresh your session token.