From 421b6ff7e117f0ec12cfca2db76fe8a3a0f7fc1e Mon Sep 17 00:00:00 2001 From: Karl Date: Sun, 10 Jan 2021 11:10:47 +0000 Subject: [PATCH] little udpate --- UpdateBot.sh => deployDocker.sh | 0 lib/post.js | 4 ++-- routes/water_post.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) rename UpdateBot.sh => deployDocker.sh (100%) diff --git a/UpdateBot.sh b/deployDocker.sh similarity index 100% rename from UpdateBot.sh rename to deployDocker.sh diff --git a/lib/post.js b/lib/post.js index d870331..d823de6 100644 --- a/lib/post.js +++ b/lib/post.js @@ -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 --'); } } diff --git a/routes/water_post.js b/routes/water_post.js index 50d8437..09c5351 100644 --- a/routes/water_post.js +++ b/routes/water_post.js @@ -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')