water log
This commit is contained in:
parent
dcfac6bbeb
commit
5fa7d1d4db
22
package-lock.json
generated
22
package-lock.json
generated
@ -96,9 +96,9 @@
|
||||
"integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg=="
|
||||
},
|
||||
"cacheable-lookup": {
|
||||
"version": "4.2.3",
|
||||
"resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-4.2.3.tgz",
|
||||
"integrity": "sha512-NdruD8iCwUSqPeacly+fxbi71wjPuIbh9wsBhLdRmpXDFPgQtX+xWytveqDyFYQ1tDR5POAxH4jIkkoit3arXw=="
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-4.3.0.tgz",
|
||||
"integrity": "sha512-PTUoCeIjj2awloqyVRUL33SjquU1Qv5xuDalYY8WAzd9NnUMUivZnGsOzVsMfg2YuMsWXaXkd/hjnsVoWc/3YA=="
|
||||
},
|
||||
"cacheable-request": {
|
||||
"version": "7.0.1",
|
||||
@ -286,19 +286,19 @@
|
||||
}
|
||||
},
|
||||
"got": {
|
||||
"version": "11.1.1",
|
||||
"resolved": "https://registry.npmjs.org/got/-/got-11.1.1.tgz",
|
||||
"integrity": "sha512-7WxfuTyT02hMZZdDvaAprEoxsU13boxI8rWMpqk/5Mq6t+YVbExVB2L6yRLh2Nw3TeJyFpanId41+ZyXGesmbw==",
|
||||
"version": "11.1.2",
|
||||
"resolved": "https://registry.npmjs.org/got/-/got-11.1.2.tgz",
|
||||
"integrity": "sha512-ywWJU8STgxsWaPRC61HgqNYGboJFgkVNNbga+C4xJR67cySTskU8XehWWRMnWCtDmmaYU5SVoMAXP+SuY4pNsA==",
|
||||
"requires": {
|
||||
"@sindresorhus/is": "^2.1.0",
|
||||
"@szmarczak/http-timer": "^4.0.0",
|
||||
"@sindresorhus/is": "^2.1.1",
|
||||
"@szmarczak/http-timer": "^4.0.5",
|
||||
"@types/cacheable-request": "^6.0.1",
|
||||
"@types/responselike": "^1.0.0",
|
||||
"cacheable-lookup": "^4.1.1",
|
||||
"cacheable-lookup": "^4.3.0",
|
||||
"cacheable-request": "^7.0.1",
|
||||
"decompress-response": "^5.0.0",
|
||||
"get-stream": "^5.0.0",
|
||||
"http2-wrapper": "^1.0.0-beta.4.4",
|
||||
"get-stream": "^5.1.0",
|
||||
"http2-wrapper": "^1.0.0-beta.4.5",
|
||||
"lowercase-keys": "^2.0.0",
|
||||
"p-cancelable": "^2.0.0",
|
||||
"responselike": "^2.0.0"
|
||||
|
@ -17,7 +17,7 @@
|
||||
"body-parser": "^1.19.0",
|
||||
"express": "^4.17.1",
|
||||
"fs": "0.0.1-security",
|
||||
"got": "^11.1.1",
|
||||
"got": "^11.1.2",
|
||||
"perfect-logger": "^2.0.1"
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ module.exports = function (app) {
|
||||
app.post("/water/switch", async function (req, res, next) {
|
||||
logger.info('POST - /water/switch - START')
|
||||
if (req.body.switch === 1) {
|
||||
logger.info('POST - /heating/switch - ON - START')
|
||||
logger.info('POST - /water/switch - ON - START')
|
||||
try {
|
||||
await post.postRequest('{"zoneId":[1],"setPoint": 255,"durationMinutes": 90}', 'apply_timer')
|
||||
const response = await post.postRequest('{}', 'poll')
|
||||
@ -17,14 +17,14 @@ module.exports = function (app) {
|
||||
let waterStatus = {
|
||||
"waterOn": JSON.stringify(on),
|
||||
}
|
||||
logger.info('POST - /heating/switch - ON - COMPLETE')
|
||||
logger.info('POST - /water/switch - ON - COMPLETE')
|
||||
res.json(waterStatus)
|
||||
} catch (error) {
|
||||
logger.warn('POST - /heating/switch - ON - FAILED')
|
||||
logger.warn('POST - /water/switch - ON - FAILED')
|
||||
}
|
||||
} else if (req.body.switch === 0) {
|
||||
try {
|
||||
logger.info('POST - /heating/switch - OFF - START')
|
||||
logger.info('POST - /water/switch - OFF - START')
|
||||
await post.postRequest('{"zoneId":[1]}', 'cancel_timer')
|
||||
const response = await post.postRequest('{}', 'poll')
|
||||
const water = response.updateData.zones[1].status
|
||||
@ -33,18 +33,18 @@ module.exports = function (app) {
|
||||
let waterStatus = {
|
||||
"waterOn": JSON.stringify(on),
|
||||
}
|
||||
logger.info('POST - /heating/switch - OFF - COMPLETE')
|
||||
logger.info('POST - /water/switch - OFF - COMPLETE')
|
||||
res.json(waterStatus)
|
||||
} catch (error) {
|
||||
logger.warn('POST - /heating/switch - OFF - FAILED')
|
||||
logger.warn('POST - /water/switch - OFF - FAILED')
|
||||
}
|
||||
} else {
|
||||
logger.warn('POST - /heating/switch - FAILED')
|
||||
logger.warn('POST - /water/switch - FAILED')
|
||||
}
|
||||
});
|
||||
|
||||
app.post("/water/status", async function (req, res, next) {
|
||||
logger.info('POST - /heating/status - START')
|
||||
logger.info('POST - /water/status - START')
|
||||
const response = await post.postRequest('{}', 'poll')
|
||||
const water = response.updateData.zones[1].status
|
||||
const on = await common.heatingOn(water)
|
||||
@ -55,7 +55,7 @@ module.exports = function (app) {
|
||||
"lastTimerSetPoint": JSON.stringify(water.lastTimerSetPoint),
|
||||
"lastTimerDurationMinutes": JSON.stringify(water.lastTimerDurationMinutes)
|
||||
}
|
||||
logger.info('POST - /heating/status - END')
|
||||
logger.info('POST - /water/status - END')
|
||||
res.json(waterStatus)
|
||||
});
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user