54 lines
1.2 KiB
JavaScript
54 lines
1.2 KiB
JavaScript
|
|
module.exports = {
|
|
updateTemp: async (heating) => {
|
|
try {
|
|
let mrt = String(heating.measuredRoomTemp)
|
|
mrt = mrt.match(new RegExp('.{1,' + 2 + '}', 'g'));
|
|
mrt = mrt[0] + "." + mrt[1]
|
|
return mrt
|
|
} catch (error) {
|
|
console.log('Error')
|
|
}
|
|
|
|
},
|
|
heatingOn: async (heating) => {
|
|
try {
|
|
let on
|
|
if (heating.currentSetpoint > 0) {
|
|
on = true
|
|
} else {
|
|
on = false
|
|
}
|
|
return on
|
|
} catch (error) {
|
|
console.log('Error')
|
|
}
|
|
|
|
},
|
|
heatMap: async (value) => {
|
|
value
|
|
|
|
let heatMap = [
|
|
{
|
|
"miGenie": 0,
|
|
"realTemp": 0
|
|
},
|
|
{
|
|
"miGenie": 84,
|
|
"realTemp": 22
|
|
},
|
|
{
|
|
"miGenie": 88,
|
|
"realTemp": 23
|
|
}
|
|
]
|
|
|
|
for (let index = 0; index < heatMap.length; index++) {
|
|
const element = heatMap[index];
|
|
if (value === element.miGenie){
|
|
value = element.realTemp
|
|
return value
|
|
}
|
|
}
|
|
}
|
|
} |