import { connectStation, fetchLoopData } from "./davis.js"; let station = null; async function connect() { station = await connectStation(); } async function update() { try { const data = await fetchLoopData(station); console.log( `[${data.time.toLocaleTimeString("de-DE", { hour12: false })}] ` + `Außen: ${data.tempOut?.toFixed(1)}°C ` + `Feuchte: ${data.humOut}% ` + `Wind: ${data.windAvg} km/h` ); } catch (e) { console.error("Fehler:", e.message); try { await station?.disconnect(); } catch {} station = null; try { await connect(); } catch {} } setTimeout(update, 30000); } await connect(); update();