I want you to examine the reef-pi GitHub project directory and show me precisely how to create a new “Auto Tester” module in the reef-pi codebase. This module must follow the same architecture, file layout, and coding style as other reef-pi modules—particularly the pH module, which we’ll use as a close reference. Main Objectives Hardware/Communication The Raspberry Pi (running reef-pi) will be the I²C master, and a separate Arduino-based device will be the I²C slave. Upon receiving commands from reef-pi, the Arduino will perform automated measurements of Calcium, Alkalinity, Magnesium, Nitrate, and Phosphate. Because these tests may take more time than a standard sensor read, reef-pi must wait properly (poll for status) until each test is done, then retrieve the results. Keep the Arduino firmware minimal—similar to how the pH module handles I²C, but with logic for slow test completion and for calibrations (described below). Even if the Arduino code for Nitrate/Phosphate calibration is not yet fully implemented, set up placeholders so that the module is ready for future expansion. Reef-pi Side (Backend Code & Module Integration) Implement a new package/folder for the “Auto Tester” module (e.g., autotester/), following the structure used by ph, ato, etc. Create a manager (similar to phManager) that handles: Device discovery and configuration, Scheduling tests, Sending commands to the Arduino over I²C, Polling for completion, Storing results in reef-pi’s database. Provide REST API endpoints to manage the new module’s configurations and schedules. Support five different tests (Ca, Alk, Mg, NO3, PO4), each with its own scheduling, logging, and graphing. Plan for calibration triggers on the reef-pi side for all five tests, even if the Arduino only has placeholders for some (like Nitrate, Phosphate). User Interface (UI) Add a new top-level “Auto Tester” tab or section in reef-pi’s web UI. Within this tab: Let the user configure each test (Ca, Alk, Mg, NO3, PO4)—including naming, enabling/disabling, and scheduling details (like frequency, times of day, etc.). Show a calibration interface (pump calibration plus test-specific calibrations). The user triggers a calibration routine from the UI, but cannot edit numeric calibration factors directly. Include placeholders for Nitrate and Phosphate calibration, even if the Arduino code is incomplete. Show the latest test readings and a status page (e.g., last run time, next scheduled run, etc.). Data Logging & Graphing For each test parameter, store results in reef-pi’s database with timestamps (similar to how pH data is logged). Provide a graph of each parameter on the main reef-pi dashboard, allowing the user to view real-time and historical data for Ca, Alk, Mg, NO3, and PO4. Ensure the new module’s data flows into reef-pi’s existing sensor-graph framework. Arduino Firmware Act as an I²C slave that: Listens for commands (e.g., “START_TEST_CALCIUM,” “GET_STATUS,” “CALIBRATE_PUMP,” “CALIBRATE_NITRATE,” etc.). Performs the requested action (whether measuring a parameter or performing a calibration routine). Indicates to reef-pi when it’s busy vs. when the test is complete, so reef-pi knows when to read the result. Returns the measured or calibrated data. Implement placeholders for Nitrate and Phosphate calibration routines—just enough so that reef-pi can call them and eventually store updated calibration factors. Even if they aren’t functional yet, the structure should be there. Prevent direct user editing of calibration factors like alkFactor, calFactor, etc. Instead, the user triggers the routine, which updates those factors internally. Implementation Details File Layout: Show how to add or edit files in reef-pi (e.g., a new autotester.go, modifications to db.go, updates to Vue components like MainMenu.vue, etc.) Scheduling: Follow the pH module’s approach. The manager should issue a “start test” command on a timer, periodically poll for completion, then store results once the Arduino is done. Calibration: Add a dedicated UI section that allows “Calibrate Pump” or “Calibrate Calcium,” etc., for each of the five parameters. Each button triggers a calibration routine on the Arduino. The user never sees or edits raw calibration factor values; those are updated by the firmware in response to the routine. For Nitrate and Phosphate calibrations, just create placeholders until that firmware logic is completed. Result Storage: After each test, reef-pi retrieves the data, stores it in the database, and refreshes the dashboard graphs. Long-Running Tests: Implement a non-blocking approach so reef-pi neither hangs nor requests results prematurely. Poll the Arduino’s status until the test is complete. End goal: A fully working reef-pi system that can handle scheduling, measurement, and calibration for Ca, Alk, Mg, NO3, and PO4, even if some calibration code is only stubs initially. Use this comprehensive prompt to guide your entire integration. It ensures reef-pi has a dedicated “Auto Tester” module that manages all five test types, provides both scheduling and calibration workflows, and stores & graphs the results—while keeping the Arduino firmware streamlined and reserving placeholders for unimplemented calibrations (Nitrate and Phosphate). sources: https://github.com/reef-pi/reef-pi https://reef-pi.github.io/ https://learn.adafruit.com/reef-pi-guide-7-ph-monitoring