Compare commits
No commits in common. "14e9a4b9326cefee55b5321bfdca0a97602b05e1" and "1aa56bb8dd139cd946fb39be409ab61b2d26c421" have entirely different histories.
14e9a4b932
...
1aa56bb8dd
1
.gitignore
vendored
1
.gitignore
vendored
@ -110,4 +110,3 @@ dist
|
|||||||
|
|
||||||
# TernJS port file
|
# TernJS port file
|
||||||
.tern-port
|
.tern-port
|
||||||
package-lock.json
|
|
||||||
|
@ -36,30 +36,6 @@ export class State {
|
|||||||
communicator.send(config.mqtt.topics.auger, JSON.stringify(this.auger));
|
communicator.send(config.mqtt.topics.auger, JSON.stringify(this.auger));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.pof = {
|
|
||||||
on: false,
|
|
||||||
name: "pof",
|
|
||||||
topic: config.mqtt.topics.pof,
|
|
||||||
publisher: 'backend',
|
|
||||||
power: (communicator) => {
|
|
||||||
// This *should* toggle the state, asks if state is true, if it is set it false, otherwise set it true
|
|
||||||
this.pof.on ? this.pof.on = false : this.pof.on = true;
|
|
||||||
communicator.send(config.mqtt.topics.pof, JSON.stringify(this.pof));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
this.vacuum = {
|
|
||||||
on: false,
|
|
||||||
name: "vacuum",
|
|
||||||
topic: config.mqtt.topics.vacuum,
|
|
||||||
publisher: 'backend',
|
|
||||||
power: (communicator) => {
|
|
||||||
// This *should* toggle the state, asks if state is true, if it is set it false, otherwise set it true
|
|
||||||
this.vacuum.on ? this.vacuum.on = false : this.vacuum.on = true;
|
|
||||||
communicator.send(config.mqtt.topics.vacuum, JSON.stringify(this.vacuum));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
console.log(`State initialized.`)
|
console.log(`State initialized.`)
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -7,18 +7,14 @@ const config = {
|
|||||||
"topics": {
|
"topics": {
|
||||||
"igniter": "hestia/status/igniter",
|
"igniter": "hestia/status/igniter",
|
||||||
"exhaust": "hestia/status/exhaust",
|
"exhaust": "hestia/status/exhaust",
|
||||||
"auger": "hestia/status/auger",
|
"auger": "hestia/status/auger"
|
||||||
"pof": "hestia/status/pof",
|
|
||||||
"vacuum": "hestia/status/vacuum"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"states": {
|
"states": {
|
||||||
"elements": [
|
"elements": [
|
||||||
"igniter",
|
"igniter",
|
||||||
"exhaust",
|
"exhaust",
|
||||||
"auger",
|
"auger"
|
||||||
"pof",
|
|
||||||
"vacuum"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -29,8 +25,6 @@ export function refreshState(doc, state) {
|
|||||||
const igniterStatus = doc.getElementById("igniter-status");
|
const igniterStatus = doc.getElementById("igniter-status");
|
||||||
const exhaustStatus = doc.getElementById("exhaust-status");
|
const exhaustStatus = doc.getElementById("exhaust-status");
|
||||||
const augerStatus = doc.getElementById("auger-status");
|
const augerStatus = doc.getElementById("auger-status");
|
||||||
const pofStatus = doc.getElementById("pof-status");
|
|
||||||
const vacuumStatus = doc.getElementById("vacuum-status");
|
|
||||||
let statusString;
|
let statusString;
|
||||||
|
|
||||||
statusString = '';
|
statusString = '';
|
||||||
@ -44,15 +38,6 @@ export function refreshState(doc, state) {
|
|||||||
statusString = '';
|
statusString = '';
|
||||||
if (state.auger.on) statusString = "On"; else statusString = "Off";
|
if (state.auger.on) statusString = "On"; else statusString = "Off";
|
||||||
augerStatus.innerHTML = statusString;
|
augerStatus.innerHTML = statusString;
|
||||||
|
|
||||||
statusString = '';
|
|
||||||
if (state.pof.on) statusString = "On"; else statusString = "Off";
|
|
||||||
pofStatus.innerHTML = statusString;
|
|
||||||
|
|
||||||
statusString = '';
|
|
||||||
if (state.vacuum.on) statusString = "On"; else statusString = "Off";
|
|
||||||
vacuumStatus.innerHTML = statusString;
|
|
||||||
|
|
||||||
console.log('State refreshed.');
|
console.log('State refreshed.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,16 +43,6 @@
|
|||||||
<td class="py-2 px-4">Auger</td>
|
<td class="py-2 px-4">Auger</td>
|
||||||
<td class="py-2 px-4" id="auger-status">Placeholder</td>
|
<td class="py-2 px-4" id="auger-status">Placeholder</td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- PoF -->
|
|
||||||
<tr>
|
|
||||||
<td class="py-2 px-4">PoF</td>
|
|
||||||
<td class="py-2 px-4" id="pof-status">Placeholder</td>
|
|
||||||
</tr>
|
|
||||||
<!-- Vacuum -->
|
|
||||||
<tr>
|
|
||||||
<td class="py-2 px-4">Vacuum</td>
|
|
||||||
<td class="py-2 px-4" id="vacuum-status">Placeholder</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<div class="button-container flex">
|
<div class="button-container flex">
|
||||||
|
Loading…
Reference in New Issue
Block a user