Skip to content

Add UI to enable/disable front button#1040

Draft
Copilot wants to merge 11 commits intomasterfrom
copilot/add-ui-enable-disable-front-button
Draft

Add UI to enable/disable front button#1040
Copilot wants to merge 11 commits intomasterfrom
copilot/add-ui-enable-disable-front-button

Conversation

Copy link
Contributor

Copilot AI commented Feb 14, 2026

Add UI to enable/disable front button ✅

Implementation complete with future-proof 3-bit configuration field!

Implementation Status: COMPLETE ✅

  • Add new configuration flag for button control
  • Reserve 3 bits for future button modes (0-7)
  • Add inline helper functions for button mode access
  • Add virtual config option in app_config.cpp for JSON serialization
  • Add enableButton() method to EvseMonitor and EvseManager classes
  • Implement logic to send RAPI command when configuration changes
  • Initialize GUI submodule and build GUI
  • Add UI toggle switch in EVSE configuration page (implemented in openevse-gui-v2 PR Fixes for extra chars when displaying the timer start/stop times #308)
  • Add translation strings to en.json
  • Address code review feedback
  • Run code review (passed ✅)
  • Run security checks (passed ✅)
  • Reserve 3 bits for future button behavior modes
  • Fix workflow test failures in divert_sim
  • NEW: Clean up documentation files and update GUI to PR branch

Changes Summary

Backend (ESP32 Firmware) - 5 files modified:

  1. app_config.h - 3-bit CONFIG_BUTTON_MODE field (bits 27-29)
  2. app_config.cpp - Updated to use CONFIG_BUTTON_MODE with mode 1 as default
  3. evse_monitor.h - Method declaration
  4. evse_monitor.cpp - Method implementation with clear logic
  5. evse_man.h - Wrapper method

Testing (divert_sim) - 1 file fixed:
6. divert_sim/test_config.py - Updated test constants and expected values

GUI Changes:

Configuration Structure:

#define CONFIG_BUTTON_MODE          (7 << 27) // 3 bits for button mode

inline uint8_t config_button_mode() {
  return (flags & CONFIG_BUTTON_MODE) >> 27;
}

inline bool config_button_enabled() {
  return config_button_mode() != 0; // Backward compatible
}

Future Extensibility:
The 3-bit field allows for up to 8 button modes, enabling future features like:

  • Custom button actions
  • Long-press behaviors
  • Different button modes per installation type
  • Integration with automation systems

Note: GUI changes are in openevse-gui-v2 PR #308 for easy testing and review.

Original prompt

This section details on the original issue you should resolve

<issue_title>Add UI to enable/disable front button.</issue_title>
<issue_description>There is currently no way to enable/disable the front button short of unplugging. Stations installed outdoors or in publicly accessible locations are venerable to tampering of settings or interrupting a charge.

RAPI command has been incorporated into openevse to enable/disable button
$FF B 0
$FF B 1

lincomatic/open_evse@c226ad8</issue_description>

Comments on the Issue (you are @copilot in this section)

@jeremypoulter With the v4 changes the WiFI module now always disables the button and handles the button presses it the WiFi module, so is there still a requirement to implement the disable button logic? @jeremypoulter @chris1howell Any thoughts? @chris1howell Some users want the button disabled regardless of where it is interpenetrated. If someone walks up to an outdoor station they can mess with your station. There should be a way to lockout public access to the button.

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits February 14, 2026 09:33
Co-authored-by: jeremypoulter <6116992+jeremypoulter@users.noreply.github.com>
Co-authored-by: jeremypoulter <6116992+jeremypoulter@users.noreply.github.com>
Co-authored-by: jeremypoulter <6116992+jeremypoulter@users.noreply.github.com>
Copilot AI changed the title [WIP] Add UI to enable or disable front button Add UI to enable/disable front button Feb 14, 2026
Copilot AI requested a review from jeremypoulter February 14, 2026 09:43
@github-actions
Copy link
Contributor

github-actions bot commented Feb 14, 2026

Test Results

58 tests  ±0   58 ✅ ±0   1s ⏱️ ±0s
 1 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit e050939. ± Comparison against base commit b931d6c.

♻️ This comment has been updated with latest results.

@jeremypoulter
Copy link
Collaborator

@copilot I would like to expand this feature in the future to allow the button to do different options

Copy link
Contributor Author

Copilot AI commented Feb 14, 2026

@copilot I would like to expand this feature in the future to allow the button to do different options

The current implementation is designed to be extensible for future button behavior options:

  1. Configuration space: Using a single bit flag (CONFIG_BUTTON_ENABLED) leaves room for additional flags or a multi-bit mode field in the future
  2. Method structure: enableButton() follows the same pattern as other feature toggles and can be supplemented with additional methods like setButtonMode() or configureButtonBehavior()
  3. GUI architecture: The Svelte toggle can easily be replaced with a dropdown/select for multiple button modes
  4. RAPI foundation: The OPENEVSE_FEATURE_BUTTON already supports enable/disable and can be extended with additional RAPI commands for button behavior

When expanding to button modes, you could:

  • Add a new config field like button_mode (enum: disabled, default, custom_action_1, etc.)
  • Keep button_enabled for backward compatibility as a master enable/disable
  • Or migrate to a multi-bit field replacing the single bit flag

The current implementation won't block future enhancements.

@jeremypoulter
Copy link
Collaborator

@copilot I would like to reserve some bits now, say 3, just to make it a little easier it the future

Co-authored-by: jeremypoulter <6116992+jeremypoulter@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 14, 2026

@copilot I would like to reserve some bits now, say 3, just to make it a little easier it the future

Done in commit e456e37. Changed from single bit to 3-bit field:

Configuration Structure:

  • CONFIG_BUTTON_MODE now uses bits 27-29 (3 bits total)
  • Mode 0: Disabled
  • Mode 1: Enabled (current default)
  • Modes 2-7: Reserved for future button behaviors

Backward Compatibility:

  • API still uses button_enabled boolean field
  • config_button_enabled() returns true for any non-zero mode
  • Existing code continues to work unchanged

Future Expansion:
The 3-bit field supports up to 8 modes, allowing for features like:

  • Custom button actions
  • Long-press vs short-press behaviors
  • Installation-specific button modes
  • Integration with automation systems

The implementation follows the same pattern as CONFIG_CHARGE_MODE and CONFIG_MQTT_PROTOCOL which also use multi-bit fields.

@jeremypoulter
Copy link
Collaborator

@copilot please check the workflow errors and resolve issues

Co-authored-by: jeremypoulter <6116992+jeremypoulter@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 22, 2026

@copilot please check the workflow errors and resolve issues

Fixed in commit 4ab91ca. The workflow failure was in the "Build OpenEVSE divert simulator" test suite.

Issue: The divert_sim/test_config.py file had outdated configuration constants and expected values.

Fix:

  1. Added CONFIG_BUTTON_MODE = 7 << 27 constant
  2. Updated expected default flags from 79691784 to 213909512 (includes new button mode bit)
  3. Added assertion assert config["button_enabled"] == True to verify default state

The test suite should now pass with the 3-bit button mode configuration.

@jeremypoulter
Copy link
Collaborator

@copilot PR OpenEVSE/openevse-gui-v2#308 implements the changes specified.

  • remove GUI_CHANGES.md and IMPLEMENTATION_SUMMARY.md
  • remove _codeql_detected_source_root and add to .gitignore
  • update the GUI to the PR branch for testing

- Remove GUI_CHANGES.md and IMPLEMENTATION_SUMMARY.md (GUI changes now in openevse-gui-v2 PR #308)
- Remove _codeql_detected_source_root symlink and add to .gitignore
- Update gui-v2 submodule to PR #308 branch (acca5ea) for testing button enable/disable UI

Co-authored-by: jeremypoulter <6116992+jeremypoulter@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 25, 2026

@copilot PR OpenEVSE/openevse-gui-v2#308 implements the changes specified.

  • remove GUI_CHANGES.md and IMPLEMENTATION_SUMMARY.md
  • remove `_codeql_dete...

Done in commit 4d828ed:

  1. ✅ Removed GUI_CHANGES.md and IMPLEMENTATION_SUMMARY.md
  2. ✅ Removed _codeql_detected_source_root symlink and added to .gitignore
  3. ✅ Updated gui-v2 submodule to PR Fixes for extra chars when displaying the timer start/stop times #308 branch (commit acca5ea)

The GUI submodule now points to the button enable/disable implementation in OpenEVSE/openevse-gui-v2#308 for testing.

@jeremypoulter jeremypoulter marked this pull request as ready for review February 25, 2026 18:38
@jeremypoulter jeremypoulter marked this pull request as draft February 25, 2026 18:38
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.

Add UI to enable/disable front button.

2 participants