-
Notifications
You must be signed in to change notification settings - Fork 4
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
Some API tweaking for openevse integration. #394
Comments
As I understand it the override API is just a single setting, and calling it again should just add to the override that's in place currently. As for the claims, a similar thing as long as the
This shouldn't be too hard. |
/override endpoint is an abstraction of /claim endpoint but only for "manual override" service id. When you create an override you can see it in /claim endpoint too. For the claims, yes it should only consider the properties of the same service ID you use of course. |
Looking at the code for python-openevse-http/openevsehttp/__main__.py Lines 776 to 811 in 6cc39e5
I'm only adjusting the claim the library makes and only adjusting whatever variables are passed, but that only piles on the current claim then I assume right or would it wipe what's currently in the claim and use what's been passed to it? |
On OpenEvse each time you make a new claim with same service ID or an override, you have to resend all the properties yes. |
Thanks for confirming. |
To illustrate, here is a short video of the consequencies of this issue: openevse2.mp4 |
Hi @firstof9 , I saw your "fix_claims" branch, is it testable yet ? |
That branch was because I forgot I had technically fixed it in the integration 😆 |
I thought it was to fix this , the lost properties when making a claim/override |
I thought it was working correctly with the integration now? Is that not the case? |
nope it still removes the previous properties. To reproduce: Send an override to set the state to Active or Disabled depending of your default state. |
Ah ok then yes, the fix_claims branch will fix that. |
Ok you should be able to modify the |
Great, looks good here. 👍 :) 2 things:
I still get the websocket error posted on the other thread when restarting HA, just posting it here as it's more related to the library than the integration I think.
Seems it tried to reconnect 244 times in 1 sec. this one has only 1 occurencie:
Full debug log here: https://pastebin.com/GiBTQ6hX |
It's actually the integration, again, I'm not sure how you are reaching that message, I cannot reproduce it.
I'll see what I can do.
I'll take a look at that too. What service are you calling to toggle these? |
I use set override for this.
I'm using dev builds but I don't see any changes on the API, will try with 5.1.2 |
Just tested, it's ok with 5.1.2 but not with dev builds. edit: false alert. Got it with 5.1.2 also... Calling set_override from dev tools / action throws this error:
|
This branch will catch the error: https://github.com/firstof9/openevse/tree/key-check |
When calling set override I get this alert on UI: in the log:
This line looks suspicious: [custom_components.openevse.services] Device_entry: DeviceEntry(area_id='garage', config_entries={'01JJ4VKJ7BGNTWN4BFD6PNF2MT', '01JC9Q0JN4GKXMN9K6VPGQFYW7'}, configuration_url='http://192.168.1.8/', connections={('openevse', '01J7BSHM4CWTVBXH5978MGEAMR'), ('openevse', '01JJ4VKJ7BGNTWN4BFD6PNF2MT')}, created_at=datetime.datetime(1970, 1, 1, 0, 0, tzinfo=datetime.timezone.utc), disabled_by=None, entry_type=None, hw_version=None, id='1a8619b7019b8e42ea0f560a0c008fc0', identifiers={('openevse', '9C9C1FD9D8E8')}, labels=set(), manufacturer='OpenEVSE', model='openevse_wifi_v1', model_id=None, modified_at=datetime.datetime(2025, 2, 4, 16, 58, 8, 505522, tzinfo=datetime.timezone.utc), name_by_user=None, name='openevse', primary_config_entry='01JJ4VKJ7BGNTWN4BFD6PNF2MT', serial_number=None, suggested_area=None, sw_version='master_d8a3474c', via_device_id=None, is_new=False, _cache={'json_repr': b'{"area_id":"garage","configuration_url":"http://192.168.1.8/","config_entries":["01JJ4VKJ7BGNTWN4BFD6PNF2MT","01JC9Q0JN4GKXMN9K6VPGQFYW7"],"connections":[["openevse","01J7BSHM4CWTVBXH5978MGEAMR"],["openevse","01JJ4VKJ7BGNTWN4BFD6PNF2MT"]],"created_at":0.0,"disabled_by":null,"entry_type":null,"hw_version":null,"id":"1a8619b7019b8e42ea0f560a0c008fc0","identifiers":[["openevse","9C9C1FD9D8E8"]],"labels":[],"manufacturer":"OpenEVSE","model":"openevse_wifi_v1","model_id":null,"modified_at":1738688288.505522,"name_by_user":null,"name":"openevse","primary_config_entry":"01JJ4VKJ7BGNTWN4BFD6PNF2MT","serial_number":null,"sw_version":"master_d8a3474c","via_device_id":null}'}) Why would I have multiple config_entries ? |
Custom components override built in, did you have the built in one installed at some point? |
Yes when I've first installed HA and then saw it was the wrong integration and installed yours. Do you know how I can clean this up ? Don't even know where is it stored. edit: I've checked in .config/core.config_entries , but I see only one entry for Openevse:
I've found in core.device_registry:
Doesn't seems to be because of native integration, because I see entities in core.entity_registry for booth 01JJ4VKJ7BGNTWN4BFD6PNF2MT and 01J7BSHM4CWTVBXH5978MGEAMR that are not present in native integration. |
anyway, I've cleaned up my setup mess :) removed the integration, removed the hacs repo too, reinstalled it. Was not this easy, no idea how it could happend. probably by testing dev branches over the hacs installation. Thanks for your support. About my previous comment:
Forget this one. It seems Openevse firmware now do like this too, setting Auto clear the current limit so let's keep it this way. edit: too bad, I still have a problem at startup or when reloading the integration. set override commands works, but the websocket doesn't connect. It doesn't catch this error with the "key-check" branch.
|
I'll catch that one as well, I'll update it in the morning. |
Changes pushed. |
Here is it: diagnostic: https://pastebin.com/jcppc9xW HA journal:
complete debug log: In the complete log, you can see it fails at startup, then after a while ws connects ok. |
Thanks I see the problem, just an order of operations thing. |
All good sir 👍 fixed |
Following up #402, I create an issue here as its more appropriated.
1/ If a claim or an override is already present, API should add the property on it, instead of creating a new claim/override with only the latest property.
example: EVSE is manually set to enabled, user change the charge_rate, it then just create a new override with only "charge_current" , state is removed.
should instead create a new override with "charge_current" and "state"
2/ Same as above, If a claim/override have more than one property ( but auto_release ), removing a property should keep the other properties but not delete the claim/override. If there's only one property, it then should remove the override/claim.
3/ setting charge rate to its max value ( aka "max_current_soft" ) should remove the charge_current property from the override if there's other properties, or remove the override if there's only the "charge_current" one.
In all cases, it should not consider "auto_release" if set to "true" , as this one is always added to a claim/override by default. You can just ignore this property like it does on OpenEVSE UI side as there's no use case for override. But probably better to test the boolean state and just ignore it if it's true.
The text was updated successfully, but these errors were encountered: