Skip to content

Add export control#32

Open
amichael wants to merge 4 commits intoricho:mainfrom
amichael:add-export-control
Open

Add export control#32
amichael wants to merge 4 commits intoricho:mainfrom
amichael:add-export-control

Conversation

@amichael
Copy link

Adds two new methods to Client for reading and writing the grid export configuration — the "Allow Export" setting in the FranklinWH mobile app.

Export modes

SOLAR_ONLY - Solar can export; battery (aPower) cannot
SOLAR_AND_APOWER - Both solar and battery can export
NO_EXPORT - No grid export

An optional export power cap (limit_kw) is supported (0.1–10000.0 kW).

Discovery

The app uses certificate pinning so MITM proxying wasn't viable. Endpoints
were found by extracting strings from the compiled Dart snapshot (libapp.so)
in the Android APK, then probing them directly while toggling app settings
to map response fields to states.

Endpoints used:

  • GET hes-gateway/terminal/tou/getPowerControlSetting
  • POST hes-gateway/terminal/tou/setPowerControlV2 (read-modify-write)

@richo
Copy link
Owner

richo commented Mar 23, 2026

Hey thanks for this!

Do you know when they started using certificate pinning? I'm wondering if they did it after I gave my talk.

I would like to test this quickly on my install and then get a release out.

Are you also interested in adding this to the hass integration? No pressure either way just want to avoid duplicating work.

Thankyou!

@amichael
Copy link
Author

You are welcome, it was a fun project. Thanks for getting it started.

I'm not sure when the app started using certificate pinning. I started looking into this a few days ago. I used version v2.10.0 of the Android app to find the endpoints.

I'll try to look into HA integration this week. Confirming the right repository: https://github.com/richo/homeassistant-franklinwh.

@amichael
Copy link
Author

BTW what talk are you referring to? Is it about this project? Any recording I can watch?

@richo
Copy link
Owner

richo commented Mar 24, 2026

The talk is here: https://youtu.be/wXbnUm88IJw?t=9593

Nothing groundbreaking but I dunno how much they fully loved the experience. I am glad they fixed some things.

Correct that's the right repo! Like I said no pressure I just didn't want both of us to be doing it at once.

@amichael
Copy link
Author

amichael commented Mar 24, 2026 via email

@richo
Copy link
Owner

richo commented Mar 25, 2026

It does, and that "You need to select the number" thing is really the rub with HA integrations, the way this works really doesn't translate at all into their ecosystem so you wind up having to do some pretty ugly things. The alternative is to add a service which is functionally the same as a typed function, but then it's mostly only accessible from automations.

Thanks again, I had to run to phoenix at short notice, but testing this is first on my list when I get home today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants