2020-05-08 09:43:01 +01:00

33 lines
1.2 KiB
JavaScript

const post = require('../lib/post')
const common = require('../lib/common')
module.exports = function (app) {
app.get("/heating", async function (req, res, next) {
const response = await post.postRequest()
const heating = response.updateData.zones[0]
res.json(heating)
});
app.get("/heating/status", async function (req, res, next) {
const response = await post.postRequest()
const heating = response.updateData.zones[0].status
const mrt = await common.updateTemp(heating)
const on = await common.heatingOn(heating)
let heatingStatus = {
"heatingOn": JSON.stringify(on),
"measuredRoomTemp": mrt,
"currentSetpoint": JSON.stringify(heating.currentSetpoint),
"lastTimerSetPoint": JSON.stringify(heating.lastTimerSetPoint),
"lastTimerDurationMinutes": JSON.stringify(heating.lastTimerDurationMinutes)
}
res.json(heatingStatus)
});
app.get("/heating/config", async function (req, res, next) {
const response = await post.postRequest()
const heating = response.updateData.zones[0].config
res.json(heating)
});
}