dotfiles
dotfiles copied to clipboard
Get printer toner and paper level over network
The Brother app can do it...
https://github.com/samhh/dotfiles/commit/c8b85177165b9db331b0a8668b640c85a9b83c32
Experimenting with media-ready for the paper level.
Not had a chance to test this yet, so for redundancy:
diff --git a/home/scripts/printer-toner.sh b/home/scripts/printer-toner.sh
index 9ad5073..a3ed061 100755
--- a/home/scripts/printer-toner.sh
+++ b/home/scripts/printer-toner.sh
@@ -1,6 +1,16 @@
#!/bin/sh
-n=$(ipptool -tv ipp://BRW7440BBBDE8DC/BINARY_P1 get-printer-attributes.test | grep marker-levels | cut -d = -f 2 | xargs)
+data=$(ipptool -tv ipp://BRW7440BBBDE8DC/BINARY_P1 get-printer-attributes.test)
-echo "Printer toner: $n% remaining"
+toner_perc=$(echo "$data" | grep marker-levels | cut -d = -f 2 | xargs)
+
+# Don't know if this changes upon running out of paper, needs verifying
+if echo "$data" | grep -q 'media-ready (keyword) = iso_a4_210x297mm'; then
+ paper_available="Paper is available."
+else
+ paper_available="WARNING: No paper is available."
+fi
+
+echo "$paper_available"
+echo "Printer toner: $toner_perc% remaining"
Edit: No luck.
https://www.pwg.org/ipp/ippguide.html