working degrees
This commit is contained in:
parent
ba3e106a1b
commit
c4b2abcd70
2
app.js
2
app.js
@ -9,7 +9,7 @@ const menu = require('./modules/mainMenu')
|
|||||||
async function main() {
|
async function main() {
|
||||||
lcd.clearScreen()
|
lcd.clearScreen()
|
||||||
await lcd.intro()
|
await lcd.intro()
|
||||||
menu.water()
|
menu.home()
|
||||||
|
|
||||||
const heatingSwitch = new Gpio('17', 'in', 'both');
|
const heatingSwitch = new Gpio('17', 'in', 'both');
|
||||||
const appSwitch = new Gpio('23', 'in', 'both');
|
const appSwitch = new Gpio('23', 'in', 'both');
|
||||||
|
11
libs/lcd.js
11
libs/lcd.js
@ -40,7 +40,7 @@ module.exports = {
|
|||||||
lcd.setCursorSync(6, 2);
|
lcd.setCursorSync(6, 2);
|
||||||
lcd.printSync(input)
|
lcd.printSync(input)
|
||||||
},
|
},
|
||||||
waterStatus: async (input) => {
|
heatingStatus: async (input) => {
|
||||||
lcd.printLineSync(2, 'Heating=')
|
lcd.printLineSync(2, 'Heating=')
|
||||||
lcd.setCursorSync(8, 2);
|
lcd.setCursorSync(8, 2);
|
||||||
lcd.printSync(' ')
|
lcd.printSync(' ')
|
||||||
@ -62,7 +62,14 @@ module.exports = {
|
|||||||
lcd.printSync(input)
|
lcd.printSync(input)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
degrees: async () => {
|
currentRoomTemp: async (temp) => {
|
||||||
let icon = '°'
|
let icon = '°'
|
||||||
|
temp = temp + icon
|
||||||
|
console.log(temp)
|
||||||
|
},
|
||||||
|
lastSetTemp: async (temp) => {
|
||||||
|
let icon = '°'
|
||||||
|
temp = temp + icon
|
||||||
|
console.log(temp)
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -26,8 +26,6 @@ module.exports = {
|
|||||||
response.on('end', async function () {
|
response.on('end', async function () {
|
||||||
var data = JSON.parse(content);
|
var data = JSON.parse(content);
|
||||||
let heatingOn = data.heatingOn
|
let heatingOn = data.heatingOn
|
||||||
let currentRoomTemp = data.measuredRoomTemp
|
|
||||||
let currentSetPoint = data.currentSetpoint
|
|
||||||
|
|
||||||
var time = await common.nextEvent(data.nextScheduleEventUtcTime)
|
var time = await common.nextEvent(data.nextScheduleEventUtcTime)
|
||||||
|
|
||||||
@ -39,39 +37,45 @@ module.exports = {
|
|||||||
if (heatingOn === 'true') {
|
if (heatingOn === 'true') {
|
||||||
globalVars.heatingOn = heatingOn
|
globalVars.heatingOn = heatingOn
|
||||||
lcd.heatingStatus('On')
|
lcd.heatingStatus('On')
|
||||||
|
lcd.lastSetTemp(data.lastTimerSetPoint)
|
||||||
|
lcd.currentRoomTemp(data.measuredRoomTemp)
|
||||||
lcd.NextEvent(globalVars.heatingNextEvent)
|
lcd.NextEvent(globalVars.heatingNextEvent)
|
||||||
led.set('red')
|
led.set('red')
|
||||||
} else {
|
} else {
|
||||||
globalVars.waterOn = waterOn
|
globalVars.heatingOn = heatingOn
|
||||||
lcd.heatingStatus('Off')
|
lcd.heatingStatus('Off')
|
||||||
led.set('blue')
|
lcd.lastSetTemp(data.lastTimerSetPoint)
|
||||||
|
lcd.currentRoomTemp(data.measuredRoomTemp)
|
||||||
lcd.NextEvent(globalVars.heatingNextEvent)
|
lcd.NextEvent(globalVars.heatingNextEvent)
|
||||||
|
led.set('blue')
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// if (waterOn != globalVars.waterOn) {
|
// if (waterOn != globalVars.waterOn) {
|
||||||
if (heatingOn === 'true') {
|
if (heatingOn === 'true') {
|
||||||
globalVars.heatingOn = heatingOn
|
globalVars.heatingOn = heatingOn
|
||||||
lcd.heatingStatus('On')
|
lcd.heatingStatus('On')
|
||||||
led.set('red')
|
lcd.lastSetTemp(data.lastTimerSetPoint)
|
||||||
|
lcd.currentRoomTemp(data.measuredRoomTemp)
|
||||||
lcd.NextEvent(globalVars.heatingNextEvent)
|
lcd.NextEvent(globalVars.heatingNextEvent)
|
||||||
|
led.set('red')
|
||||||
} else {
|
} else {
|
||||||
globalVars.heatingOn = heatingOn
|
globalVars.heatingOn = heatingOn
|
||||||
lcd.heatingStatus('Off')
|
lcd.heatingStatus('Off')
|
||||||
led.set('blue')
|
lcd.lastSetTemp(data.lastTimerSetPoint)
|
||||||
|
lcd.currentRoomTemp(data.measuredRoomTemp)
|
||||||
lcd.NextEvent(globalVars.waterNextEvent)
|
lcd.NextEvent(globalVars.waterNextEvent)
|
||||||
|
led.set('blue')
|
||||||
}
|
}
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Report errors
|
// Report errors
|
||||||
request.on('error', function (error) {
|
request.on('error', function (error) {
|
||||||
led.set('green')
|
led.set('green')
|
||||||
lcd.heatingStatus('Error No Data')
|
lcd.heatingStatus('Error No Data')
|
||||||
globalVars.heatingOn = 'error'
|
globalVars.heatingOn = 'error'
|
||||||
});
|
});
|
||||||
|
|
||||||
request.end();
|
request.end();
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user