Repository navigation
Fix solar capability detection when multiple solarModes returned by API - #14
Merged
Merged
Conversation
Ohme API returns multiple solar modes (e.g. ['PURE_SOLAR', 'ZERO_EXPORT']) in modelCapabilities['solarModes']. Previously, len(solar_modes) == 1 caused solar capability to be falsely reported as unsupported when both modes are supported. Also update solar_enabled property to return True for either ZERO_EXPORT or PURE_SOLAR.
dan-r
approved these changes
Oct 8, 2026
dan-r
left a comment
Owner
There was a problem hiding this comment.
All looks good. As this is our first set of unit tests, can you please add a workflow that runs everything in tests/ for every pull request as a check?
Contributor
Author
|
Added |
Owner
|
Nice work. Thank you |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I noticed a regression in Home Assistant around August 10, 2026 (observed at ~18:27 UTC in recorder history), where
switch.ohme_home_pro_solar_boostunexpectedly became unavailable and was no longer created across restarts.Digging into the API responses, this appears to be tied to a recent backend API change from Ohme.
Observed API Behavior
In the response from
GET /v1/users/me/account,chargeDevices[0]["modelCapabilities"]["solarModes"]on my Ohme Home Pro currently returns:It looks like Ohme has expanded their solar modes (presumably rolling out
PURE_SOLARalongside the existingZERO_EXPORT).Because line 614 checks for an exact length of 1:
the list now having 2 elements causes
self._capabilities["solar"]to remain unset, so Home Assistant skips registering the entity.Proposed Changes
While it's difficult to know for certain without an official OpenAPI spec if Ohme plans to introduce further solar modes, this PR proposes a couple of pragmatic changes to adapt to the current behavior:
len(solar_modes) == 1tolen(solar_modes) > 0(and use.get("solarModes")) so any non-empty list of supported modes enables the capability without failing if additional modes appear or raisingKeyErrorif missing.solar_enabledto returnTruefor either"ZERO_EXPORT"or"PURE_SOLAR"(the setting inoptionalSettings["solarMode"]), ensuring the entity reflects that solar mode is active regardless of which of the two modes was toggled in the Ohme app.tests/test_solar.pycovering multi-mode, single-mode, empty/missing list, andsolar_enabledproperty behavior.Tested locally against a live Ohme Home Pro on Home Assistant Core; solar boost switch entity registration and toggling are fully restored.