"use client"; import React, { useState, useEffect } from "react"; export default function UtilitiesPage() { const [firstEnergyUser, setFirstEnergyUser] = useState(""); const [firstEnergyPass, setFirstEnergyPass] = useState(""); const [peoplesGasUser, setPeoplesGasUser] = useState(""); const [peoplesGasPass, setPeoplesGasPass] = useState(""); const [status, setStatus] = useState(""); useEffect(() => { fetch('/proxy/utility/api/credentials') .then(r => r.json()) .then(data => { if (data.success) { setFirstEnergyUser(data.firstEnergyUser || ""); setPeoplesGasUser(data.peoplesGasUser || ""); } }) .catch(console.error); }, []); const handleSave = async (e) => { e.preventDefault(); setStatus("Saving..."); try { const res = await fetch('/proxy/utility/api/credentials', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ firstEnergyUser, firstEnergyPass, peoplesGasUser, peoplesGasPass }) }); const data = await res.json(); if (data.success) { setStatus("✅ Credentials saved securely."); setFirstEnergyPass(""); setPeoplesGasPass(""); } else { setStatus("❌ Failed to save."); } } catch (err) { setStatus("❌ Network error."); } }; const handleRun = async () => { setStatus("Starting scraper..."); try { await fetch('/proxy/utility/api/run', { method: 'POST' }); setStatus("✅ Scraper triggered in background!"); } catch (e) { setStatus("❌ Failed to run scraper."); } }; return (

Utility Agent Configuration

The Utility Agent securely automates retrieving your daily energy and gas usage data. It uses these credentials locally in your private cluster and sends a summary to your WhatsApp gateway.

{/* FirstEnergy */}

FirstEnergy

setFirstEnergyUser(e.target.value)} style={{ width: "100%", padding: "12px 16px", borderRadius: "8px", border: "1px solid rgba(255,255,255,0.1)", background: "rgba(0,0,0,0.5)", color: "white", outline: "none", fontSize: "0.95rem" }} /> setFirstEnergyPass(e.target.value)} style={{ width: "100%", padding: "12px 16px", borderRadius: "8px", border: "1px solid rgba(255,255,255,0.1)", background: "rgba(0,0,0,0.5)", color: "white", outline: "none", fontSize: "0.95rem" }} />
{/* Peoples Gas */}

🔥 Peoples Gas

setPeoplesGasUser(e.target.value)} style={{ width: "100%", padding: "12px 16px", borderRadius: "8px", border: "1px solid rgba(255,255,255,0.1)", background: "rgba(0,0,0,0.5)", color: "white", outline: "none", fontSize: "0.95rem" }} /> setPeoplesGasPass(e.target.value)} style={{ width: "100%", padding: "12px 16px", borderRadius: "8px", border: "1px solid rgba(255,255,255,0.1)", background: "rgba(0,0,0,0.5)", color: "white", outline: "none", fontSize: "0.95rem" }} />
{status &&
{status}
}
); }