import { Communicator,State } from './HestiaClasses.js'; window.onload = async function() { const config = await fetch('/assets/config.json') .then(response => { if (!response.ok) { throw new Error('Network response was not ok'); } }) .then(data => { console.log(data); // Use the JSON data here return data; }) .catch(error => { console.error('There was a problem with the fetch operation:', error); }); console.log(config); const psState = new State(config); refreshState(window.document, psState); }; function refreshState(doc, state) { const igniterStatus = doc.getElementById("igniterStatus"); const exhaustStatus = doc.getElementById("exhaustStatus"); const augerStatus = doc.getElementById("augerStatus"); let statusString; statusString = ''; if (state.igniter.on) statusString = "On"; else statusString = "Off"; igniterStatus.innerHTML = statusString; statusString = ''; if (state.exhaust.on) statusString = "On"; else statusString = "Off"; exhaustStatus.innerHTML = statusString; statusString = ''; if (state.auger.on) statusString = "On"; else statusString = "Off"; augerStatus.innerHTML = statusString; }