-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
[Feature Request]: make number.openevse_charge_rate consistent with OpenEVSE UI #402
Comments
I think this would be better handled via the library. |
sure that , I forgot you've made a lib for this |
quick question for you if you know the answer, does |
nope, max_current_soft is the setting in /config, it doesn't change. You usually only have to set it up once. max_current_hard is stored on EVSE module charge_current set the pilot. If there's many claims ( override is a claim , sort of ) Openevse takes charge_current value from the higher priority claim. And Divert set charge_current too, but lower priority than override. |
I don't know if you were aware of that. But you don't have to poll the /override /claims /config or any other endpoints. This way, you now exactly when to get a fresh /override and co You still have to grab them once at startup. |
Yup I look for those in the library: UPDATE_TRIGGERS = [
"config_version",
"claims_version",
"override_version",
"schedule_version",
"schedule_plan_version",
"limit_version",
] |
So I've whipped up a new property for the library, what do you think? @property
async def async_charge_current(self) -> int | None:
"""Return the charge current."""
try:
claims = None
claims = await self.list_claims()
except UnsupportedFeature:
pass
if claims is not None and "charge_current" in claims[0].keys():
return claims[0]["charge_current"]
if self._config is not None and "max_current_soft" in self._config:
return self._config["max_current_soft"]
return self._status["pilot"] It grabs the claims (the highest priority seems to always be listed first), checks for the "charge_current" in the keys for the first claim, and returns that, if it exists. Should I loop through all claims until I find a "charge_current", or do you think the first one would be sufficient? |
I forgot to tell you about this undocumented endpoint ( at least it was when I was developping the UI ) : Give a look to this one, it's really usefull.
properties: are the one actually used by openevse, claims: are the service ID claiming those properties. you can match service IDs here: https://github.com/OpenEVSE/openevse-gui-v2/blob/master/src/lib/vars.js This endpoint should be easier to use :) |
so will the properties dict contain a "charge_current" or use "max_current" ? |
This is just an example. This endpoint has all the props a claim can have. |
Would you be able to provide some additional example outputs? |
here is one with booth shaper and override setpoint ( and state is from scheduler )
|
@KipK would you mind seeing if this branch works as you're requesting? https://github.com/firstof9/openevse/tree/feat-402 When you have a moment of course. |
I've just tested with shaper on, that's working good, you've got it 👍 Thanks for investigating on this |
Just one thing is missing ( library job ), is removing the attribute/override when = max_current_soft edit: Ah I see something wrong, If I set the charge_current on OpenEVSE side , number.openevse_charge_rate doesn't follow on HA. openevse.mp4It seems HA plugin doesn't get the updated endpoint version. |
I'll take a look, thanks! |
It just seems it doesn't refresh data when a new version is published. I see it refreshed after a minute, not instantly |
Is the websocket not sending an update when you move the slider? |
yes it is: {"claims_version":119,"override_version":189} |
On UI, I keep a copy of all the endpoints in a local data store. When the /status websocket receive a new endpoint version ( aka claim_version, override_version, etc ) , it directly grabs it and update the data store. I had to integrate a request queue manager, because OpenEvse API doesn't like more than 1 query at the same time. |
Ya the library stores the api replies in a dict and when updates come in, the dict get's updated. |
@KipK it seems to work fine for me... |
@firstof9 I don't get why it did that the other day. Looks all good to me edit: I have some little things to comment but that's on library side:
|
No problem sometimes Home Assistant doesn't pull in the latest libraries either and needs a good kick to get it working right. |
I think I know what's happenbing, as I got this issue again today. Logs on HA where stating that openevse websocket was disconnected. Restarting HA solve the issue. So it seems the integration is not always reconnecting to websocket when disconnected. |
I'll take a look, pretty sure I have the websocket reconnecting on disconnect in the library. |
The feature
Hi @firstof9
We've discussed a bit about this on another thread, I'm opening a separated ticket for it.
1/ Setting number.openevse_charge_rate using a slider is painfull as it wait's for Openevse feedback while currently moving the slider, and then goes back and forth.
Could you make this entity "optimistic" like MQTT integration ?
The problem probably occurs too when "pilot" is controlled by another service like shaper, as the slider will follow it.
2/ To make it consistent with OpenEVSE UI, this entity state shouldn't follow "pilot" value, but the /override "charge_current" state when set, or the "max_current_soft" if there's no override.
3/ When number.openevse_charge_rate is set to the max possible value ( aka max_current_soft ) , the /override "charge_current" property should be deleted if there's other props on the /override ( but "auto_release" ), or the whole /override claim should be deleted if it's the only property ( but "auto_release" ).
4/ if Divert is active aka eco mode, number.openevse_charge_rate action should be disabled. as it will override divert "charge_current" claim ( override has bigger priority than divert service )
Additional information
No response
The text was updated successfully, but these errors were encountered: