2020-05-07 22:12:45 +01:00
|
|
|
const post = require('../lib/post')
|
2020-05-08 12:51:45 +01:00
|
|
|
const common = require('../lib/common')
|
2020-05-07 22:12:45 +01:00
|
|
|
|
|
|
|
|
module.exports = function (app) {
|
|
|
|
|
app.get("/water", async function (req, res, next) {
|
|
|
|
|
const response = await post.postRequest()
|
|
|
|
|
const water = response.updateData.zones[1]
|
|
|
|
|
res.json(water)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
app.get("/water/status", async function (req, res, next) {
|
|
|
|
|
const response = await post.postRequest()
|
|
|
|
|
const water = response.updateData.zones[1].status
|
2020-05-08 12:51:45 +01:00
|
|
|
const on = await common.heatingOn(water)
|
|
|
|
|
|
|
|
|
|
let waterStatus = {
|
|
|
|
|
"waterOn": JSON.stringify(on),
|
|
|
|
|
"currentSetpoint": JSON.stringify(water.currentSetpoint),
|
|
|
|
|
"lastTimerSetPoint": JSON.stringify(water.lastTimerSetPoint),
|
|
|
|
|
"lastTimerDurationMinutes": JSON.stringify(water.lastTimerDurationMinutes)
|
|
|
|
|
}
|
|
|
|
|
res.json(waterStatus)
|
2020-05-07 22:12:45 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
app.get("/water/config", async function (req, res, next) {
|
|
|
|
|
const response = await post.postRequest()
|
|
|
|
|
const water = response.updateData.zones[1].config
|
|
|
|
|
res.json(water)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|