little udpate

This commit is contained in:
Karl 2021-01-10 11:10:47 +00:00
parent dc97e5fe62
commit 421b6ff7e1
3 changed files with 4 additions and 4 deletions

View File

@ -16,7 +16,7 @@ module.exports = {
}
}
try {
response = await got('https://public.wcs.schneider-electric.ws/rpc/public_genie/' + url, options);
let response = await got('https://public.wcs.schneider-electric.ws/rpc/public_genie/' + url, options);
const res = JSON.parse(response.body)
logger.debug(url + " - ZONES - " + res.updateData.zones.length)
if (res.updateData.zones.length < 2) {
@ -25,7 +25,7 @@ module.exports = {
return res
} catch (error) {
logger.warn('-- post error --');
logger.crit(JSON.stringify(response))
logger.crit(JSON.stringify(error))
logger.warn('-- post error --');
}
}

View File

@ -6,7 +6,7 @@ let logger = require('perfect-logger')
module.exports = function (app) {
app.post("/water/switch", async function (req, res, next) {
logger.debug('POST - /water/switch - START')
if (req.body.switch === 1) {
if (req.body.switch === "1") {
logger.debug('POST - /water/switch - ON - START')
try {
await post.postRequest('{"zoneId":[1],"setPoint": 255,"durationMinutes": 90}', 'apply_timer')
@ -22,7 +22,7 @@ module.exports = function (app) {
} catch (error) {
logger.warn('POST - /water/switch - ON - FAILED')
}
} else if (req.body.switch === 0) {
} else if (req.body.switch === "0") {
try {
logger.debug('POST - /water/switch - OFF - START')
await post.postRequest('{"zoneId":[1]}', 'cancel_timer')