Files
2026-06-24 17:26:18 +02:00

1.6 KiB

TODO - PLC Client Web Project

Objectives

  • Implement a Flask web server to display PLC data.
  • Replicate plc_client.py output 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.py to 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.js to 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.py output 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).