diff --git a/install.ps1 b/install.ps1 index acc6f4b..93b1e5b 100644 --- a/install.ps1 +++ b/install.ps1 @@ -197,11 +197,16 @@ def run_ocr(cp): alert_pct = cp.getfloat("watcher", "alert_pct", fallback=95.0) reset_pct = cp.getfloat("watcher", "reset_pct", fallback=50.0) cooldown = cp.getint("watcher", "cooldown_secs", fallback=120) + # stall = hold not growing -> lasers/drones stopped (depleted rock, idle drones) + stall_secs = cp.getint("watcher", "stall_secs", fallback=150) print(f"[ocr] watching region={region} every {poll}s; " - f"alert>={alert_pct}% reset<{reset_pct}%") + f"alert>={alert_pct}% reset<{reset_pct}% stall>{stall_secs}s") armed = True last_alert = 0.0 + last_cur = -1 + last_grow = time.time() + last_stall_alert = 0.0 while True: try: img = grab_region(region) @@ -213,11 +218,23 @@ def run_ocr(cp): print(f"[ocr] {cur}/{cap} m3 ({pct:.1f}%) armed={armed}") if pct < reset_pct: armed = True + # --- still mining? (hold should be growing) --- + if cur > last_cur: + last_grow = time.time() + last_cur = cur + if pct < alert_pct - 1 and time.time() - last_grow > stall_secs \ + and time.time() - last_stall_alert > cooldown: + notify(cp, "Mining stopped?", + f"Hold hasn't grown in {stall_secs}s at {pct:.0f}% — rock " + f"depleted, drones idle, or lasers offlined? Check.", + priority="high", tags="warning") + last_stall_alert = time.time() + # --- hold full --- if armed and pct >= alert_pct and \ time.time() - last_alert > cooldown: - notify(cp, "Retriever ore hold full", - f"Ore hold at {pct:.0f}% ({cur:,}/{cap:,} m3). " - f"Stop mining / unload.") + notify(cp, "Hold full — compress", + f"Hold at {pct:.0f}% ({cur:,}/{cap:,} m3). " + f"Compress / unload / swap.") armed = False last_alert = time.time() else: @@ -579,9 +596,10 @@ if (-not (Test-Path (Join-Path $dir "config.ini"))) { [watcher] mode = ocr poll_secs = 10 -alert_pct = 95 +alert_pct = 90 reset_pct = 50 cooldown_secs = 120 +stall_secs = 150 [ntfy] server = https://ntfy.sh @@ -615,9 +633,12 @@ ore_hold_m3 = 50000 yield_m3_per_min = 0 "@ | Set-Content -Path (Join-Path $dir "config.ini") -Encoding UTF8 - Write-Host "config.ini created. ntfy topic: $topic" } else { Write-Host "config.ini kept." } + Write-Host "config.ini created. ntfy topic: $topic" } else { Write-Host "config.ini kept (existing)." } if (-not (Get-Command python -ErrorAction SilentlyContinue)) { winget install --id Python.Python.3.12 -e --silent --accept-package-agreements --accept-source-agreements; $env:Path=[Environment]::GetEnvironmentVariable("Path","Machine")+";"+[Environment]::GetEnvironmentVariable("Path","User") } -python -m pip install --quiet windows-toasts 2>$null +python -m pip install --quiet windows-toasts mss pillow pytesseract 2>$null Get-Process pythonw -ErrorAction SilentlyContinue | Stop-Process -ErrorAction SilentlyContinue -foreach ($w in "eve_combat_watcher.py","eve_chat_watcher.py") { Start-Process pythonw -ArgumentList "`"$dir\$w`"" -WorkingDirectory $dir -WindowStyle Hidden; Write-Host "started $w" } -Write-Host ""; Write-Host "Done. Watchers running -> phone + Discord. ntfy topic: $topic" \ No newline at end of file +$ws = @("eve_combat_watcher.py","eve_chat_watcher.py") +if ((Get-Content (Join-Path $dir "config.ini")) -match "^region\s*=\s*\S") { $ws += "eve_orehold_watcher.py" } +foreach ($w in $ws) { Start-Process pythonw -ArgumentList "`"$dir\$w`"" -WorkingDirectory $dir -WindowStyle Hidden; Write-Host "started $w" } +Write-Host ""; Write-Host "Done. Watchers running -> phone + Discord. ntfy topic: $topic" +Write-Host "For live compress + stall alerts, run once: python eve_orehold_watcher.py --snip (box your hold m3), then re-run this." \ No newline at end of file