lint and prettier

This commit is contained in:
Karl 2020-05-11 16:29:08 +01:00
parent 46ec5dd410
commit 7dc66cc2a5
6 changed files with 1115 additions and 2 deletions

17
.eslintrc.js Normal file
View File

@ -0,0 +1,17 @@
module.exports = {
"env": {
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaVersion": 11,
"sourceType": "module"
},
"rules": {
}
};

View File

@ -1,3 +1,4 @@
const moment = require('moment')
module.exports = {
updateTemp: async (heating) => {
@ -50,5 +51,9 @@ module.exports = {
return value
}
}
},
convertTime: async (ts) => {
const test = moment.unix(ts).format('dddd, MMMM Do, YYYY h:mm:ss A')
return test
}
}

1082
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -19,6 +19,11 @@
"express": "^4.17.1",
"fs": "0.0.1-security",
"got": "^11.1.2",
"moment": "^2.25.3",
"perfect-logger": "^2.0.1"
},
"devDependencies": {
"eslint": "^7.0.0",
"prettier": "2.0.5"
}
}

View File

@ -20,13 +20,15 @@ module.exports = function (app) {
const on = await common.heatingOn(heating)
const csp = await common.heatMap(heating.currentSetpoint)
const lsp = await common.heatMap(heating.lastTimerSetPoint)
const time = await common.convertTime(heating.nextScheduleEventUtcTime)
let heatingStatus = {
"heatingOn": JSON.stringify(on),
"measuredRoomTemp": mrt,
"currentSetpoint": csp,
"lastTimerSetPoint": lsp,
"lastTimerDurationMinutes": JSON.stringify(heating.lastTimerDurationMinutes)
"lastTimerDurationMinutes": JSON.stringify(heating.lastTimerDurationMinutes),
"nextScheduleEventUtcTime": time
}
logger.debug('GET - /heating/status - END')
res.json(heatingStatus)

View File

@ -16,12 +16,14 @@ module.exports = function (app) {
const response = await post.postRequest('{}', 'poll')
const water = response.updateData.zones[1].status
const on = await common.heatingOn(water)
const time = await common.convertTime(water.nextScheduleEventUtcTime)
let waterStatus = {
"waterOn": JSON.stringify(on),
"currentSetpoint": JSON.stringify(water.currentSetpoint),
"lastTimerSetPoint": JSON.stringify(water.lastTimerSetPoint),
"lastTimerDurationMinutes": JSON.stringify(water.lastTimerDurationMinutes)
"lastTimerDurationMinutes": JSON.stringify(water.lastTimerDurationMinutes),
"nextScheduleEventUtcTime": time
}
logger.debug('GET - /water/status - END')
res.json(waterStatus)