105 lines
1.9 KiB
Markdown
105 lines
1.9 KiB
Markdown
# Paramod
|
|
|
|
Rust-Webserver zur Anzeige und Bearbeitung von Modbus-Tabellen mit Persistierung in `paramod.yaml`.
|
|
|
|
## Funktionen
|
|
|
|
- Tabellen für `modbus_input_register`, `modbus_holding_register` und `modbus_coils`
|
|
- Web-UI zum Bearbeiten und Speichern der Tabellen
|
|
- Einstellungsseite für `default`, `modbus`, `mqtt` und `influxdb`
|
|
- MQTT/Influx-Integration gemäß Konfiguration
|
|
- Speicherung aller Änderungen in `paramod.yaml`
|
|
|
|
## Lokale Entwicklung
|
|
|
|
### Voraussetzungen
|
|
|
|
- Rust + Cargo
|
|
|
|
### Start
|
|
|
|
```bash
|
|
cargo run
|
|
```
|
|
|
|
Server: `http://localhost:8080`
|
|
|
|
## Docker (Podman)
|
|
|
|
### Image bauen
|
|
|
|
```bash
|
|
podman build -t paramod:latest .
|
|
```
|
|
|
|
### Container starten
|
|
|
|
```bash
|
|
podman run --rm -p 8080:8080 -v "$(pwd)/paramod.yaml:/app/paramod.yaml" paramod:latest
|
|
```
|
|
|
|
## API Endpoints
|
|
|
|
- `GET /`
|
|
- `GET /table/modbus_input_register`
|
|
- `GET /table/modbus_holding_register`
|
|
- `GET /table/modbus_coils`
|
|
- `GET /settings`
|
|
- `GET /api/config`
|
|
- `POST /api/save`
|
|
- `POST /api/save-settings`
|
|
|
|
## API-Beispiel: Tabelle speichern
|
|
|
|
Beispiel für Holding-Register:
|
|
|
|
```bash
|
|
curl -X POST http://localhost:8080/api/save \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"table_id": "modbus_holding_register",
|
|
"rows": [
|
|
{
|
|
"TVsoll": {
|
|
"addr": 2,
|
|
"type": "INT16",
|
|
"factor": 0.1,
|
|
"write": true,
|
|
"mqtt": true,
|
|
"influxdb": true,
|
|
"comment": "Vorlauf Soll"
|
|
}
|
|
}
|
|
]
|
|
}'
|
|
```
|
|
|
|
Beispiel für Coils:
|
|
|
|
```bash
|
|
curl -X POST http://localhost:8080/api/save \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"table_id": "modbus_coils",
|
|
"rows": [
|
|
{
|
|
"MgtSystem": {
|
|
"addr": 0,
|
|
"write": true,
|
|
"mqtt": true,
|
|
"influxdb": false,
|
|
"comment": "Leitsystem aktiv"
|
|
}
|
|
}
|
|
]
|
|
}'
|
|
```
|
|
|
|
## Konfiguration
|
|
|
|
Die komplette Konfiguration liegt in `paramod.yaml`.
|
|
|
|
## Lizenz
|
|
|
|
MIT
|