fix: make Eco-Smart "Off" reachable/stable from Home Assistant (esm stays pegged)#30
Open
xtux77 wants to merge 1 commit into
Open
fix: make Eco-Smart "Off" reachable/stable from Home Assistant (esm stays pegged)#30xtux77 wants to merge 1 commit into
xtux77 wants to merge 1 commit into
Conversation
The `eco_mode` select bounces back to its previous value whenever a user
tries to select "Off" from Home Assistant. Two independent problems:
1. Read-back (wb_ble.cpp): the gateway publishes `eco_mode` from the raw
`esm` field and discards `ese`. When Eco-Smart is disabled the charger
leaves `esm` pegged at its last value (e.g. 2), so HA shows a phantom
"Solar + Grid" even though the feature is off (ese=0). Now the reported
mode is gated on `ese`: eco_mode = ese ? esm : 0.
2. Write (wb_mqtt.cpp): selecting "Off" sends {esm:0, ese:0} in one shot.
The charger ignores the `esm` change when it arrives together with
ese=0 (disabling), so `esm` never actually clears. Disabling now uses a
two-step write ({esm:0,ese:1} then {esm:0,ese:0}) so the mode is
accepted first and the master flag dropped after, leaving {ese:0,esm:0}.
Verified against a Pulsar MAX Pro (charger FW 6.11.25, gateway v3.2.1):
after selecting Off, g_ecos reads {ese:0, esm:0} and the HA select stays
on "Off" without bouncing.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Fixes #29.
The
eco_modeselect (and the "Solar charging" switch) cannot be set to Off from Home Assistant — it bounces back to the previous mode. Two independent causes, both fixed here.1. Read-back ignored
ese(src/wb_ble.cpp)g_ecosreturnsese(master enable) +esm(mode). When Eco-Smart is off, the charger leavesesmpegged at its last value (e.g.2) and only clearsese. Publishing rawesmmade HA show a phantom "Solar + Grid".2. Disabling write was self-defeating (
src/wb_mqtt.cpp)Selecting "Off" sent
{esm:0, ese:0}in one shot; the charger ignores anesmchange that arrives together withese:0, soesmnever cleared. Now disabling does a two-step write (mode change first with the flag still on, then drop the flag), mirroring the known-good manual BAPI workaround.Testing
Pulsar MAX Pro, charger FW 6.11.25, gateway v3.2.1:
g_ecos={"ese":0,"esm":2}.g_ecos={"ese":0,"esm":0}, HA select stays on Off, no bounce.ese:1path).Changes are limited to the two mode paths;
eco_powerand every other control are untouched.