flobz / psa_car_controller

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

Should "-R" be used with caution? #755

Open gernot-h opened 9 months ago

gernot-h commented 9 months ago

After having read @0x3dlux's comment https://github.com/Stellantis/stellantis.github.io/issues/128#issuecomment-1918860979, I wonder if there should be a warning to use "-R" with caution? Or a recommendation to not use values smaller than ?? mins?

If I get this comment right, requesting data refresh every 15 mins drained the 12V battery of his Corsa which in turn caused severe issues ("malfunction of high power relays") - some experience I don't want to make...

0x3dlux commented 9 months ago

That seems like an awesome great idea 😉 I suggest to warn below a value of 15.

In the early days I had -R at 5mins. Afaict each refresh keeps the car awake for at least one minute, probably more like 2. My wife usually noticed when she left the car in the evening with the car's radio on track #1 that the next morning (15 hours or around 180 wakeups later) the radio would be on like track 30~40. So polling the car wakes up pretty much everything. It's like switching on the ignition for much longer than a tiny GSM packet needs to be transmitted.

A polling frequency of 5mins means that the car is awake for at least 5 hours per day. And from experience I can tell that this will lead to the car dying (two slow deaths) after 4~5 days of not driving/charging it. Since the car is back from the garage I've dialed -R down to 15mins which in theory should allow us to leave the car abandoned for around 2 weeks. The Corsa is now also equipped with https://www.amazon.de/gp/product/B00ZETXNAQ/ and I didn't notice any drop below 12.2V since we got the car back.

What about that MQTT stuff I saw there in the code? Didn't look much into that but could we maybe rely on that to have realtime updates of SoC, voltage, odometer etc. pushed?

0x3dlux commented 9 months ago

(oh, I got the numbers wrong in that other post - it was indeed every 5mins back then and the stay-awake time is more like 2mins, not 10, edited)

Matssa56 commented 9 months ago

Instead of the -R, why not wait for something to change? From what I can see, when I take the car out I get some messages from stellantis so no need to refresh. If I want to force refresh I'll request a wakeup.

I'm mostly doing this when charging with my wallbox : force wakeup every 30min until I reach 5% under my threshold in order to avoid going to much above (since the threshold API doesn't work that well). I'll have to test the API again, maybe I don't need to refresh that much.

gernot-h commented 9 months ago

By the way, for my Opel Astra L PHEV, I noticed this bit in the Stellantis packages:

2024-02-13 08:21:31,584 :: DEBUG :: response body: {"createdAt":...,"updatedAt":...,"lastPosition":{...},"engines":[...],"ignition":{...},"battery":{"voltage":97.0,"createdAt":"2024-02-12T13:17:01Z"}...}

I wonder whether this battery is the 12V battery we're talking about? It's definitely not the main high-voltage battery which is reported in the element energies later on.

I didn't monitor this for a longer period so far, but in the last couple of days, the battery value varied between 96 and 100, independent of the high-voltage battery.

gernot-h commented 9 months ago

By the way, for my Astra L PHEV, I noticed this bit in the Stellantis packages:

I didn't find this value in the psa_car_controller web UI, but it's also available via the psacc REST API http://127.0.0.1:5000/get_vehicleinfo/VXKF3DGXTNxxxxxxx?from_cache=1:

grafik

0x3dlux commented 9 months ago

I don't think they're monitoring the 12V battery's voltage at all and I'm pretty sure this is the actual voltage of the traction battery. The "level" under "energy" is the SoC in percent and both don't seem to be directly related. I've been tracking both values in my custom smart home thingie since the car came back from the garage and I also saw values of around 100V there in the API before it broke down. Blue is the voltage, yellow the SoC (both divided by 2 in order to cram unrelated stats into the same graph), red is the house's power consumption (divided by 100).

image

It happens pretty much all the time that the voltage goes down very slowly while the SoC stays constant. However while driving the car (while the SoC goes down) the voltage actually goes back up to some seemingly configurable threshold value. I'm not quite sure how they achieve this but there seems to be some kind of rebalancing taking place while driving, maybe some cells are electrically rotated in and out of the whole pack?

Since my OAuth workaround the API doesn't seem to provide anything live anymore while charging. That is until the SoC reaches the final "top up phase" (where consumption drops to about half) so it takes until 95+% until the API provides live values again and recharging looks like one big step on the graphs now instead of a bunch of gradual stairs. But after unplugging the car the values keep on flowing again as normal. Not sure why this is but it's good enoughâ„¢ for me for now.

Also my workaround doesn't seem to have fixed actually starting/stopping/delaying the charge yet. My controlling script still provokes an error 400 inside psacc when it tries to configure a delayed charge schedule. On the graph above you see how both times the charge wasn't delayed until I set it to 1AM by hand via the app both times. So it looks like we somehow have an old and a new API now to talk to and then also some MQTT broker for another fraction of all possible commands (?). What a sad mess this is 😞

image

What I find kind of curious is that our Corsa's original battery was also hovering around 100V and our replacement battery is now constantly hovering in the upper 70, lower 80 range. The battery is reporting an SoH of 97% so it seems kind of obvious they didn't provide a proper, new battery when they fixed the car. It doesn't seem to have lost any power though and range also doesn't seem to have degraded considerably beyond what can be explained by lower temparatures. I was also watching these voltages take a slow dive down to 70, 60, 50V days before the car died with "Systemfehler Elektroantrieb" and while it was sitting in the garage the API even provided numbers below 10 before they unplugged (or let die) the 12V.

gernot-h commented 9 months ago

Hmm, I should probably monitor the PV battery of our house more closely and see how voltage relates to SoC there, but I would really have expected to see a clear relation between both and as we lack to do so, I would conclude from your graphs that battery doesn't describe the high-voltage battery.

Also, I'm quite sure they monitor the state of the 12V battery in my Astra PHEV as the manual describes different energy savings scenarios dependent on the battery SoC and I'm quite sure they're referring to the 12V battery there.

While they name it voltage, it could still be a percentage value, no? Also 100V doesn't make much sense for my car at least as https://www.ifz-berlin.de/ret_eng_pdf/eng_ov_astra_l_hyb_hatch.pdf speaks about a "400 V Li-Ion" battery.

If I get your comment right, you noticed the value dropping to nearly 0 for the 2nd break-down, so for me, this also would indicate we're not speaking about high-voltage battery or was this also replaced in your car?

About the different APIs: I'm quite sure there have to be several of them as e.g. the Android app would NOT show me the position of the car if e.g. my wife is driving and my phone is/was not connected to the car. (Which I thought would be a nice privacy feature until I noticed that) psacc is always reporting the car position independent whether the phone is connected...

0x3dlux commented 9 months ago

Hmm, ok, that adds some serious doubt to my assumption that this is about the traction battery at all.

If I get your comment right, you noticed the value dropping to nearly 0 for the 2nd break-down, so for me, this also would indicate we're not speaking about high-voltage battery or was this also replaced in your car?

The high voltage battery is the only thing they replaced, apparently. After the 1st breakdown I got the car fixed myself by topping the 12V battery back up from 4,5V (after ~1 week of non-usage). The 2nd time it was "only" down to 5.5V after ~5 days of non-usage but this time recharging it ended in the infamous "Systemfehler". I didn't watch the "voltage" values closely yet back then since I assumed they were kind of redundant with energy.level but I remember they were always hovering 100.

So yes, the 12V has suffered from deep-discharge at least 2-3 times and it would indeed kind of make sense that it's capacity would've dropped from 100% to 80%. If "voltage" is supposed to represent some percentage between, say, 10 and 14.4V this would indeed make a whole lot of sense. And if we consider that the API probably adds some averaging then the graphs even match up with what my Bluetooth monitor picks up. The tall peaks of 14,5V are when the car is being driven, the flat ones are when it's being AC charged.

Screenshot_20240213-115807_Battery Check

This is week 3 after we got the car back from the garage, after that I lost interest since everything seemed to be working fine again. The monitor has a few months of internal buffer and it's still connected to the battery so I should probably sync with the phone again once the car is back this evening.

psacc is always reporting the car position independent whether the phone is connected...

Yes, no matter what you set in the GDPR settings: whenever you stop the car the full GPS coordinates are submitted to Stellantis. psacc just forwards what their API provides. They disable the tracking features inside the Android app at least when you have the GDPR setting switched off yet they seem to have forgotten that the coordinates still show up in the API or that they are being submitted to Stellantis in the first place. If a lawyer is reading along: I think here's some money to be made ;)

gernot-h commented 8 months ago

There's also an interesting discussion on 12 V battery levels reported by psacc (in HA) in #765.