Skip to content

mdierolf/pool-control

Repository files navigation

Pool Control System

This is a Next.js project for controlling pool and spa equipment. The system manages various devices including pumps, valves, heaters, and pool sweeps through different hardware interfaces.

Features

  • Scheduled Operations: Automatically runs different modes based on time of day
  • Manual Override: Allows manual control of pool/spa equipment
  • Multiple Device Support:
    • I2C Relay control
    • Numato USB Relay control
  • Multiple Operation Modes:
    • Off
    • Spa
    • Prime
    • Pool Sweep
    • Various low-speed modes

System Architecture

The system consists of:

  1. Device Controllers: Classes that manage communication with hardware

    • i2cRelayDevice: Controls relays via I2C bus
    • NumatoDevice: Controls relays via USB serial connection
  2. Scheduler: Manages the timing of different modes and controls the devices

    • Automatically switches between modes based on schedule
    • Handles manual overrides
    • Properly manages device resources
  3. API: Provides HTTP endpoints for controlling the system

    • State information
    • Manual overrides
    • Configuration

Getting Started

First, run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev

Open http://localhost:3000 with your browser to see the result.

Configuration

The system is configured in config.js at the root of the project. This file defines:

  • Hardware interfaces and their configurations
  • Operation modes and their associated relay states
  • Schedule for automatic mode changes

Recent Improvements

UI Improvements

  • Modern Interface: Redesigned with a clean, modern look using Tailwind CSS
  • Responsive Design: Fully responsive layout that works on mobile and desktop
  • Dark Mode Support: Automatic theme switching based on system preferences
  • Visual Equipment Status: Added visual indicators for active equipment
  • Enhanced Mode Selection: Improved mode switching with visual feedback
  • Loading Indicators: Added loading states for better user experience
  • Consistent Header & Footer: Added structured layout with navigation elements
  • Real-time Updates: Automatic refresh of system status
  • Improved Accessibility: Better contrast and readable fonts

Latest UI Enhancements

  • Professional SVG Icons: Replaced emoji icons with custom SVG icons for better visual consistency
  • Gradient Headers: Added gradient backgrounds to section headers for a modern look
  • Enhanced Status Cards: Improved equipment status cards with better visual feedback
  • Improved Mode Controls: Redesigned mode selection interface with clearer visual hierarchy
  • Better Override Indicators: Enhanced override mode display with warning indicators and helpful text
  • Consistent Design Language: Applied consistent styling across all UI components
  • Improved Visual Feedback: Added transitions and hover effects for interactive elements
  • Enhanced Mobile Experience: Optimized layout for small screens with responsive design patterns
  • Informative Timestamps: Added last updated time to header for better user awareness

Backend Improvements

  • Enhanced Resource Management: Added proper cleanup for device resources
  • Optimized Update Frequency: Devices now update only when needed
  • Improved Error Handling: Better recovery from communication errors with exponential backoff
  • Smart Retry Logic: Implemented exponential backoff for connection retries with automatic reset on success
  • Detailed Error Reporting: Enhanced error logging with device-specific information
  • Debug Mode: Added detailed logging for troubleshooting
  • Comprehensive Documentation: Added JSDoc comments to improve code readability
  • Seasonal Adjustments: Implemented monthly adjustment factors to automatically scale run times based on seasonal needs
  • Responsive Device Control: Improved device controllers to immediately respond to state changes

Learn More

To learn more about Next.js, take a look at the following resources:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages