The 3.x firmware documentation doesn’t help, BUT for those who would like to know, taken from: https://forum.gl-inet.com/t/gl-mfi-gpio-how-to-read-battery-status/7246/8, “on my GL-XE300, you should manually run /usr/bin/xe300_mcu to get /tmp/mcu_data”, i.e. the GL.iNet XE300 Puli battery status is written to file /tmp/mcu_data by executing /usr/bin/xe300-mcu.
So at the bash cmdline on my XE300:
$ /usr/bin/xe300-mcu; /bin/cat /tmp/mcu_data ; /bin/echo “”
{“T”:37.5,“P”:100,“C”:1,“N”:0}
$
Therefore in a bash script on my XE300:
battery_status=$(/usr/bin/xe300-mcu; /bin/cat /tmp/mcu_data)
battery_T=“$(/bin/echo ${battery_status} | /usr/bin/cut -d, -f1 | /usr/bin/cut -d: -f2)”
battery_P=“$(/bin/echo ${battery_status} | /usr/bin/cut -d, -f2 | /usr/bin/cut -d: -f2)”
battery_C=“$(/bin/echo ${battery_status} | /usr/bin/cut -d, -f3 | /usr/bin/cut -d: -f2)”
battery_N=“$(/bin/echo ${battery_status} | /usr/bin/cut -d, -f4 | /usr/bin/cut -d: -f2 | /usr/bin/cut -d} -f1)”
Now the XE300 router can be made to respond to a power failure in a graduated fashion according to its battery charge status and percentage charge, happy days, Brian
PS: Anyone know what ‘battery_N’ stands for?