Is there any precaution to consider before unplugging an AutoPi

Suppose that I want to use my AutoPi with multiple cars. Is there an appropriate way of unplugging the AutoPi and minimize possible filesystem corruption. I assume that one recommendation is to turn the car engine off prior to disconnecting the unit. Is there any delay to wait before disconnecting it? Do we have to ssh in the Pi and initiate a shutdown command or simply open terminal and do a power.hibernate command?

Having look under the hood, it seems that there is a capacitor on the AutoPi that technically can provide enough time before discharging and allow the AutoPi to shutdown properly in case of power failure (AutoPi disconnected from the ODB connector). If it’s the case then it’s probably the answer to my question.

Hi Sylvain

After turning of the engine, the device will keep awake for 30 minutes, and then go to sleep.
So ideally you’d wait for it to go to sleep, but you could also connect to the hotspot and then issue the following command in the local terminal.

power.sleep confirm=true

This will tell it to go to sleep the same way it will after inactivity (30 mins after engine off)
But it will also check for any updates, so it may take longer than expected.

Alternatively, you can use this instead, but this has a few gotchas (see below)


cmd.run 'poweroff'

This will turn it off, nothing else, but if you do it this way, you need to make sure to unplug the device and plug it in again, before it will start monitoring when the car is started.
But that’s not a problem if you do the above shutdown because you want to move the device to another car.

And for both ways to shut it off, you need to wait for the green light to go out.

We have done a bunch of optimisations to reduce the risk of a corrupted memory card, and we have been pretty tough on our test devices, and we have yet to see a corrupted card.
But I would still shut it down before unplugging, if possible, to not tempt fate.
Also I’m pretty sure i just jinxed it pretty badly… so…

Best regards
/ Malte

It is sometimes confusing , being in the terminal and still getting response from the terminal while the AutoPi is already powered off.

For example, if you reissue poweroff command while the AutoPi is already shut down, you get the following results:

cmd.run 'poweroff’
An error occurred. Received Unknown Error from server.

OR

cmd.run 'poweroff’
Timeout has occured
_To increase timeout (in seconds): timeout=60

Just remember that the terminal is running on the client side, same as where the Browser is running.

To emphasis on what you already mention :

For both ways to shut it off, you need to wait for the green light to go out.

Hi @stherien,

Excellent comments. Thank you. We love to get feedback in improvements.

An idea could also be to add a message in the client side reply in the terminal, to check/verify if the device is online.

We will see if we can do something to make it more “user friendly”.

Best
Peter