Skip to content

pi-sugar

Makers of raspberry pi compatible hardware, including uninterruptible power supplies, tiny displays, and full pwnagotchi kits.

PiSugar 3

Note: The PiSugar 3 Plus I bought looked like its screw holes were slightly misaligned, but the pogo pins were able to align even though they seemed to be misaligned from the screw holes.

CLI usage

You can interact with the pi-sugar through a websocket connection running on the pisugar-server. For an interactive shell, run nc 127.0.0.1 8423. Examples of one-off commands are below.

$ echo "help" | nc -q 0 127.0.0.1 8423
Usage: <COMMAND>

Commands:
  get
  set_battery_keep_input
  set_battery_charging_range
  set_battery_input_protect
  set_battery_output
  set_full_charge_duration
  set_allow_charging
  set_rtc_addr
  rtc_clear_flag
  rtc_pi2rtc
  rtc_rtc2pi
  rtc_web
  rtc_alarm_set
  rtc_alarm_disable
  rtc_adjust_ppm
  set_safe_shutdown_level
  set_safe_shutdown_delay
  rtc_test_wake
  set_button_enable
  set_button_shell
  set_auto_power_on
  set_auth
  force_shutdown
  set_anti_mistouch
  set_soft_poweroff
  set_soft_poweroff_shell
  set_input_protect
  help                        Print this message or the help of the given subcommand(s)

Further help is available with help <verb>

$ echo "get battery" | nc -q 0 127.0.0.1 8423
battery: 79.52635
$ echo "get battery_charging" | nc -q 0 127.0.0.1 8423
battery_charging: true

The websocket stream also shows "single", "double", and "long" for interactions with the secondary button.