Skip to content
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

implement set_battery_reserve_relative_to_current_charge_level #79

Open
atimgraves opened this issue Jan 24, 2025 · 9 comments
Open

implement set_battery_reserve_relative_to_current_charge_level #79

atimgraves opened this issue Jan 24, 2025 · 9 comments

Comments

@atimgraves
Copy link

Hi Stefan
in the underlying ha_sonnen py library there is the capability to set the battery reserve level (minimum to be retained) and also to set it relative to the current battery level.
As you seem to have a way better understanding of how HA works than I do (I looked at this stuff on and off for 6 months before giving up) could you make these capabilities available.
The use case is that when my car starts charging on overnight or cheap rate power I want to trigger an automation to stop the sonnen battery being used to charge the car (I.e. set the required reserve = to the current level) which will force the use of the cheaper grid power. Unfortunately the times of the cheap rate can vary. Offering the minimum reserve option to the underlying for the relative reserve call (implemented already in the underlying library) will enable a suitable reserve to always be available in case of a power cut.
When the overnight or cheap rate finishes (again the time can vary) then a different automation woudl trigger using an absolute set_reserve call to return it to the previous level.
Thanks, Tim

@RustyDust
Copy link
Collaborator

Hi Tim,

The main reason I didn't put that into the HA integration is that I didn't - and still don't - see the use case for it. If I wanted to prevent the Sonnenbatterie from getting discharged while charging the car during cheap hours - or, as you described it, use the cheaper grid power while charging the car - the simple solution would be to set the battery to manual mode, maybe with additionally setting charge and discharge to 0. Likewise, once the car has stopped charging just put the battery back into automatic mode. Now, if you wanted to discharge the Sonnenbatterie to a certain level (say: discharge to 50% while charging the car) you could do this as well using a simple helper function that would set the USOC according to your wishes.

Also, personally, I don't think this functionality should be in the underlying library at all since it provides a very specific function that to me seemed to be tailored to a specific need and as such shouldn't be placed into a base level library. In my opinion this would be better placed in an automation or a helper function. Which is the reason why I exposed the whole TimeOfUseSchedule functionality to HA.

But there's of course the possibility I haven't understood correctly what you're trying to do, so feel free to point out what I'm not seeing and I promise to put this into the integration if you can convince me ;)

NB: Since I'm using evcc for that very purpose for quite some time now I can say that evcc handles this automatically and even allows for some other options to have the Sonnenbatterie play nicely together with charging the car.

@RustyDust
Copy link
Collaborator

RustyDust commented Jan 24, 2025

Uh, sorry, I wasn't precise enough: I'm talking about set_battery_reserve_relative_to_current_reserveonly
since set_battery_reserve is already implemented.

@atimgraves
Copy link
Author

atimgraves commented Jan 24, 2025 via email

@atimgraves
Copy link
Author

atimgraves commented Jan 24, 2025 via email

@RustyDust
Copy link
Collaborator

Just a quick reply while debugging #78 :

Is set_battery_reserve available as a service ? I don't see it in the
services.yaml file

Then the tricky little thing must be hiding from you ;)

-Stefan

@atimgraves
Copy link
Author

atimgraves commented Jan 24, 2025 via email

@RustyDust
Copy link
Collaborator

I split that one off into a new issue #80 , thanks!

@RustyDust
Copy link
Collaborator

(sadly my wall charger system isn't listed on the evcc page :-()

Out of curiosity: what brand/model is your charger?

@atimgraves
Copy link
Author

Actually just one point on this one, I miss described it in the title it should be "set battery reserve relative to current charge level" (not relative to current reserve), (I.e. get the current charge, set the delta based on the relative value an if a minimum is provided no lover than the minimum)

My wall charger is a MyEnergi Zappi V1 unfortunately it doesn't have the ability to recognise my car and will happily charge any car, hence having to block charging until the octopus intelligent go charge rate kicks in, which should only happen if the car is at home and plugged in, of for 6 hours overnight. Once I better understand the logic of automations enough I'm going to pull the car location and power connection state from the tesla integration and only enable the charger if the car is at home and connected.

@RustyDust RustyDust changed the title implement set battery reserve and set battery reserve relative to current reserve implement set battery reserve and set battery reserve relative to current charge level Jan 24, 2025
@RustyDust RustyDust changed the title implement set battery reserve and set battery reserve relative to current charge level implement set_battery_reserve_relative_to_current_charge_level Jan 24, 2025
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

No branches or pull requests

2 participants