How 2026dts/oil_rig works
The repository contains two Python monitoring products: a Modbus-to-ThingsBoard bridge and a local Flask dashboard, plus a standalone read-only register diagnostic. The primary workflow polls PLC registers, derives telemetry and runtime values, then publishes them or presents them locally; motor commands can return to the PLC. The HTTP application excerpt also shows database-backed readings, alerts, and dashboard/API behavior. Unsampled routes and the ESP sketch are not expanded; edges reflect only the README or shown source excerpts.
Main entry points: oil_rig.py Telemetry bridge · Oil_Rig_HTTP/oil_rig.py Flask dashboard · wind_speed.py Register diagnostic · motor_runtime_state.json Runtime state
Components 18
Rig hardware
- Rig sensors
- Delta PLC
- USR-W630
Cloud bridge
- Telemetry bridge
oil_rig.py - Register polling
oil_rig.py - Scaled telemetry
oil_rig.py - Motor runtime
oil_rig.py - Runtime state
motor_runtime_state.json - ThingsBoard
Local dashboard
- Flask dashboard
Oil_Rig_HTTP/oil_rig.py - PLC polling
Oil_Rig_HTTP/oil_rig.py - Dashboard API
Oil_Rig_HTTP/oil_rig.py - Dashboard views
Oil_Rig_HTTP/oil_rig.py - SQLite history
Oil_Rig_HTTP/oil_rig.py - Wind alerts
Oil_Rig_HTTP/oil_rig.py
Diagnostics
- Register diagnostic
wind_speed.py - Raw register log
wind_speed_diagnostic_log.csv
Other components
- Operator
Connections 18
- Rig sensors → Delta PLC: feed readings
README.md - Delta PLC → USR-W630: serial link
README.md - USR-W630 → Telemetry bridge: Modbus TCP
README.md - Telemetry bridge → Register polling: polls registers
oil_rig.py - Register polling → Scaled telemetry: scales values
oil_rig.py - Scaled telemetry → Motor runtime: updates counters
oil_rig.py - Motor runtime → Runtime state: persists state
oil_rig.py - Telemetry bridge → ThingsBoard: publishes telemetry
README.md - ThingsBoard → Telemetry bridge: sends RPC
README.md - Telemetry bridge → Delta PLC: writes motor state
README.md - USR-W630 → Flask dashboard: Modbus TCP
- Flask dashboard → PLC polling: reads PLC
Oil_Rig_HTTP/oil_rig.py - Flask dashboard → SQLite history: initializes tables
Oil_Rig_HTTP/oil_rig.py - Flask dashboard → Wind alerts: checks wind
Oil_Rig_HTTP/oil_rig.py - Operator → Dashboard views: opens dashboard
- Dashboard views → Dashboard API: requests data
Oil_Rig_HTTP/oil_rig.py - Register diagnostic → USR-W630: reads registers
wind_speed.py - Register diagnostic → Raw register log: logs readings
wind_speed.py