Computer controls for a ka3005d power supply, with a systemd background service to keep the serial connection alive. It listens to IPC calls for commands from the pixie-cli.
My power supply is sitting slightly too far away from my lazy ass. Instead of getting up I made a widget for in my i3status-rs bar to toggle the output. While I was writing this project I realized having a separate service also opens up the possibility for some cool embedded integration-tests.
Caution
This repo contains the worst rust code you will ever read, I cobbled this together in one evening, but will def improve on it.
[[block]]
block = "custom"
command = "~/.local/bin/pixie-cli status"
interval = 1
[[block.click]]
button = "left"
cmd = "~/.local/bin/pixie-cli toggle"The bar only refreshes every 1 sec, and I haven't found a way to make it faster :(
prek, just, cargo (duhh), text-editor, keyboard, 0.5L mate, monitor (I use a 12 inch 4:3, but you could go smaller), lungs (gotta keep breathing)
Currently there is no installer script or anything like that, so here I'll list the manual steps to get it up and running.
Files in the right place.
# this will copy the binaries into your ~/.local/bin.
just install
# create a local ~/.local/share/systemd/user/ and copy the service into it.
just serviceSystemd commands.
# enable the service
systemctl --user enable pixie-controller
# start it
systemctl --user start pixie-controller
# check status
systemctl --user status pixie-controller
# tail the logs
journalctl --user -u pixie-controller -f- Build system for multiple bins
- Rename bins to:
pixie-controller,pixie-cli. - Send IPC commands to server.
- Remove ambiguity around the type of socket we're using, enfore the UNIX specific one.
- Support output status
- Handle the interpretation of the output from the psu (the emoji for example) on the
cliside. - Wrap default commands?
-
pixie-clierror whenpixie-controlleris not online. - Keep listening for new connection when PSU power cycles.
- Improve logging especially in the
pixie-controller. - in
pixie-cliprint to stdout. - Improve code A LOT and release to AUR.
- Config file?
This will take in the exact same commands as the ka3005p crate. But instead of calling the serial port we wrap that and call the pixie-controller through IPC.
A daemon which listens for IPC, and runs the actual command through the serial port. Then passes the result back through IPC.