Files
rtu_v5/.planning/codebase/INTEGRATIONS.md
2026-03-12 00:56:57 +08:00

190 lines
3.9 KiB
Markdown

# External Integrations
**Analysis Date:** 2026-03-12
## Project Status
This is a **greenfield project** - no implementation code exists yet. The following analysis is based on the requirements defined in `THE_IDEA.md`.
---
## Hardware Interfaces
### Sensors
**Rainfall Sensors:**
- Rainfall-1 ID (RF) - Primary rainfall sensor (e.g., `123456RF`)
- Rainfall-2 ID - Secondary rainfall sensor
- Tip bucket counting for rainfall accumulation
**Water Level Sensors:**
- 4-20mA type sensors (Channels 1-2)
- 0-10vDC type sensors (Channels 3-4)
- SDI-12 interface for additional sensors
**Environmental Sensors:**
- Solar voltage monitoring
- Battery voltage monitoring
- Soil moisture sensors (SDI-12)
- Evapotranspiration sensors
### GPS Module
- USB GPS module for location data
- Latitude/longitude retrieval
- Manual coordinate setting as fallback
---
## Data Storage
### Local Storage
**CSV Files:**
- Data logging to local filesystem
- File naming: `SP8020_FTP.txt`, `SP8021_FTP.txt`, etc.
- Flash memory management for stored files
- File operations: Navigate, View, Delete, Save
**Data Types Logged:**
- Rainfall (today, hourly, monthly accumulated, yearly)
- Water levels
- Battery voltage
- Solar voltage
- Sensor readings (ADC channels)
---
## Network & External Services
### Data Server (myvscada)
**Server Details:**
- Remote server for receiving CSV data
- Location: Configurable IP address
- Protocol: FTP, SCP, SFTP, or WEBDAV
**Transfer Flow:**
```
RTU → CSV file → myvscada server → received folder → processed/error folder
```
### Mobile Network (GPRS)
**GPRS Module:**
- Mobile network connectivity for remote transmission
- RTU Mobile number configuration
- Referenced in "Mobile Setting" submenu (THE_IDEA.md section 1.7)
### Protocols Supported
| Protocol | Purpose | Reference |
|----------|---------|-----------|
| FTP | CSV file transfer | Primary protocol mentioned |
| SCP | Secure copy | Section 1.6 |
| SFTP | Secure FTP | Section 1.6 |
| WebDAV | Web-based file access | Section 1.6 |
| TCP Socket | Real-time data requests | Section 1.6 |
---
## Authentication & Identity
**Station Configuration:**
- Station ID (e.g., `D007`)
- Device version number (e.g., `v4.0.4`)
- Login status for remote access
**Network Credentials:**
- FTP/SCP username and password
- Referenced in THE_IDEA.md section 1.6 (Protocol Setting)
- **Note:** Credentials should be stored securely (env vars, not plain config)
---
## Alert Systems
### SMS/Call Alerts
**Contact Types:**
- Master phones (2 numbers)
- SubMaster phones (2 numbers)
- Engineer phones (up to 10 numbers)
- RTU Mobile number
**Alert Triggers:**
- Danger rainfall threshold (configurable mm per hour)
- Warning rainfall threshold
- Water level thresholds (Danger, Warning, Alert, Normal)
---
## Display Interfaces
### Local Touchscreen
- **Resolution:** 1024x600
- **Connection:** Direct video output (HDMI/CSI)
- **Browser:** Chromium Kiosk Mode
- **URL:** `http://pihostname:8080`
### Remote Web Access
- **Resolution:** Full HD (1920x1080)
- **Authentication:** Login required
- **URL:** `http://pihostname:9090/`
---
## Communication Status
**Monitoring Data:**
- Communication status display (e.g., `0ASU/-113dBm(0%)`)
- Signal strength (dBm)
- Connection percentage
---
## Environment Configuration
### Required Configuration Items
**Network:**
- Local IP Address
- Subnet Mask
- Gateway
- DNS Server
- MAC Address
- Transfer Protocol (FTP/SCP/SFTP/WEBDAV)
**Server:**
- Server IP Address
- TCP Port
- File Directory (e.g., `/myvscada/stationA`)
**Sensors:**
- ADC channel types (4-20mA, 0-10vDC)
- Sensor datum offsets
- Sensor ranges and units
---
## Data Flow Summary
```
Sensors (ADC, RF, WL)
Python Backend (data collection)
CSV File Generation
Transfer Protocol (FTP/SCP/SFTP/WebDAV)
myvscada Server
Processed/Error folder handling
```
---
*Integration audit: 2026-03-12*