-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support libbi export to grid #442
Comments
Looks like the endpoints are... to turn on and to turn off It's not a very consistent API is it! |
I've got it working locally; will be posting it here soon. The API is sort of consistent. Looking at the app code there are a number of modes that are defined, but not used and cannot be set. (capture, charge, match) |
Charge target is implemented as well, but it's super-broken in the libbi firmware. 😞 |
Nice :-) I'll try it with the app tonight. BTW do you have 5.414 installed on your libbi ? ( see https://myenergi.info/libbi-no-longer-fully-charging-with-cheap-rate-ove-t11328.html ) |
I had 5.408 on until this morning. Overnight, instead of my set 2.5h charge, the libbi only charged for an hour and then it sort of held the SoC. |
For those who are foolish and reckless.... I present you the latest bleeding edge version of the integration. I am adding the service to set the charge target. New version probably tomorrow (depending on my schedule). |
Great work. I'm running 5.414. Can confirm export works! |
My charge target remains the same with toggling the charge from grid. Does yours change? |
Yes mine seems to default to zero... I reset it in the app to 100%, and toggle it again in home assistant, but it returns to zero |
Same behaviour in the app too...... toggle it and it returns to zero. |
aha.... this is another shared account issue. If I login into app with primary account details, then it remembers the chargetarget between toggles... |
If it's the same issue in the app, then it's a myenergi issue. |
I have tested it with my secondary account and it is indeed a myenergi backend issue. 🤦 |
FYI, didn't work for me, plugin failed to startup. I see in the logs -
Rolled back to official version and it started up. |
As this version adds the OAuth endpoints you need to remove your integration and re-add it as it requires both API key/password and App email/app password parameters. |
Ah, got it, thanks. After re-adding ( and entering username/password ) I was able to enable export :-) My grid charge percentage stayed at 60% FYI. |
Great to hear! I am nearly ready with the charge target setting functionality, but as this is the first time I'm implementing a HA service, it is a lot of trial and error. |
Thanks for making this version. Is there a plan for getting a 0.0.25 made with this in? |
@whittyone Yes, there is. I am updating the pymyenergi library currently. Once that's done and out, I can push my modifications to the HA component. |
I see this didn't make 0.0.25 |
@plord12 The 0.1.0 version of pymyenergi (released yesterday) has all the necessary features in there, so once I rebase my local dev copy to 0.0.25, this will be in 0.0.26. |
Brilliant! Many thanks. |
I'm making really good use of this to dump excess power in the evenings and during Octopus saving sessions, so good to know that I shouldn't upgrade just yet. Thanks! |
Did this get added to 0.0.26 or 0.0.27? I don't see it in the changelogs. |
I'm still working on getting the PR ready. Unfortunately work has been eating into my spare time, so no ETA at the moment. |
No worries. 0.0.25 is still working fine for me so I'm in no rush to update. 😄 |
I hate to pester, given so many give their time for projects like this, but any news ? Once this gets in I hope to look at the libbi dual tariff issue (eg sync libbi schedule from octopus) ... but I don't really want to get going until this is in. Cheers :-) |
I can see the light at the end of the tunnel! |
I found that issue when I brought my fork up to 0.0.27 and it's already fixed. |
It's been a long time coming, but finally it's here! Apologies for the delay (new job, family stuff) |
@trizmark great job 👍🏼 👏🏼 I'm still getting 0.0.27 in HACS. Can't see if this has been pushed through. Anyway to jump to the latest build via HA? |
Also eagerly waiting for the new release, though I note that the page for #553 says that some checks have failed? I'm wondering if this new version will have a way to actually check and confirm the state of the "charge from grid" toggle? My automation completely failed a couple of nights ago because the myenergi API was down at 23:30 when it tried to turn on grid charging, and the "until" loop that was supposed to safeguard against failed commands was just checking the state of this toggle. It was only when I woke up to an empty battery that I realised it's just a dumb toggle and not actually read back from anywhere! I've fixed that now by instead checking the state of For now I'm just going to have to toggle it and hope that the API is up and running, but it would be great to have something reliable to check against. |
The failed checks are for linting and testing. The linting issue is a conflict between black8 and reorder-imports. The test failure is due to me making app_password and email optional, while the test expects them to be mandatory. The charge_from_grid toggle is read and updated every minute. If you change it from the app, the state will be updated within a minute. If there's an issue with the ME API, the control will become unavailable and any turn_on or turn_off will fail. |
We need a local API. I've raised support requests to myenergi to this effect. The more of us who do the same the better. |
@MaximumFish I'll do some more testing to see how the integration behaves during an API outage. |
That would be awesome, thank you. It's not a huge issue right now as the only times I've ever had issues is overnight when switching grid charging on and I can check that's worked via the "Target Charge" state. In the mornings I'm currently just checking the app manually to make sure it's turned off properly. Though I wonder if I can do something funky with watching the grid draw to figure out if it's switched or not... @plord12 if I were to raise the local API issue too, what would I be asking for exactly? I don't think I'd get away with just saying "Local API plz" :) |
I would say something like - "There have been several times recently that I've been unable to control my myenergi devices .. a couple of cases where my internet connection was unreliable and a couple where the myenergi server didn't seem to respond. Regardless of the cause, its vital I can control the myenergi devices at all times. I've read that most manufacturers provide a "local API" to make this work. I see companies like Octopus are giving out such devices for free. Can you raise an enhacement request to provide a (documentend) local API and update the app to use it when possible. Of course, once this exists, 3rdaprty tools such as home assistant can also make use of it" |
You can also highlight the fact that if integrations switch to local API, then they could save on AWS costs! |
Cool, I'll send something in to add to the pile! |
Hi @CJNE, do we have an ETA for the update? Be fantastic to take advantage of the charge feature for the libbi (opens up some massive savings) |
Can anyone give me a rough guide on upgrading before the latest version is officially released? Got caught out with a scheduled charge today (left over from yesterday's free electric 1-2pm grrr). So looking to update for charge/discharge full control |
@githubjonny Here's the version that has been merged yesterday. You simply extract it in the custom_components folder of your HA install. (I'd suggest removing the existing myenergi directory from there.) |
@trizmark Thank you. I just went to do this now and saw that the update was available in HA :) Ran the update and all went well. However, I can't seem to get the libbi to charge using the "on" toggle on switch.myenergi_libbi_XXXXXX_charge_from_grid (removed id). Clicking doesn't seem to do anything. When I view logbook I see: I then re-read the release notes and saw : "In order to access the new functionality, the integration requires the app email and password (to access the OAuth controlled API calls). This can simply be done by 'Reconfiguring' the integration. The app email and password is optional and only required if someone owns a libbi." I think this may be an issue for me as I use a google login for my myenergi account. Any ideas? |
@githubjonny We found a workaround for that! So, you need to create a new ME account with email and pass and invite this new account to manage your house. The component already caters for this (there's an invitation ID in the API that needs to be saved/passed on) and it works fine. |
@trizmark thanks for your help with this. I'll do that 1st thing tomorrow. It's interesting I can control the libbi discharge without a standard login though. Wonder if there's a way to control charging with just the API etc. |
You can also use your original email and user it to create an account with
a password, no need to add another account/email. The ME portal recognises
it as being the same. This method worked for my original Google login.
Looking forward to installing this upgrade, thank you.
…On Tue, 20 Aug 2024, 21:10 Zoltan, ***@***.***> wrote:
@githubjonny <https://github.com/githubjonny> We found a workaround for
that! So, you need to create a new ME account with email and pass and
invite this new account to manage your house. The component already caters
for this (there's an invitation ID in the API that needs to be saved/passed
on) and it works fine.
—
Reply to this email directly, view it on GitHub
<#442 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A6PXPUDNBGRJQFFKIWILZU3ZSOID3AVCNFSM6AAAAAA6RDVDPCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJZGU3TINBYGM>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
see this is why I love open source software. Within a few minutes had two replies both offered solutions. I just created a new account and can confirm what @ragg987 said works. As soon as I created the account and logged in it had all my details. Thanks again everyone. |
Just an update, @trizmark I now can control the charge from the grid toggle :) thanks for your hard work on that one 👍🏼 Just wondered what everyone's doing regarding half hour time slots? I'm assuming two tier pricing with all half hours on the cheap tariff?
Nope, 1 tariff = no ability to charge |
@githubjonny Yeah, two tier pricing and all the slots on the cheap tarriff. That way you can toggle the charge from grid on and off to control when the libbi charges.
The ME API uses two different authentication methods. Most of the old sutff uses digest (based on API key/secret) and some of the new stuff uses OAuth (based on username/password). The ME engineers hinted on the forums that they're planning to move everything over to OAuth, but it looks like that'll take a long time. The mode selection API call is based on old auth (which worked without app email/pass), but charging from grid toggle and charge target setting API calls are based on new auth (which didn't work). |
@MalcolmSpencer , Any guides on how to achieve this anywhere online? |
Now that we can change operating mode to 'export', do we think there is any scope for setting/limiting charge/discharge rates? |
That would be handy if possible. Currently I export my battery before the cheap session starts at a low amp rate (to help battery life). However would prefer to dump battery much quicker during octopus saving session without having to alter settings manually |
Limiting charge/discharge rates is a no-go at the moment. While technically it would be possible, the feature is not implemented by the controller and it's not exposed via the API. |
Are you hoping to have this data in HA or just in general? I could add this to pymyenergi, but I don't think there's a way to add historical data to HA (well, not without touching the DB directly). |
That makes sense. Would be able to tell whether this sort of thing (limiting charge/discharge) is within the realm of possibility for myenergi to expose via the API at some point? Just want to have an idea of where to set my expectations :) |
Possibly at some point, but I don't see that being in the next 12 months. I know they're reworking the libbi controller firmware. Not sure how big the controller FW is and how much space there is for extra features. After all, it's only an ESP32 doing an awful lot of things. |
Why hasn’t this ’issue’ been closed? It’s become a rambling set of comments. |
Is your feature request related to a problem? Please describe.
Since libbi 5.408 ( https://support.myenergi.com/hc/en-gb/articles/19276846239377-libbi-Firmware-Version-5-408 ) libbi supports export to grid. This is useful if you wanted to use your libbi to charge by cheap electricity (or solar) and export when export prices are high.
Describe the solution you'd like
HA entity to turn on and off export to grid.
Describe alternatives you've considered
none
Additional context
Also raised CJNE/pymyenergi#18 for the underlying library
The text was updated successfully, but these errors were encountered: