Add OpenEVSE button platform#172964
Conversation
|
Hey there @c00w, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
There was a problem hiding this comment.
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.pyplatform file with two restart button entities and associated error handling. - Registered
Platform.BUTTONin the integration's__init__.pyand 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): |
| 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 |
| 'aliases': list([ | ||
| None, | ||
| ]), |
| ), | ||
| OpenEVSEButtonDescription( | ||
| key="restart_evse", | ||
| translation_key="restart_evse", |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
@joostlek There's 2 devices, the underlying EVSE arduino board and the Wifi module for all the API calls.
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Proposed change
This PR introduces the
buttonplatform to the OpenEVSE integration. It adds support for two reboot/restart buttons:restart_evse())restart_wifi())Both buttons are categorized as configuration entities (
EntityCategory.CONFIG) and utilizeButtonDeviceClass.RESTART.Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: