58 lines
2.0 KiB
JavaScript
Raw Normal View History

2020-09-14 18:42:09 +01:00
const http = require('http')
const globalVars = require('../libs/globalVars')
const led = require('../libs/led')
const common = require('../libs/common')
const screen = require('../libs/lcd')
2020-09-21 21:38:46 +01:00
var requireDir = require('require-dir');
var modules = requireDir('../modules');
2020-09-14 18:42:09 +01:00
module.exports = {
2020-09-28 10:50:23 +01:00
home: async () => {
2020-09-14 18:42:09 +01:00
clearInterval(globalVars.waterPolling);
2020-09-28 10:50:23 +01:00
clearInterval(globalVars.heatingPolling)
clearInterval(globalVars.piHolePolling)
await screen.clearScreen()
await screen.heading('Main Menu')
await screen.clearLine(2)
await screen.clearLine(3)
await screen.clearLine(4)
await screen.time()
2020-09-14 18:42:09 +01:00
},
2020-09-28 10:50:23 +01:00
water: async () => {
clearInterval(globalVars.waterPolling);
clearInterval(globalVars.heatingPolling)
clearInterval(globalVars.piHolePolling)
await screen.clearScreen()
await screen.heading('Hot Water')
await screen.time()
await modules.water.getStatus()
2020-09-14 18:42:09 +01:00
globalVars.waterPolling = setInterval(() => {
2020-09-21 21:38:46 +01:00
modules.water.getStatus()
}, 60000);
},
2020-09-28 10:50:23 +01:00
heating: async () => {
clearInterval(globalVars.waterPolling);
clearInterval(globalVars.heatingPolling)
clearInterval(globalVars.piHolePolling)
await screen.clearScreen()
await screen.heading('Heating')
await screen.time()
await modules.heating.getStatus(globalVars.heatingPageS)
globalVars.heatingPolling = setInterval(async () => {
await modules.heating.getStatus(globalVars.heatingPageS)
2020-09-21 21:38:46 +01:00
}, 60000);
2020-09-28 10:50:23 +01:00
},
piHole: async () => {
clearInterval(globalVars.waterPolling);
clearInterval(globalVars.heatingPolling)
clearInterval(globalVars.piHolePolling)
await screen.clearScreen()
await screen.heading('PiHole')
await screen.time()
await modules.pihole.getStatus()
globalVars.piHolePolling = setInterval(() => {
modules.pihole.getStatus()
}, 30000);
2020-09-14 18:42:09 +01:00
}
}