lint and prettier
This commit is contained in:
parent
46ec5dd410
commit
7dc66cc2a5
17
.eslintrc.js
Normal file
17
.eslintrc.js
Normal 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": {
|
||||||
|
}
|
||||||
|
};
|
@ -1,3 +1,4 @@
|
|||||||
|
const moment = require('moment')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
updateTemp: async (heating) => {
|
updateTemp: async (heating) => {
|
||||||
@ -50,5 +51,9 @@ module.exports = {
|
|||||||
return value
|
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
1082
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -19,6 +19,11 @@
|
|||||||
"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",
|
||||||
|
"moment": "^2.25.3",
|
||||||
"perfect-logger": "^2.0.1"
|
"perfect-logger": "^2.0.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"eslint": "^7.0.0",
|
||||||
|
"prettier": "2.0.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,13 +20,15 @@ module.exports = function (app) {
|
|||||||
const on = await common.heatingOn(heating)
|
const on = await common.heatingOn(heating)
|
||||||
const csp = await common.heatMap(heating.currentSetpoint)
|
const csp = await common.heatMap(heating.currentSetpoint)
|
||||||
const lsp = await common.heatMap(heating.lastTimerSetPoint)
|
const lsp = await common.heatMap(heating.lastTimerSetPoint)
|
||||||
|
const time = await common.convertTime(heating.nextScheduleEventUtcTime)
|
||||||
|
|
||||||
let heatingStatus = {
|
let heatingStatus = {
|
||||||
"heatingOn": JSON.stringify(on),
|
"heatingOn": JSON.stringify(on),
|
||||||
"measuredRoomTemp": mrt,
|
"measuredRoomTemp": mrt,
|
||||||
"currentSetpoint": csp,
|
"currentSetpoint": csp,
|
||||||
"lastTimerSetPoint": lsp,
|
"lastTimerSetPoint": lsp,
|
||||||
"lastTimerDurationMinutes": JSON.stringify(heating.lastTimerDurationMinutes)
|
"lastTimerDurationMinutes": JSON.stringify(heating.lastTimerDurationMinutes),
|
||||||
|
"nextScheduleEventUtcTime": time
|
||||||
}
|
}
|
||||||
logger.debug('GET - /heating/status - END')
|
logger.debug('GET - /heating/status - END')
|
||||||
res.json(heatingStatus)
|
res.json(heatingStatus)
|
||||||
|
@ -16,12 +16,14 @@ module.exports = function (app) {
|
|||||||
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)
|
||||||
|
const time = await common.convertTime(water.nextScheduleEventUtcTime)
|
||||||
|
|
||||||
let waterStatus = {
|
let waterStatus = {
|
||||||
"waterOn": JSON.stringify(on),
|
"waterOn": JSON.stringify(on),
|
||||||
"currentSetpoint": JSON.stringify(water.currentSetpoint),
|
"currentSetpoint": JSON.stringify(water.currentSetpoint),
|
||||||
"lastTimerSetPoint": JSON.stringify(water.lastTimerSetPoint),
|
"lastTimerSetPoint": JSON.stringify(water.lastTimerSetPoint),
|
||||||
"lastTimerDurationMinutes": JSON.stringify(water.lastTimerDurationMinutes)
|
"lastTimerDurationMinutes": JSON.stringify(water.lastTimerDurationMinutes),
|
||||||
|
"nextScheduleEventUtcTime": time
|
||||||
}
|
}
|
||||||
logger.debug('GET - /water/status - END')
|
logger.debug('GET - /water/status - END')
|
||||||
res.json(waterStatus)
|
res.json(waterStatus)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user