Skip to content

Add OpenEVSE button platform#172964

Open
firstof9 wants to merge 2 commits into
home-assistant:devfrom
firstof9:add-openevse-buttons
Open

Add OpenEVSE button platform#172964
firstof9 wants to merge 2 commits into
home-assistant:devfrom
firstof9:add-openevse-buttons

Conversation

@firstof9
Copy link
Copy Markdown
Contributor

@firstof9 firstof9 commented Jun 3, 2026

Proposed change

This PR introduces the button platform to the OpenEVSE integration. It adds support for two reboot/restart buttons:

  1. Restart EVSE (restarts the charger module via restart_evse())
  2. Restart Wi-Fi (restarts the Wi-Fi module via restart_wifi())

Both buttons are categorized as configuration entities (EntityCategory.CONFIG) and utilize ButtonDeviceClass.RESTART.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

@home-assistant
Copy link
Copy Markdown
Contributor

home-assistant Bot commented Jun 3, 2026

Hey there @c00w, mind taking a look at this pull request as it has been labeled with an integration (openevse) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of openevse can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant mark-draft Mark the pull request as draft.
  • @home-assistant ready-for-review Remove the draft status from the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign openevse Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant update-branch Update the pull request branch with the base branch.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) on the pull request.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR adds button entity support to the OpenEVSE Home Assistant integration, providing "Restart WiFi" and "Restart EVSE" buttons for the charger.

Changes:

  • Added a new button.py platform file with two restart button entities and associated error handling.
  • Registered Platform.BUTTON in the integration's __init__.py and added translation strings for the new entities.
  • Added comprehensive tests including snapshot, press action, and error handling tests.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
homeassistant/components/openevse/__init__.py Registers the BUTTON platform in the platforms list.
homeassistant/components/openevse/button.py New platform implementing restart WiFi and restart EVSE button entities.
homeassistant/components/openevse/strings.json Adds translation keys/names for the two button entities.
tests/components/openevse/test_button.py Tests for entity creation, button press, and error handling.
tests/components/openevse/snapshots/test_button.ambr Snapshot data for the button entity tests.


async def async_press(self) -> None:
"""Press the button."""
with openevse_exception_handler(0.0):
Comment on lines +84 to +92
self._attr_device_info = DeviceInfo(
identifiers={(DOMAIN, identifier)},
manufacturer="OpenEVSE",
)
if unique_id:
self._attr_device_info[ATTR_CONNECTIONS] = {
(CONNECTION_NETWORK_MAC, unique_id)
}
self._attr_device_info[ATTR_SERIAL_NUMBER] = unique_id
@firstof9 firstof9 marked this pull request as ready for review June 3, 2026 22:42
Copilot AI review requested due to automatic review settings June 3, 2026 22:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Comment on lines +4 to +6
'aliases': list([
None,
]),
Copy link
Copy Markdown
Contributor

@c00w c00w left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - honestly we should probably make the exception helper treat value as optional.

),
OpenEVSEButtonDescription(
key="restart_evse",
translation_key="restart_evse",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means restart the device right? we can then omit the translation key as it would follow the device class translation and call it restart

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joostlek There's 2 devices, the underlying EVSE arduino board and the Wifi module for all the API calls.

@home-assistant home-assistant Bot marked this pull request as draft June 4, 2026 06:37
@home-assistant
Copy link
Copy Markdown
Contributor

home-assistant Bot commented Jun 4, 2026

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@firstof9 firstof9 marked this pull request as ready for review June 4, 2026 16:29
@home-assistant home-assistant Bot requested a review from joostlek June 4, 2026 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants