1.6 KiB
1.6 KiB
TODO - PLC Client Web Project
Objectives
- Implement a Flask web server to display PLC data.
- Replicate
plc_client.pyoutput in the web interface. - Improve S7 connection management (robust connection, clean exit).
- Use external HTML/CSS/JS files.
Tasks
1. Infrastructure & Setup
- Create
todo.md(Done) - Create folder structure:
templates/(for HTML)static/css/(for CSS)static/js/(for JS)
- Initialize Flask app in
plc_client_web.py.
2. Backend Logic (Migration from plc_client.py)
- Analyze
plc_client.pyto identify core logic (polling, parsing, S7 connection). - Refactor S7 communication into a separate class or thread-safe module.
- Implement robust connection handling (reconnect on failure, clean exit).
- Implement data polling loop that updates a shared state (e.g., a global variable or a thread-safe object).
3. Frontend & Integration
- Create
templates/index.html. - Create
static/css/style.css. - Create
static/js/script.jsto fetch data from the Flask server via AJAX/Fetch API. - Create Flask routes to serve the page and provide data as JSON.
4. Refinement
- Match
plc_client.pyoutput exactly (initial phase). - Optimize polling frequency and UI updates.
- Error handling and logging for the web version.
Next Steps
- Transition from hardcoded DB names (DB900, DB901, etc.) to a configurable array of memory objects.
- Implement a persistent data logging system to save sessions to JSON/Database.
- Add advanced chart types (e.g. Histograms, multi-axis charts).