# Teltonika RutOS (RUT956 / RUT241 / TRB) without the agent

RutOS cannot run the Python agent, but its built in **Data to Server** feature can post Modbus,
I/O and GPS readings straight into Prime RMS Core using the same ingest endpoint the agent uses.
This is the recommended path for the Africell pilot gateway (Karim's record, section 7).

## 1. Enroll the gateway once

Create an enrollment code in the console (Integrations, Gateways, New code) and exchange it for a
token from any machine:

```sh
curl -s -X POST https://rms.primerp.ai/api/v1/gateways/enroll \
  -H 'content-type: application/json' \
  -d '{"code":"KIN-001-AB12CD","name":"KIN-001-RUT956","platform":{"model":"RUT956","firmware":"RUTOS 7.x"}}'
```

Keep the returned `token`. It is the only secret the router needs.

## 2. Modbus master on the router

Services, Modbus, Modbus TCP master or Modbus serial master: add the slaves (DSE7420 on the
RS-485 bus, the DIN rail meter, the ADAM-4055 module) and their registers. Give every request a
clear name; those names become the point keys below.

## 3. Data to Server collection

Services, Data to Server, Add:

- Data source: **Modbus** (add a second collection for **I/O** if the router's own inputs are used).
- Protocol: **HTTP(S)**, URL `https://rms.primerp.ai/api/v1/gateway/telemetry`, method POST.
- Header: `Authorization: Bearer <token>` and `Content-Type: application/json`.
- Period: 60 s for telemetry collections, 5 s for the digital input collection.
- Format: **Custom**, with this JSON template. `%name%`, `%data%` and `%date_unix%` are RutOS
  placeholders; the segment repeats for every register in the collection:

```json
{"samples":[
  {"key":"%name%","value":%data%,"ts":%date_unix%}
]}
```

Name the Modbus requests exactly like the Prime point keys (`grid.v_l1`, `gen.oil_bar`,
`fuel.level_pct`, `env.door`). Core creates unknown points on first sight; units, domains,
thresholds and control flags are then set in the console (Sites, Points).

- Enable **Store on failure** (the RutOS buffer, up to the router's storage) so an uplink outage
  does not lose data. Pair it with a dual SIM failover profile for the out of band requirement.

## 4. Heartbeat

Add a small second Data to Server collection every 300 s with the **Base** data source and URL
`https://rms.primerp.ai/api/v1/gateway/heartbeat`, template
`{"agentVersion":"rutos","uplinkOk":true,"platform":{"model":"%device_model%","fw":"%fw_version%"}}`.
Core marks the gateway offline and raises a critical alarm when no data or heartbeat arrives for
15 minutes.

## 5. Remote control

RutOS has no command pull, so control goes through **Modbus TCP slave** on the router (Services,
Modbus, Modbus TCP slave) reached over the site VPN, or through the router's own outputs via its
REST API. Until the Prime edge container for RutOS ships (roadmap `sdk.rutos_control`), commands
issued in the console for a RutOS gateway stay queued and expire with a clear audit entry.
