Skip to content

Fix inverted Charge From Grid switch state on refresh - #17

Merged
Bre77 merged 1 commit into
teslemetryfrom
fm/hb-chargefromgrid-inversion-fix
Aug 3, 2026
Merged

Fix inverted Charge From Grid switch state on refresh#17
Bre77 merged 1 commit into
teslemetryfrom
fm/hb-chargefromgrid-inversion-fix

Conversation

@Bre77

@Bre77 Bre77 commented Aug 3, 2026

Copy link
Copy Markdown
Member

Intent

  • Fix Charge From Grid switch showing the inverted state after a refresh (found by user report)
    • Root cause: chargefromgrid.ts's site_info listener wrote the raw disallow_charge_from_grid_with_solar_installed value straight to the On characteristic, while the onSet handler treats the switch as the inverse of that API value (!value) when sending commands
    • Fix: apply the same inversion on read (on.updateValue(!data.components.disallow_charge_from_grid_with_solar_installed)) so refreshed state matches SET semantics
    • No behavior change to the SET path; read and write are now consistent

site_info updated the On characteristic with the raw
disallow_charge_from_grid_with_solar_installed value, while SET sends its
inverse. Apply the same inversion on read so refreshed state matches what
SET produces.
@Bre77 Bre77 added the fm Opened by a Firstmate crewmate label Aug 3, 2026
@Bre77
Bre77 merged commit a17eca9 into teslemetry Aug 3, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fm Opened by a Firstmate crewmate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant