-
Notifications
You must be signed in to change notification settings - Fork 31
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
Comments
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. |
Uh, sorry, I wasn't precise enough: I'm talking about |
Hi Stefan
Is set_battery_reserve available as a service ? I don't see it in the
services.yaml file (it is in services.py) so I don't see how to access it
from the UI as an action for an automation.
I understand what you're saying about the manual settings being more
powerful, but the battery reserve (on my 9.53 hybrid at least) provides
some additional features (though I may not be using them in the intended
manner) specifically it will trigger conditional charging (or discharging
down to the limit set) and if needed will also discharge during a power
outage (the documentation, such as it is, for my battery seems to indicate
that in the event of a power cut in manual mode you need to set a discharge
rate, whereas using the reserve whie in auto or tou modes means that during
a power cut the battery will automatically cut in and discharge as needed.
The reason for set_battery_reserve_relative_to_current_reserve is really
because ultimately I planned (if I'd worked the code out) to be able to
call it direct from an automation, and I couldn't see how to use the
automation to get the current charge value and then apply a delta to it to
generate the appropriate reserve (esp having to remain within the 0 - 100
range). Agree that currently this is implementing logic in the underlying
library, which is a bad thing and no problems moving the implementation
(range limits and so on) to the service.py code.
Doing a relative set just seems a lot easier when using the UI to setup the
automation when I get the trigger that the electricity has switched to the
cheap rate - though I'm a Java guy and fully accept that there may be a way
of doing this in the HA UI that I don't know of.
Cheers, Tim
…On Fri, 24 Jan 2025 at 13:45, stefan ***@***.***> wrote:
Uh, sorry, I wasn't precise enough: I'm talking about
set_battery_reserve_relative_to_current_reserveonly
since set_battery_reserve
<https://github.com/weltmeyer/ha_sonnenbatterie#set_battery_reservevaluevalue>
already is implemented.
—
Reply to this email directly, view it on GitHub
<#79 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AG4VUTEQC3DEZUOJ3HVX5YT2MI7ZFAVCNFSM6AAAAABVZRRE7KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMJSGU3DOMZXGU>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Should also have noted that my car charger also has different modes -
solar only, solar + grid (or drain sonnen) and that the car charging is
more complex because the electricity company decides not only when, but
also by how much to charge the car battery. So for me just saying "Car is
being charged, stop sonnen discharge" is very useful.
In terms of using the relative to current values it's very rare that I use
anything other than 0 (stop discharge) but sometimes if the sonnen is low I
will set it to maybe 10 or 20 so that the sonnen will also charge using the
cheap rate electricity (I'm allows to use it for things other than charging
the car as long as the car is being charged - so I also need to enable the
wall box when the cheap rate cuts in, this is normally disabled after I
found someone had plugged their car into my charger while I was on holiday
once and was charging on my bill)
(sadly my wall charger system isn't listed on the evcc page :-()
…On Fri, 24 Jan 2025 at 13:45, stefan ***@***.***> wrote:
Uh, sorry, I wasn't precise enough: I'm talking about
set_battery_reserve_relative_to_current_reserveonly
since set_battery_reserve
<https://github.com/weltmeyer/ha_sonnenbatterie#set_battery_reservevaluevalue>
already is implemented.
—
Reply to this email directly, view it on GitHub
<#79 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AG4VUTEQC3DEZUOJ3HVX5YT2MI7ZFAVCNFSM6AAAAABVZRRE7KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMJSGU3DOMZXGU>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Just a quick reply while debugging #78 :
Then the tricky little thing must be hiding from you ;) -Stefan |
Hi Stefan
Sorry, bad wording on my part, I mean it's in the file but doesn't show up
as an available action, below are the actions that show up for the battery
if you chose the "Do something on a device" option for an action on the
sonnen, none of them are setting the reserve
[image: image.png]
Curiously if you chose the other actions in the action list of an
automation, then perform an action(was call service based on the
description) then chose set backup capacity then choose the battery it is
an option. Not sure why it's showiong up in one list but not the other, but
as I've mentioned before I've had trouble understanding the way HA
structures things
[image: image.png]
…On Fri, 24 Jan 2025 at 15:07, stefan ***@***.***> wrote:
Just a quick reply while debugging #78
<#78> :
Is set_battery_reserve available as a service ? I don't see it in the
services.yaml file
Then the tricky little thing
<https://github.com/weltmeyer/ha_sonnenbatterie/blob/a76943fb35a68f9fe9529c45ee46d47b6947017b/custom_components/sonnenbatterie/services.yaml#L38>
must be hiding from you ;)
-Stefan
—
Reply to this email directly, view it on GitHub
<#79 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AG4VUTH2EGSW6EYBMWAYLDL2MJJLJAVCNFSM6AAAAABVZRRE7KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMJSG42TGOBYGE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I split that one off into a new issue #80 , thanks! |
Out of curiosity: what brand/model is your charger? |
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. |
set_battery_reserve_relative_to_current_charge_level
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
The text was updated successfully, but these errors were encountered: