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-29 10:23:41 +01:00
|
|
|
common.clearPolling()
|
|
|
|
common.clearGlobalVars()
|
2020-09-28 10:50:23 +01:00
|
|
|
await screen.clearScreen()
|
2020-09-29 10:23:41 +01:00
|
|
|
await screen.heading('Home')
|
2020-09-28 10:50:23 +01:00
|
|
|
await screen.clearLine(2)
|
|
|
|
await screen.clearLine(3)
|
|
|
|
await screen.clearLine(4)
|
|
|
|
await screen.time()
|
2020-09-28 11:12:35 +01:00
|
|
|
await modules.weather.getStatus()
|
2020-09-29 10:23:41 +01:00
|
|
|
globalVars.weatherPolling = setInterval(() => {
|
|
|
|
modules.weather.getStatus()
|
|
|
|
}, 1800000);
|
2020-09-14 18:42:09 +01:00
|
|
|
},
|
2020-09-28 10:50:23 +01:00
|
|
|
water: async () => {
|
2020-09-29 10:23:41 +01:00
|
|
|
common.clearPolling()
|
|
|
|
common.clearGlobalVars()
|
2020-09-28 10:50:23 +01:00
|
|
|
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 () => {
|
2020-09-29 10:23:41 +01:00
|
|
|
common.clearPolling()
|
|
|
|
common.clearGlobalVars()
|
2020-09-28 10:50:23 +01:00
|
|
|
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 () => {
|
2020-09-29 10:23:41 +01:00
|
|
|
common.clearPolling()
|
|
|
|
common.clearGlobalVars()
|
2020-09-28 10:50:23 +01:00
|
|
|
await screen.clearScreen()
|
|
|
|
await screen.heading('PiHole')
|
|
|
|
await screen.time()
|
|
|
|
await modules.pihole.getStatus()
|
|
|
|
globalVars.piHolePolling = setInterval(() => {
|
|
|
|
modules.pihole.getStatus()
|
|
|
|
}, 30000);
|
2020-09-28 11:12:35 +01:00
|
|
|
},
|
2020-09-14 18:42:09 +01:00
|
|
|
}
|