update logger
This commit is contained in:
parent
0ceb4d1bf6
commit
46ec5dd410
@ -7,7 +7,7 @@ module.exports = {
|
|||||||
mrt = mrt[0] + "." + mrt[1]
|
mrt = mrt[0] + "." + mrt[1]
|
||||||
return mrt
|
return mrt
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.info('Error')
|
logger.debug('Error')
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -21,7 +21,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
return on
|
return on
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.info('Error')
|
logger.debug('Error')
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
12
lib/post.js
12
lib/post.js
@ -1,6 +1,8 @@
|
|||||||
const got = require('got')
|
const got = require('got')
|
||||||
const token = require('basic-auth-token');
|
const token = require('basic-auth-token');
|
||||||
let logger = require('perfect-logger')
|
let logger = require('perfect-logger')
|
||||||
|
var cacheManager = require('cache-manager');
|
||||||
|
var memoryCache = cacheManager.caching({ store: 'memory', max: 100, ttl: 200/*seconds*/ });
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
postRequest: async (body, url) => {
|
postRequest: async (body, url) => {
|
||||||
@ -14,16 +16,16 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const response = await got('https://public.wcs.schneider-electric.ws/rpc/public_genie/' + url, options);
|
response = await got('https://public.wcs.schneider-electric.ws/rpc/public_genie/' + url, options);
|
||||||
const res = JSON.parse(response.body)
|
const res = JSON.parse(response.body)
|
||||||
logger.info(url + " - ZONES - " + res.updateData.zones.length)
|
logger.debug(url + " - ZONES - " + res.updateData.zones.length)
|
||||||
if (res.updateData.zones.length <2){
|
if (res.updateData.zones.length < 2) {
|
||||||
logger.info(JSON.stringify(res))
|
logger.debug(JSON.stringify(res))
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.warn('-- post error --');
|
logger.warn('-- post error --');
|
||||||
logger.crit(error)
|
logger.crit(JSON.stringify(response))
|
||||||
logger.warn('-- post error --');
|
logger.warn('-- post error --');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
39
package-lock.json
generated
39
package-lock.json
generated
@ -68,6 +68,11 @@
|
|||||||
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
|
||||||
"integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
|
"integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
|
||||||
},
|
},
|
||||||
|
"async": {
|
||||||
|
"version": "1.5.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz",
|
||||||
|
"integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo="
|
||||||
|
},
|
||||||
"basic-auth-token": {
|
"basic-auth-token": {
|
||||||
"version": "0.4.2",
|
"version": "0.4.2",
|
||||||
"resolved": "https://registry.npmjs.org/basic-auth-token/-/basic-auth-token-0.4.2.tgz",
|
"resolved": "https://registry.npmjs.org/basic-auth-token/-/basic-auth-token-0.4.2.tgz",
|
||||||
@ -95,6 +100,16 @@
|
|||||||
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
|
||||||
"integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg=="
|
"integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg=="
|
||||||
},
|
},
|
||||||
|
"cache-manager": {
|
||||||
|
"version": "3.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/cache-manager/-/cache-manager-3.3.0.tgz",
|
||||||
|
"integrity": "sha512-BH7pfWWZ6BYnkcj6759uWnTCwMz24LXI0PzribTP8WqpydHo9Jk6EM9itmG+rBXAJHbNOwo1ES49SIn8hyhW2A==",
|
||||||
|
"requires": {
|
||||||
|
"async": "1.5.2",
|
||||||
|
"lodash": "^4.17.15",
|
||||||
|
"lru-cache": "4.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"cacheable-lookup": {
|
"cacheable-lookup": {
|
||||||
"version": "4.3.0",
|
"version": "4.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-4.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-4.3.0.tgz",
|
||||||
@ -361,11 +376,25 @@
|
|||||||
"json-buffer": "3.0.1"
|
"json-buffer": "3.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"lodash": {
|
||||||
|
"version": "4.17.15",
|
||||||
|
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
|
||||||
|
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A=="
|
||||||
|
},
|
||||||
"lowercase-keys": {
|
"lowercase-keys": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz",
|
||||||
"integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA=="
|
"integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA=="
|
||||||
},
|
},
|
||||||
|
"lru-cache": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.0.0.tgz",
|
||||||
|
"integrity": "sha1-tcvwFVbBaWb+vlTO7A+03JDfbCg=",
|
||||||
|
"requires": {
|
||||||
|
"pseudomap": "^1.0.1",
|
||||||
|
"yallist": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"media-typer": {
|
"media-typer": {
|
||||||
"version": "0.3.0",
|
"version": "0.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
||||||
@ -464,6 +493,11 @@
|
|||||||
"ipaddr.js": "1.9.1"
|
"ipaddr.js": "1.9.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"pseudomap": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz",
|
||||||
|
"integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM="
|
||||||
|
},
|
||||||
"pump": {
|
"pump": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
|
||||||
@ -603,6 +637,11 @@
|
|||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
|
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
|
||||||
|
},
|
||||||
|
"yallist": {
|
||||||
|
"version": "2.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz",
|
||||||
|
"integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI="
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"basic-auth-token": "^0.4.2",
|
"basic-auth-token": "^0.4.2",
|
||||||
"body-parser": "^1.19.0",
|
"body-parser": "^1.19.0",
|
||||||
|
"cache-manager": "^3.3.0",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"fs": "0.0.1-security",
|
"fs": "0.0.1-security",
|
||||||
"got": "^11.1.2",
|
"got": "^11.1.2",
|
||||||
|
@ -4,17 +4,17 @@ let logger = require('perfect-logger')
|
|||||||
|
|
||||||
module.exports = function (app) {
|
module.exports = function (app) {
|
||||||
app.get("/heating", async function (req, res, next) {
|
app.get("/heating", async function (req, res, next) {
|
||||||
logger.info('GET - /heating - START')
|
logger.debug('GET - /heating - START')
|
||||||
const response = await post.postRequest('{}', 'poll')
|
const response = await post.postRequest('{}', 'poll')
|
||||||
const heating = response.updateData.zones[0]
|
const heating = response.updateData.zones[0]
|
||||||
logger.info('GET - /heating - END')
|
logger.debug('GET - /heating - END')
|
||||||
res.json(heating)
|
res.json(heating)
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/heating/status", async function (req, res, next) {
|
app.get("/heating/status", async function (req, res, next) {
|
||||||
logger.info('GET - /heating/status - START')
|
logger.debug('GET - /heating/status - START')
|
||||||
const response = await post.postRequest('{}', 'poll')
|
const response = await post.postRequest('{}', 'poll')
|
||||||
// logger.info(response.updateData)
|
// logger.debug(response.updateData)
|
||||||
const heating = response.updateData.zones[0].status
|
const heating = response.updateData.zones[0].status
|
||||||
const mrt = await common.updateTemp(heating)
|
const mrt = await common.updateTemp(heating)
|
||||||
const on = await common.heatingOn(heating)
|
const on = await common.heatingOn(heating)
|
||||||
@ -28,15 +28,15 @@ module.exports = function (app) {
|
|||||||
"lastTimerSetPoint": lsp,
|
"lastTimerSetPoint": lsp,
|
||||||
"lastTimerDurationMinutes": JSON.stringify(heating.lastTimerDurationMinutes)
|
"lastTimerDurationMinutes": JSON.stringify(heating.lastTimerDurationMinutes)
|
||||||
}
|
}
|
||||||
logger.info('GET - /heating/status - END')
|
logger.debug('GET - /heating/status - END')
|
||||||
res.json(heatingStatus)
|
res.json(heatingStatus)
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/heating/config", async function (req, res, next) {
|
app.get("/heating/config", async function (req, res, next) {
|
||||||
logger.info('GET - /heating/config - START')
|
logger.debug('GET - /heating/config - START')
|
||||||
const response = await post.postRequest('{}', 'poll')
|
const response = await post.postRequest('{}', 'poll')
|
||||||
const heating = response.updateData.zones[0].config
|
const heating = response.updateData.zones[0].config
|
||||||
logger.info('GET - /heating/config - END')
|
logger.debug('GET - /heating/config - END')
|
||||||
res.json(heating)
|
res.json(heating)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -5,15 +5,15 @@ let logger = require('perfect-logger')
|
|||||||
|
|
||||||
module.exports = function (app) {
|
module.exports = function (app) {
|
||||||
app.post("/heating", async function (req, res, next) {
|
app.post("/heating", async function (req, res, next) {
|
||||||
logger.info('POST - /heating - START')
|
logger.debug('POST - /heating - START')
|
||||||
const response = await post.postRequest('{}')
|
const response = await post.postRequest('{}')
|
||||||
const heating = response.updateData.zones[0]
|
const heating = response.updateData.zones[0]
|
||||||
logger.info('POST - /heating - END')
|
logger.debug('POST - /heating - END')
|
||||||
res.json(heating)
|
res.json(heating)
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post("/heating/status", async function (req, res, next) {
|
app.post("/heating/status", async function (req, res, next) {
|
||||||
logger.info('POST - /heating/status - START')
|
logger.debug('POST - /heating/status - START')
|
||||||
const response = await post.postRequest('{}', 'poll')
|
const response = await post.postRequest('{}', 'poll')
|
||||||
const heating = response.updateData.zones[0].status
|
const heating = response.updateData.zones[0].status
|
||||||
const mrt = await common.updateTemp(heating)
|
const mrt = await common.updateTemp(heating)
|
||||||
@ -28,7 +28,7 @@ module.exports = function (app) {
|
|||||||
"lastTimerSetPoint": lsp,
|
"lastTimerSetPoint": lsp,
|
||||||
"lastTimerDurationMinutes": JSON.stringify(heating.lastTimerDurationMinutes)
|
"lastTimerDurationMinutes": JSON.stringify(heating.lastTimerDurationMinutes)
|
||||||
}
|
}
|
||||||
logger.info('POST - /heating/status - END')
|
logger.debug('POST - /heating/status - END')
|
||||||
res.json(heatingStatus)
|
res.json(heatingStatus)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
13
routes/root_get copy.js
Normal file
13
routes/root_get copy.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
const post = require('../lib/post')
|
||||||
|
let logger = require('perfect-logger')
|
||||||
|
|
||||||
|
module.exports = function (app) {
|
||||||
|
app.get("/", async function (req, res, next) {
|
||||||
|
logger.debug('GET - / - START')
|
||||||
|
const response = await post.postRequest('{}', 'poll')
|
||||||
|
const heating = response
|
||||||
|
logger.debug('GET - / - END')
|
||||||
|
res.json(heating)
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
@ -4,15 +4,15 @@ let logger = require('perfect-logger')
|
|||||||
|
|
||||||
module.exports = function (app) {
|
module.exports = function (app) {
|
||||||
app.get("/water", async function (req, res, next) {
|
app.get("/water", async function (req, res, next) {
|
||||||
logger.info('GET - /water - START')
|
logger.debug('GET - /water - START')
|
||||||
const response = await post.postRequest('{}', 'poll')
|
const response = await post.postRequest('{}', 'poll')
|
||||||
const water = response.updateData.zones[1]
|
const water = response.updateData.zones[1]
|
||||||
logger.info('GET - /water - END')
|
logger.debug('GET - /water - END')
|
||||||
res.json(water)
|
res.json(water)
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/water/status", async function (req, res, next) {
|
app.get("/water/status", async function (req, res, next) {
|
||||||
logger.info('GET - /water/status - START')
|
logger.debug('GET - /water/status - START')
|
||||||
const response = await post.postRequest('{}', 'poll')
|
const response = await post.postRequest('{}', 'poll')
|
||||||
const water = response.updateData.zones[1].status
|
const water = response.updateData.zones[1].status
|
||||||
const on = await common.heatingOn(water)
|
const on = await common.heatingOn(water)
|
||||||
@ -23,20 +23,20 @@ module.exports = function (app) {
|
|||||||
"lastTimerSetPoint": JSON.stringify(water.lastTimerSetPoint),
|
"lastTimerSetPoint": JSON.stringify(water.lastTimerSetPoint),
|
||||||
"lastTimerDurationMinutes": JSON.stringify(water.lastTimerDurationMinutes)
|
"lastTimerDurationMinutes": JSON.stringify(water.lastTimerDurationMinutes)
|
||||||
}
|
}
|
||||||
logger.info('GET - /water/status - END')
|
logger.debug('GET - /water/status - END')
|
||||||
res.json(waterStatus)
|
res.json(waterStatus)
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/water/config", async function (req, res, next) {
|
app.get("/water/config", async function (req, res, next) {
|
||||||
logger.info('GET - /water/config - START')
|
logger.debug('GET - /water/config - START')
|
||||||
const response = await post.postRequest('{}', 'poll')
|
const response = await post.postRequest('{}', 'poll')
|
||||||
const water = response.updateData.zones[1].config
|
const water = response.updateData.zones[1].config
|
||||||
logger.info('GET - /water/config - END')
|
logger.debug('GET - /water/config - END')
|
||||||
res.json(water)
|
res.json(water)
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/water/switch", async function (req, res, next) {
|
app.get("/water/switch", async function (req, res, next) {
|
||||||
logger.info('GET - /water/switch - START')
|
logger.debug('GET - /water/switch - START')
|
||||||
const response = await post.postRequest('{}', 'poll')
|
const response = await post.postRequest('{}', 'poll')
|
||||||
const water = response.updateData.zones[1].status
|
const water = response.updateData.zones[1].status
|
||||||
let on = await common.heatingOn(water)
|
let on = await common.heatingOn(water)
|
||||||
@ -49,8 +49,8 @@ module.exports = function (app) {
|
|||||||
let switchStatus = {
|
let switchStatus = {
|
||||||
"switch": on
|
"switch": on
|
||||||
}
|
}
|
||||||
logger.info(switchStatus)
|
logger.debug(switchStatus)
|
||||||
logger.info('GET - /water/switch - END')
|
logger.debug('GET - /water/switch - END')
|
||||||
res.json(switchStatus)
|
res.json(switchStatus)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -5,9 +5,9 @@ let logger = require('perfect-logger')
|
|||||||
|
|
||||||
module.exports = function (app) {
|
module.exports = function (app) {
|
||||||
app.post("/water/switch", async function (req, res, next) {
|
app.post("/water/switch", async function (req, res, next) {
|
||||||
logger.info('POST - /water/switch - START')
|
logger.debug('POST - /water/switch - START')
|
||||||
if (req.body.switch === 1) {
|
if (req.body.switch === 1) {
|
||||||
logger.info('POST - /water/switch - ON - START')
|
logger.debug('POST - /water/switch - ON - START')
|
||||||
try {
|
try {
|
||||||
await post.postRequest('{"zoneId":[1],"setPoint": 255,"durationMinutes": 90}', 'apply_timer')
|
await post.postRequest('{"zoneId":[1],"setPoint": 255,"durationMinutes": 90}', 'apply_timer')
|
||||||
const response = await post.postRequest('{}', 'poll')
|
const response = await post.postRequest('{}', 'poll')
|
||||||
@ -17,14 +17,14 @@ module.exports = function (app) {
|
|||||||
let waterStatus = {
|
let waterStatus = {
|
||||||
"waterOn": JSON.stringify(on),
|
"waterOn": JSON.stringify(on),
|
||||||
}
|
}
|
||||||
logger.info('POST - /water/switch - ON - COMPLETE')
|
logger.debug('POST - /water/switch - ON - COMPLETE')
|
||||||
res.json(waterStatus)
|
res.json(waterStatus)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.warn('POST - /water/switch - ON - FAILED')
|
logger.warn('POST - /water/switch - ON - FAILED')
|
||||||
}
|
}
|
||||||
} else if (req.body.switch === 0) {
|
} else if (req.body.switch === 0) {
|
||||||
try {
|
try {
|
||||||
logger.info('POST - /water/switch - OFF - START')
|
logger.debug('POST - /water/switch - OFF - START')
|
||||||
await post.postRequest('{"zoneId":[1]}', 'cancel_timer')
|
await post.postRequest('{"zoneId":[1]}', 'cancel_timer')
|
||||||
const response = await post.postRequest('{}', 'poll')
|
const response = await post.postRequest('{}', 'poll')
|
||||||
const water = response.updateData.zones[1].status
|
const water = response.updateData.zones[1].status
|
||||||
@ -33,18 +33,34 @@ module.exports = function (app) {
|
|||||||
let waterStatus = {
|
let waterStatus = {
|
||||||
"waterOn": JSON.stringify(on),
|
"waterOn": JSON.stringify(on),
|
||||||
}
|
}
|
||||||
logger.info('POST - /water/switch - OFF - COMPLETE')
|
logger.debug('POST - /water/switch - OFF - COMPLETE')
|
||||||
res.json(waterStatus)
|
res.json(waterStatus)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
const response = await post.postRequest('{}', 'poll')
|
||||||
|
const water = response.updateData.zones[1].status
|
||||||
|
const on = await common.heatingOn(water)
|
||||||
|
|
||||||
|
let waterStatus = {
|
||||||
|
"waterOn": JSON.stringify(on),
|
||||||
|
}
|
||||||
logger.warn('POST - /water/switch - OFF - FAILED')
|
logger.warn('POST - /water/switch - OFF - FAILED')
|
||||||
|
res.json(waterStatus)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.warn('POST - /water/switch - FAILED')
|
const response = await post.postRequest('{}', 'poll')
|
||||||
|
const water = response.updateData.zones[1].status
|
||||||
|
const on = await common.heatingOn(water)
|
||||||
|
|
||||||
|
let waterStatus = {
|
||||||
|
"waterOn": JSON.stringify(on),
|
||||||
|
}
|
||||||
|
logger.warn('POST - /water/switch - OFF - FAILED')
|
||||||
|
res.json(waterStatus)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post("/water/status", async function (req, res, next) {
|
app.post("/water/status", async function (req, res, next) {
|
||||||
logger.info('POST - /water/status - START')
|
logger.debug('POST - /water/status - START')
|
||||||
const response = await post.postRequest('{}', 'poll')
|
const response = await post.postRequest('{}', 'poll')
|
||||||
const water = response.updateData.zones[1].status
|
const water = response.updateData.zones[1].status
|
||||||
const on = await common.heatingOn(water)
|
const on = await common.heatingOn(water)
|
||||||
@ -55,7 +71,7 @@ module.exports = function (app) {
|
|||||||
"lastTimerSetPoint": JSON.stringify(water.lastTimerSetPoint),
|
"lastTimerSetPoint": JSON.stringify(water.lastTimerSetPoint),
|
||||||
"lastTimerDurationMinutes": JSON.stringify(water.lastTimerDurationMinutes)
|
"lastTimerDurationMinutes": JSON.stringify(water.lastTimerDurationMinutes)
|
||||||
}
|
}
|
||||||
logger.info('POST - /water/status - END')
|
logger.debug('POST - /water/status - END')
|
||||||
res.json(waterStatus)
|
res.json(waterStatus)
|
||||||
});
|
});
|
||||||
}
|
}
|
4
test.js
4
test.js
@ -15,9 +15,9 @@ app.use(
|
|||||||
app.use(bodyParser.json())
|
app.use(bodyParser.json())
|
||||||
|
|
||||||
app.post('/endpoint', (req, res) => {
|
app.post('/endpoint', (req, res) => {
|
||||||
logger.info(req.body)
|
logger.debug(req.body)
|
||||||
})
|
})
|
||||||
|
|
||||||
app.listen(2020, function () {
|
app.listen(2020, function () {
|
||||||
logger.info("Server running on port 2020");
|
logger.debug("Server running on port 2020");
|
||||||
});
|
});
|
Loading…
x
Reference in New Issue
Block a user