Jump to content
Jason (ABRP)

[Live Data] AutoPi Car Support

Recommended Posts

The AutoPi ABRP script is to a point where I'm much happier with its behavior.  If there's interest, I'd be happy to add car support for the cars we know PIDs for (mainly Ioniq and Soul), but I need people with AutoPi and those cars to test the script to make sure it works.  Reply here if you'd like to be a guinea pig for that work.

Benefits to the AutoPi:

  • Standalone car data - get notified when done charging, or find your car in a crowded parking lot.
  • WiFi Hotspot in your car
  • Quick update rate - get very accurate calibration

I'm also open to helping add support for any other vehicles whose OBD/CAN PIDs are known.  I haven't yet spent much time on learning how to reverse engineer the CAN traffic, so that's a little out of my grasp so far.

Link to the ABRP AutoPi Repository: https://github.com/iternio/autopi-link

Share this post


Link to post
Share on other sites

Do you already have a working ABRP script for your Ioniq? If so I can start from that to add support if you give me a copy, otherwise I'll get the script updated to tentatively support the Ioniq and let you know when it's done.

Share this post


Link to post
Share on other sites

First of all I apologize for my bad English.
I didn't write a script. I'm using the https://github.com/iternio/autopi-link/blob/master/my_abrp.py and I configured my vehicle with Kona 39Kwh which was the most similar I had. But I don't think it's working. If you have one I can test and send feedback. You just have to tell me how to do it and give instructions. Another thing, whenever I access the link for Autopi, the Tokken changes. This is normal?

Share this post


Link to post
Share on other sites

@vag, @TheRussian - Working with @Joaquim Lopes we've identified what seems to be a better pid to report charging status on his Ioniq:

        'is_charging':"220,101,int(not {51:2}),7E4", # 1=charging 0=not charging

Could you check and see if this works for the Kona/Niro too, or if it's a new behavior of the Ioniq's BMS which I need a special case for?

Share this post


Link to post
Share on other sites

I've updated the script in a way which should help startup times (assuming it's a still-running, sleeping, copy of the script from the last wake/sleep cycle).  Assuming the ABRP script is the one which put the device to sleep due to inactivity from the car, it will self-quit in the 10 minute go-to-sleep window.

Would appreciate if someone who was experiencing slow wakeups could check the behavior and see if it's still happening with this version:

https://github.com/iternio/autopi-link/blob/master/my_abrp.py

Share this post


Link to post
Share on other sites

Meaning you see a charging status in the ABRP app when you plug the car in and it shows charging?

Are there any other scenarios where the app shows a charge session active, but your car is not actually charging?  @Joaquim Lopes was noting that PID went active when it would turn the car on to charge the 12V battery.

Share this post


Link to post
Share on other sites
On 5/20/2020 at 1:18 PM, Jason (ABRP) said:

Meaning you see a charging status in the ABRP app when you plug the car in and it shows charging?

Are there any other scenarios where the app shows a charge session active, but your car is not actually charging?  @Joaquim Lopes was noting that PID went active when it would turn the car on to charge the 12V battery.

I think this only happens in cars that have the function Baterry Saver +. Someone with this function active and that report "false charge" appears?

Share this post


Link to post
Share on other sites
3 hours ago, Joaquim Lopes said:

I think this only happens in cars that have the function Baterry Saver +. Someone with this function active and that report "false charge" appears?

One option would be for me to set a certain power threshold for "is_charging" to take effect.  Would <1kW be sufficient to discard false charges?

Also, I did some experimenting with my AutoPi in my car, timing boot-ups, and I don't think there's really anything I can do.  The first time the Cron Job is called is about 2:30 after I saw the hotspot appear.  I guess I never really noticed because I always get my AC on remotely before I load up my family into the car and drive, so the AutoPi always seems to be booted up by the time I start actually driving.

Share this post


Link to post
Share on other sites
7 hours ago, Jason (ABRP) said:

One option would be for me to set a certain power threshold for "is_charging" to take effect.  Would <1kW be sufficient to discard false charges?

Also, I did some experimenting with my AutoPi in my car, timing boot-ups, and I don't think there's really anything I can do.  The first time the Cron Job is called is about 2:30 after I saw the hotspot appear.  I guess I never really noticed because I always get my AC on remotely before I load up my family into the car and drive, so the AutoPi always seems to be booted up by the time I start actually driving.

Hi Jason,

I don't think this is happening in battery saver +, because in that case the current flows out of the HV battery through the DcDc to charger the 12V battery or to operate heaters and so on... The charging power PID should report 0kW and the battery power PID should a positive power (instead it is negative when you're charging/regenerating), so:

- if you use charging power PID, this is 0kW in battery saver, no need to use a threshold

- if you use battery power PID, this is >0kW in battery saver, no need to use a threshold (greater than 0 already means that you're not charging)

I don't know if I could explain well, in case of further info just ask.

About the boot, have you checked the "Ruin on startup" flag? I've enabled this on my script and it boots up without the delays you're experiencing.

On 5/20/2020 at 2:18 PM, Jason (ABRP) said:

Meaning you see a charging status in the ABRP app when you plug the car in and it shows charging?

I can't see charging icon in ABRP whjile charging with my current script, I'll update to yours and let you know as soon as I test it.

Share this post


Link to post
Share on other sites
Posted (edited)

Hi Jason,

I've tested the script and it finally works for me. My comments below:

- Quick start, as expected, no strange delays: as soon as AutoPi boots up, ABRP gets the first value, then it updates roughly every 5 seconds regularly.

- During charging (notice that I made a single test), the icon changes and it displays the power, it seems the update interval is a lot slower (as intended) but not really 30-100 secs (I had some connectivity issue with the mobile carrier in my AutoPi SIM in the area in the past, maybe that's the reason, but I'm reporting it anyway).

- After charging though, the system went to sleep too early: I stopped charging, disconnected cable, put the cable in the trunk, got into the car and when I turned the vehicle on the system had to boot again, in roughly 2 minutes, before getting real time data again. Which is the sleep timer delay in this case?

If I'm charging again in the next week I'll let you know how it goes. Thanks for the good job!

Edited by TheRussian

Share this post


Link to post
Share on other sites
On 5/22/2020 at 8:23 AM, TheRussian said:

Hi Jason,

I've tested the script and it finally works for me. My comments below:

- Quick start, as expected, no strange delays: as soon as AutoPi boots up, ABRP gets the first value, then it updates roughly every 5 seconds regularly.

Great! Although nothing I changed should really change that... I checked with the AutoPi devs and I think it just takes a while to start Cron Jobs sometimes.  I'm working with them to find a way to ensure we get started faster most of the time, and then eventually I want to add the capability to support Plugins, since each __salt__ call seems to take quite a while, and having lots of scripts running simultaneously really bogs you down.

On 5/22/2020 at 8:23 AM, TheRussian said:

- During charging (notice that I made a single test), the icon changes and it displays the power, it seems the update interval is a lot slower (as intended) but not really 30-100 secs (I had some connectivity issue with the mobile carrier in my AutoPi SIM in the area in the past, maybe that's the reason, but I'm reporting it anyway).

Yes, this is intended, it should go once every 100 seconds (give or take, due to the length of the __salt__ calls) while charging unless the data is meaningfully different (IE, if soc/power/is_charging have changed):

    min_changed = ["soc","power","is_charging"]
    should_send = False
    for param in min_changed:
      if param in data and param   in last_data and data[param] != last_data[param]:
        should_send = True
        break
    if "is_charging" in data and data["is_charging"] and time.time() - last_data_time > 100:
      should_send = True
    elif "is_charging" in data and not data["is_charging"] and time.time() - last_data_time > 30:
      should_send = True
    elif last_data == {}:
      should_send = True
On 5/22/2020 at 8:23 AM, TheRussian said:

- After charging though, the system went to sleep too early: I stopped charging, disconnected cable, put the cable in the trunk, got into the car and when I turned the vehicle on the system had to boot again, in roughly 2 minutes, before getting real time data again. Which is the sleep timer delay in this case?

If I'm charging again in the next week I'll let you know how it goes. Thanks for the good job!

Every minute it re-checks status, and if it thinks it should be awake it resets a 10 minute sleep timer.  So from the last time you have a non-zero power, speed, or is_charging reading, it should stay awake for 10 minutes.  If you'd like to investigate more, and see exactly why you could set debug=True on the kwargs, and tail the minion log while SSH'd into the AutoPi:

sudo tail -f /var/log/salt/minion | grep ABRP

You might have to reboot the Pi or touch the ABRP script to force it to reload:

touch /opt/autopi/salt/modules/my_abrp.py

 

Share this post


Link to post
Share on other sites
On 5/23/2020 at 4:47 PM, Jason (ABRP) said:

Yes, this is intended, it should go once every 100 seconds (give or take, due to the length of the __salt__ calls) while charging unless the data is meaningfully different (IE, if soc/power/is_charging have changed)

I've done another test this morning, I can confirm that during this test the charging power and SOC are updated correctly, so it must have been something else than your script (maybe carrier coverage or something).

I'll keep you posted as soon as I run some more tests overall, but the script seems to work very well now. 😄

  • Thanks 1

Share this post


Link to post
Share on other sites

Hi Jason,

I did another couple of charging tests and I noticed the following: when AutoPi shuts down  when charging ends and then it goes to sleep, the icon in ABRP stays in charging mode, displaying the last SOC and Power values while charging. At the first vehicle driving after charging, the icon disappears, as the script calculates again in driving mode.

Let me know if you agree and can find the root cause!

Share this post


Link to post
Share on other sites
4 hours ago, TheRussian said:

Hi Jason,

I did another couple of charging tests and I noticed the following: when AutoPi shuts down  when charging ends and then it goes to sleep, the icon in ABRP stays in charging mode, displaying the last SOC and Power values while charging. At the first vehicle driving after charging, the icon disappears, as the script calculates again in driving mode.

Let me know if you agree and can find the root cause!

Ah, is this with the most recent version of the script where I cut off the is_charging marker at 0.5kW to avoid phantom charge events?  Bet there's some very low power battery conditioning still going on, so it should probably stay awake for a little longer to catch the tail end of that.  I've pushed a new version of the script which lowers the sleep tolerance to 0.01kW, or you can just change line 202 from:

if 'power' in data and round(data['power']) != 0:

To:

if 'power' in data and abs(data['power']) > 0.01:

Which will have the same effect. 

Share this post


Link to post
Share on other sites

Not the version you updated 8 hours ago, it's with the previous one.

It seems like the system keeps the last value (it was 2.2kW) before AutoPi goes off and then it's not updated anymore. ABRP stayed in charging at 80% SOC and 2.2 kW for 3 hours, even if the car was not charging and AutoPi was off, then it reset as soon as I started a new driving.

Edited by TheRussian

Share this post


Link to post
Share on other sites

Huh, interesting, if the last charge rate was 2.2kW, it should have stayed awake.  What did the log on the AutoPi say about why it went to sleep? Perhaps a critical power event, 12V battery voltage got too low?

My Autopi > Advanced > Events

Share this post


Link to post
Share on other sites

Maybe I wasn't able to explain well, let me try again: 😅

- the car ended up charging session upon reaching 80% SOC: the power went from 2.2kW to 0kW, AutoPi stopped normally after the sleep timer, etc.

- everything was ok, except the fact that in ABRP website/app there was a display of 2.2kW and charging icon

- it seems like the script didn't send to ABRP the end of charging session, even if it should have done it.

Maybe it's more clear now, let's discuss again if you need more details.

Share this post


Link to post
Share on other sites
7 hours ago, TheRussian said:

Maybe I wasn't able to explain well, let me try again: 😅

- the car ended up charging session upon reaching 80% SOC: the power went from 2.2kW to 0kW, AutoPi stopped normally after the sleep timer, etc.

- everything was ok, except the fact that in ABRP website/app there was a display of 2.2kW and charging icon

- it seems like the script didn't send to ABRP the end of charging session, even if it should have done it.

Maybe it's more clear now, let's discuss again if you need more details.

When you say you saw the power go from 2.2kW to 0kW, where did you see that? In ABRP or in AutoPi's interface, or somewhere else?

Share this post


Link to post
Share on other sites

 

1 hour ago, Jason (ABRP) said:

When you say you saw the power go from 2.2kW to 0kW, where did you see that? In ABRP or in AutoPi's interface, or somewhere else?

I saw it both in AutoPi interface and in vehicle dashboard. Could it be a persistance in ABRP website/app?

I'm going to make some more statistics for you in the next charging sessions. 😄

Edited by TheRussian

Share this post


Link to post
Share on other sites
9 hours ago, TheRussian said:

 

I saw it both in AutoPi interface and in vehicle dashboard. Could it be a persistance in ABRP website/app?

I'm going to make some more statistics for you in the next charging sessions. 😄

I have an idea on this, when I thought it was possibly a "zombie" copy of the script running I introduced an auto-quit call in the manage_sleep function.  This would cause the ABRP script to potentially miss a lot of data in the period where the charge is ending, as it's dying and restarting multiple times (intentionally).  I've since reverted that change since it didn't do anything useful.

Does your current version of the script have:

    else:
      # Kill script, gives us 60 seconds to wait and check again.
      safelog("Car not active, retrying in 60 seconds", always=True)
      os._exit(1)

At line 206-209? If so, update to the most recent version from the GitHub.  I really need AutoPi to come up with a better way to share user scripts so you get notified when I update.  If we have to we'll build something into the ABRP app.

If not I'll need to think on it more.

Share this post


Link to post
Share on other sites
On 5/28/2020 at 3:54 AM, Jason (ABRP) said:

At line 206-209? If so, update to the most recent version from the GitHub.  I really need AutoPi to come up with a better way to share user scripts so you get notified when I update.  If we have to we'll build something into the ABRP app.

Actually I don't: the script is probably not the latest version, but it doesn't have any kill feature of that kind in it.

Yesterday my AutoPi was updated to the latest software build, so now I'm on 2020.05.27 build. Which AutoPi build are you on?

Share this post


Link to post
Share on other sites

I just got that version yesterday evening, haven't driven my car in a while so had to actually turn it on for a bit to get the AutoPi to take the update.  Annoying that jobs seem to be prevented from running while it's staging the update.

I'll be taking it for a drive today, have to get groceries, so will see how everything performs now on the new update.

Share this post


Link to post
Share on other sites
1 hour ago, Jason (ABRP) said:

Annoying that jobs seem to be prevented from running while it's staging the update.

Yes, indeed! I was about to reply to you that everything stopped working, then I checked AutoPi and saw the update. After updating, I did a couple of drives today and your script still works fine.

Testing charging sessions again in the next days. In the meantime I could update to your latest ABRP script release, but in case you plan some modifications I'll hold on before updating.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


Contact Us

Bo - Lead Developer and Tesla owner: bo@abetterrouteplanner.com

Jason - New Car Models, Developer and Bolt owner : jason@abetterrouteplanner.com

Idreams - Forums Administrator, Forums Developer and Tesla owner : idreams@abetterrouteplanner.com

×
×
  • Create New...