flobz / psa_car_controller

Control psa car with connected_car v4 API.
GNU General Public License v3.0
422 stars 222 forks source link

Is it possible to get the current charge limit setting from the car? #912

Open ChrisJ60 opened 3 months ago

ChrisJ60 commented 3 months ago

The API allows you to set the charge limit (for example to 80%), which is great! Is there any means to get the current setting of the charge limit in the car?

Thanks.

antoniochacon commented 3 months ago

As far as I know, its not possible. I wrote simple code to estimate the hours need to reach it.

ChrisJ60 commented 3 months ago

Ah, that's a shame. I guess this call to PSACC:

http://psaccurl:5000/charge_control?vin=myvin&always_check=true

is just returning the last limit the was set (as remembered by PSACC)?

ChrisJ60 commented 3 months ago

Also, not exactly PSACC related but on the off-chance that you may know... Is the chargelimit set in the car or just the PSA backend? And when charging, is the limit enforced by the car itself or by the PSA backend? It seems from recent experience that it is the latter in both cases but it would be great to know for sure (if car is not communicating to PSA backend car charges to 100% even though limit was set to 80%). Do you happen to know?

LeoAlioth commented 1 week ago

Charge limit is enforced by psacc, utilizing a delayed charge function of the car. psacc estimates when car will reach the set charge limit, and calls stellantis api to delay charging.

ChrisJ60 commented 1 week ago

Charge limit is enforced by psacc, utilizing a delayed charge function of the car. psacc estimates when car will reach the set charge limit, and calls stellantis api to delay charging.

Hmmm. So I wonder why it is no longer working for me. PSACC is working and communicating with the car via the Stellantis backend but when I set the car to delayed start charging (using the button in the car's charge port) it always charges overnight to 100% despite me having set an 80% limit in PSACC. Any ideas how to troubleshoot this? I don't see anything of relevance in the PSA activity log.

ChrisJ60 commented 1 week ago

Looking at my Home Assistant logs it seems that the issue is that the car's SOC, as reported by PSACC, does not change while charging is in progress; rather it suddenly updates to 100% when charging ends. I don't know if that is an issue with the car not reporting the changes, PSACC not passing them through our my HA <-> PSACC integration. I guess I need to investigate more, if I can figure out how...

LeoAlioth commented 1 week ago

car does not initiate data updates while ac charging. for this reason the wakeup command exists. it is supposed to occasinally force SOC uptate to determine when to stop (delay) the charge.

ChrisJ60 commented 1 week ago

Wow, that is kind of dumb behaviour on the part of Peugeot. Sigh. So I guess I need to wake the car every 5-10 minutes using the wakeup command during the time I know that it is charging. Do you know if Peugeot or the car imposes any limits on the number or frequency of wakeup calls?

LeoAlioth commented 1 week ago

yep, it does. from what people say waking it every 30 minutes works fine, but anything much more frequent gets terminated

ChrisJ60 commented 1 week ago

Wow, 30 mins is almost equal to 10% SoC when charging at 7 kW. I guess that is the maximum accuracy of any charging threshold then...

LeoAlioth commented 1 week ago

that is why you estimate ahead on when the car will reach desired SOC, and wake it only when approaching charge limit to verify if you are ready to complete the charge. If i am not mistaken, the psacc logic should do that by default anyway.

ChrisJ60 commented 1 week ago

Yes, I thought that it should do that., It worked for us once when we first got the car but it hasn't;t worked since; every charge goes to 100% and from HA data I can see that the sensors are not updating, likely because the car is not being woken up. Why that should be I do not know but I am now implementing something along the lines of what you suggest in HA to see if that works better.