publish eve_orehold_watcher.py

This commit is contained in:
brockdarnold 2026-06-15 04:26:08 +00:00
parent 6506fa06e7
commit 19ed799e40

View file

@ -624,6 +624,26 @@ def main():
notify(cp, "Eve watcher test",
"If you got this on phone + toast, delivery works.")
return
if "--read" in sys.argv: # one-shot: print current hold cur/cap/%
import pytesseract
tcmd = cp.get("ocr", "tesseract_cmd", fallback="").strip()
if tcmd:
pytesseract.pytesseract.tesseract_cmd = tcmd
rs = cp.get("ocr", "region", fallback="").strip()
region = [int(x) for x in rs.split(",")] if rs else auto_region(cp)
if not region:
print("READ none — Ore Hold readout not visible (open your Ore Hold window)")
return
img = grab_region(region)
img = img.resize((img.width * 2, img.height * 2))
text = pytesseract.image_to_string(img, config="--psm 7")
parsed = parse_orehold_text(text)
if parsed:
cur, cap = parsed
print(f"READ {cur}/{cap} m3 ({100.0*cur/cap:.1f}%)")
else:
print(f"READ fail — raw OCR={text!r}")
return
mode = cp.get("watcher", "mode", fallback="ocr").strip().lower()
print(f"=== eve_orehold_watcher starting (mode={mode}) ===")
heartbeat(cp, "orehold")