ZimbiX / amber-enphase-zero-export-switcher-tool

Mitigate Amber's negative feed-in price for battery-less Enphase solar systems
GNU General Public License v3.0
14 stars 2 forks source link

Not working for Envoy on version 4 #3

Closed jeffoconnorau closed 8 months ago

jeffoconnorau commented 8 months ago

Maybe I am unlucky or lucky depending on how you see it, but my envoy is on v4 firmware (R4.10.35 (6ed292) from 2018. I am reticent to ask Enphase for an upgrade to v5, as they would probably push v7 instead.

Any chance to update zest to work the same way for v4 as it does for v5 (installer user/pass?).

I tried forcing the env file to v5, but this results in following error in journalctl. It also doesn't like 4 in the env file either.

zest.rb:23:in `fetch': key not found: "ZEST_ENPHASE_ENVOY_FIRMWARE_VERSION" (KeyError)

I am sure I can fix this myself, but just thought it would be a good inclusion for others that might be new to zest.

Cheers

ZimbiX commented 8 months ago

Hmm, I don't have any expierience with v4. Sorry to hear you've had trouble. I understand your hesitation to ask Enphase for an upgrade. Are you sure that v4 would work the same as v5? Like, is the grid profile settings page available and the same as pictured in the readme?

The code explicitly checks the value of ZEST_ENPHASE_ENVOY_FIRMWARE_VERSION for 5 or 7, so setting it to 4 wouldn't currently work; but if v4 functions the same as v5, setting it to 5 should've worked. Are you sure you restarted the systemctl service after changing the .env file to say ZEST_ENPHASE_ENVOY_FIRMWARE_VERSION=5? That error indicates that the ZEST_ENPHASE_ENVOY_FIRMWARE_VERSION environment variable is not set, and so suggests that it's not being set in the .env file. From the example config, you should keep all settings except for those to do with v7, i.e. omit only:

# For firmware v7:
ZEST_ENPHASE_ENVOY_SERIAL=[serial of your Envoy]
ZEST_ENPHASE_ENLIGHTEN_USERNAME=[your username for Enlighten with self-installer permission]
ZEST_ENPHASE_ENLIGHTEN_PASSWORD=[your password for Enlighten with self-installer permission]

# For telemetry on firmware v7:
ZEST_ENPHASE_ENVOY_ACCESS_TOKEN=[a user token]

For a faster feedback cycle than using the service, I'd suggest starting Zest with ruby zest.rb while you're getting it working. And make sure the .env file is in the project directory (amber-enphase-zero-export-switcher-tool) - i.e. alongside the zest.rb file.

If you get it working on v4, I'm more than happy to note in the readme that it works on v4 and make it use the v5 auth mechanism when ZEST_ENPHASE_ENVOY_FIRMWARE_VERSION is set to 4. I wonder how many others are still on v4.

If there are any code changes required for v4, I'm happy to accept a PR.

jeffoconnorau commented 8 months ago

Thanks for the response. I was using this before the v5/v7 release, but updated and that broke things for me. My .env file is now fixed up previously I had it as zest.env, and it was getting skipped with the recent update. Moving on though I got past it, and hopefully this is just my environment, but I still can't launch zest due to this error:

/amber-enphase-zero-export-switcher-tool/lib/zest/enphase/installer_auth/firmware_v5/credentials_auth.rb:10:in `initialize': missing keyword: :logger (ArgumentError)
    from zest.rb:25:in `new'
    from zest.rb:25:in `<main>

maybe I am missing a dependancy here ?

ZimbiX commented 8 months ago

My apologies! I guess I didn't test startup with v5 after I separated them 😬 That should be fixed now, as of 151c419.

jeffoconnorau commented 8 months ago

no need to apologise :) Thank you for sharing it. I can confirm it is working now on v4.

ZimbiX commented 8 months ago

Excellent! Thanks for letting me know. Any differences at all in firmware v4 that I should mention in the readme?

jeffoconnorau commented 8 months ago

Hard to say, as I haven't any experience with v5 or v7. But looks to be the same as v5 in the interface screenshots I have seen, so YMMV, but the code works as is, so long as you set 5 in the .env file.

ZimbiX commented 8 months ago

Perfect. Cheers

ZimbiX commented 7 months ago

Any differences at all in firmware v4 that I should mention in the readme?

I just remembered this. 0e7efc1 adds explicit support for v4 =)