Some cleanup on master bedroom climate processing function
This commit is contained in:
@ -25,6 +25,15 @@ const coolingActive = states['input_boolean.master_bedroom_cooling_on'].state
|
|||||||
const echoDotDND = 'switch.basement_echo_dot_do_not_disturb_switch'
|
const echoDotDND = 'switch.basement_echo_dot_do_not_disturb_switch'
|
||||||
node.log("Master Bedroom Climate: Constants Set")
|
node.log("Master Bedroom Climate: Constants Set")
|
||||||
|
|
||||||
|
// Helper function to convert a string to title case
|
||||||
|
|
||||||
|
function convertToTitleCase(str) {
|
||||||
|
if (!str) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return str.toLowerCase().replace(/\b\w/g, (s) => s.toUpperCase());
|
||||||
|
}
|
||||||
|
|
||||||
// init variables
|
// init variables
|
||||||
|
|
||||||
let setTemp = []
|
let setTemp = []
|
||||||
@ -411,26 +420,7 @@ if (type === 'auto' && allowed === 'on' && meltdown === 'off' && vacation === 'o
|
|||||||
node.send([null, null, sendPeople, null, null])
|
node.send([null, null, sendPeople, null, null])
|
||||||
}
|
}
|
||||||
node.log("Master Bedroom Climate: Sleep")
|
node.log("Master Bedroom Climate: Sleep")
|
||||||
if (time === 'night') {
|
if (time === 'bedtime') {
|
||||||
node.status({ fill: "blue", shape: "dot", text: "Wakeup (Hot Day)" })
|
|
||||||
node.send([null, sendFan, sendEchoDotDND, null, null])
|
|
||||||
node.log("Master Bedroom Climate: Sleep/Night")
|
|
||||||
if (ac === 'on') {
|
|
||||||
node.send([[sendDisplay, sendHvac, sendTemp, sendEco, sendAcFan], null, null, null])
|
|
||||||
node.log("Master Bedroom Climate: Sleep/Night/AC")
|
|
||||||
}
|
|
||||||
} else if (time === 'day') {
|
|
||||||
node.status({ fill: "blue", shape: "dot", text: "Wakeup" })
|
|
||||||
node.send([null, sendFan, sendEchoDotDND, null, null])
|
|
||||||
node.log("Master Bedroom Climate: Sleep/Day")
|
|
||||||
if (ac === 'on') {
|
|
||||||
node.send([[sendDisplay, sendHvac, sendTemp, sendEco, sendAcFan], null, null, null, null])
|
|
||||||
node.log("Master Bedroom Climate: Sleep/Day/AC")
|
|
||||||
}
|
|
||||||
if (isWakeup === false) {
|
|
||||||
node.send([null, null, null, null, sendBriefing])
|
|
||||||
}
|
|
||||||
} else if (time === 'bedtime') {
|
|
||||||
node.status({ fill: "blue", shape: "dot", text: "Sleep" })
|
node.status({ fill: "blue", shape: "dot", text: "Sleep" })
|
||||||
node.send([null, sendFan, [sendEchoDotDND,sendPeople], null, null])
|
node.send([null, sendFan, [sendEchoDotDND,sendPeople], null, null])
|
||||||
node.log("Master Bedroom Climate: Sleep/Bedtime")
|
node.log("Master Bedroom Climate: Sleep/Bedtime")
|
||||||
@ -438,6 +428,17 @@ if (type === 'auto' && allowed === 'on' && meltdown === 'off' && vacation === 'o
|
|||||||
node.send([[sendDisplay, sendHvac, sendTemp, sendEco, sendAcFan], null, null, null, null])
|
node.send([[sendDisplay, sendHvac, sendTemp, sendEco, sendAcFan], null, null, null, null])
|
||||||
node.log("Master Bedroom Climate: Sleep/Bedtime/AC")
|
node.log("Master Bedroom Climate: Sleep/Bedtime/AC")
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
node.status({ fill: "blue", shape: "dot", text: "Wakeup" })
|
||||||
|
node.send([null, sendFan, sendEchoDotDND, null, null])
|
||||||
|
node.log("Master Bedroom Climate: Sleep/Day")
|
||||||
|
if (ac === 'on') {
|
||||||
|
node.send([[sendDisplay, sendHvac, sendTemp, sendEco, sendAcFan], null, null, null, null])
|
||||||
|
node.log("Master Bedroom Climate: Sleep/" + convertToTitleCase(time) + "/AC")
|
||||||
|
}
|
||||||
|
if (time === 'day' && isWakeup === false) {
|
||||||
|
node.send([null, null, null, null, sendBriefing])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
context.set("isWakeup", false)
|
context.set("isWakeup", false)
|
||||||
} else if (meltdown === 'on') {
|
} else if (meltdown === 'on') {
|
||||||
|
Reference in New Issue
Block a user