Skip to content

feat: Add comprehensive CRUD functionality for controls and tanks wit…#10

Merged
StuartF303 merged 1 commit intomainfrom
claude/camper-van-control-setup-011CUpsFKnx2JFyoEDjhfgbz
Nov 6, 2025
Merged

feat: Add comprehensive CRUD functionality for controls and tanks wit…#10
StuartF303 merged 1 commit intomainfrom
claude/camper-van-control-setup-011CUpsFKnx2JFyoEDjhfgbz

Conversation

@StuartF303
Copy link
Copy Markdown
Owner

…h provider configuration

Implements full create, read, update, and delete operations for both controls and tanks with hardware provider configuration options.

Controls.razor:

  • Add "Add Control" button in header
  • Add Edit and Delete icon buttons on each control card
  • Create Add/Edit dialog with form validation
    • Control name, type (Toggle/Dimmer/Momentary/Selector), icon selection
    • Provider configuration section with three options:
      • Simulated (for testing)
      • GPIO Pin (pin number, active low option)
      • Modbus Device (address, register, register type)
  • Implement SaveControl method (handles both create and update)
  • Implement DeleteControl method with confirmation dialog
  • Add ControlPlugin and ControlConfiguration properties to ControlDto
  • Wire up all CRUD operations to backend API

Tanks.razor:

  • Add "Add Tank" button in header
  • Add Edit and Delete icon buttons on each tank card
  • Create Add/Edit dialog with form validation
    • Tank name, type (FreshWater/WasteWater/LPG/Fuel/Battery)
    • Capacity (liters), low/high level thresholds (%)
    • Sensor provider configuration section with four options:
      • Simulated (for testing)
      • I2C Sensor (I2C address, channel number)
      • Modbus Device (address, register, register type)
      • Analog Input (pin, min/max voltage for calibration)
  • Implement SaveTank method (handles both create and update)
  • Implement DeleteTank method with confirmation dialog
  • Add SensorPlugin and SensorConfiguration properties to TankDto
  • Wire up all CRUD operations to backend API

Index.razor (Dashboard):

  • Add LoadControls method to fetch controls from API
  • Add CreateOverlaysFromControls method to display controls on diagram
  • Update OnControlToggle to call API and update control state
  • Add ControlDto class definition
  • Controls now appear as interactive switches on the van diagram
  • Control state changes are sent to backend and broadcast via SignalR
  • Both tanks and controls are now fully interactive on the diagram

Key Features:

  • All changes default to "Simulated" provider for easy testing
  • Provider configurations are stored in *Configuration dictionaries
  • Dynamic form fields based on selected provider type
  • Full validation on all form inputs
  • Success/error notifications for all operations
  • Confirmation dialogs before deletion
  • Seamless integration with existing SignalR real-time updates

This enables users to:

  1. Add custom tanks and controls via UI (no code changes needed)
  2. Configure hardware connections (GPIO, Modbus, I2C, Analog)
  3. Test with simulated providers before connecting real hardware
  4. Edit configurations without redeployment
  5. Remove unused tanks/controls easily
  6. See all controls as interactive switches on the dashboard diagram

…h provider configuration

Implements full create, read, update, and delete operations for both controls and tanks
with hardware provider configuration options.

Controls.razor:
- Add "Add Control" button in header
- Add Edit and Delete icon buttons on each control card
- Create Add/Edit dialog with form validation
  - Control name, type (Toggle/Dimmer/Momentary/Selector), icon selection
  - Provider configuration section with three options:
    * Simulated (for testing)
    * GPIO Pin (pin number, active low option)
    * Modbus Device (address, register, register type)
- Implement SaveControl method (handles both create and update)
- Implement DeleteControl method with confirmation dialog
- Add ControlPlugin and ControlConfiguration properties to ControlDto
- Wire up all CRUD operations to backend API

Tanks.razor:
- Add "Add Tank" button in header
- Add Edit and Delete icon buttons on each tank card
- Create Add/Edit dialog with form validation
  - Tank name, type (FreshWater/WasteWater/LPG/Fuel/Battery)
  - Capacity (liters), low/high level thresholds (%)
  - Sensor provider configuration section with four options:
    * Simulated (for testing)
    * I2C Sensor (I2C address, channel number)
    * Modbus Device (address, register, register type)
    * Analog Input (pin, min/max voltage for calibration)
- Implement SaveTank method (handles both create and update)
- Implement DeleteTank method with confirmation dialog
- Add SensorPlugin and SensorConfiguration properties to TankDto
- Wire up all CRUD operations to backend API

Index.razor (Dashboard):
- Add LoadControls method to fetch controls from API
- Add CreateOverlaysFromControls method to display controls on diagram
- Update OnControlToggle to call API and update control state
- Add ControlDto class definition
- Controls now appear as interactive switches on the van diagram
- Control state changes are sent to backend and broadcast via SignalR
- Both tanks and controls are now fully interactive on the diagram

Key Features:
- All changes default to "Simulated" provider for easy testing
- Provider configurations are stored in *Configuration dictionaries
- Dynamic form fields based on selected provider type
- Full validation on all form inputs
- Success/error notifications for all operations
- Confirmation dialogs before deletion
- Seamless integration with existing SignalR real-time updates

This enables users to:
1. Add custom tanks and controls via UI (no code changes needed)
2. Configure hardware connections (GPIO, Modbus, I2C, Analog)
3. Test with simulated providers before connecting real hardware
4. Edit configurations without redeployment
5. Remove unused tanks/controls easily
6. See all controls as interactive switches on the dashboard diagram
@StuartF303 StuartF303 merged commit c47ffb4 into main Nov 6, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants