Edge1 power control

Which system do you use? Android, Ubuntu, OOWOW or others?

Ubuntu 18.04.6 LTS

Which version of system do you use? Khadas official images, self built images, or others?

Ubuntu 18.04.6 LTS Khadas official images

Please describe your issue below:

I try to make robot on khadas platform. On my robot I have master power button. This button connect and disconnect USB C PD line to battery. Also I use Juice v12 Board for safety power off and emergency power. I need to switch on khadas when master button is on and I have power on USB C PD line. Also i need correctly switch off khadas (like shutdown in terminal) when master button is off and I have not power on USB C PD line.

How it work now.

Power no

Khadas is setup WON option. Some device in robot send WON command to khadas every minute. Khadas switch on by WON command.

Power off

I wrote script in python. this script look at /sys/class/power_supply/bq25700-charger/online and write to terminal shutdown now

How can I make my system more correct? I will to switch on and off by USB C PD. I need switch off regularly like shutdown now.