Fix handling of master bedroom wakeup briefing
This commit is contained in:
@ -36,11 +36,12 @@ let setCool = []
|
||||
let setSleep = []
|
||||
let setDisplay = []
|
||||
let time = []
|
||||
let type = msg.type
|
||||
let topic = msg.topic
|
||||
let echoDotService = []
|
||||
let setBriefing = []
|
||||
let setBriefingDelay = []
|
||||
let type = msg.type
|
||||
let topic = msg.topic
|
||||
let isWakeup = context.get("isWakeup")
|
||||
node.log("Master Bedroom Climate: Variables Defined")
|
||||
|
||||
// Sleep Switch Handling
|
||||
@ -65,22 +66,18 @@ if (topic === 'mrbedroom-wakeup') {
|
||||
}
|
||||
|
||||
// Setup TTS briefing
|
||||
if (time === 'day') {
|
||||
if (topic === 'mrbedroom-wakeup') {
|
||||
setBriefing = "master_bedroom_wakeup_briefing"
|
||||
if (topic === 'mrbedroom-wakeup') {
|
||||
setBriefingDelay = 60
|
||||
} else if (type === 'sleep' && payload === 'off') {
|
||||
setBriefingDelay = 15
|
||||
}
|
||||
setBriefingDelay = 60000
|
||||
} else if (type === 'sleep' && payload === 'off') {
|
||||
setBriefing = "master_bedroom_wakeup_briefing"
|
||||
setBriefingDelay = 15000
|
||||
}
|
||||
|
||||
// Day Time
|
||||
if (time === 'day') {
|
||||
if (type === 'auto') {
|
||||
setCool = 'turn_off'
|
||||
setBriefingDelay = 60
|
||||
} else if (type === 'manual') {
|
||||
setBriefingDelay = 15
|
||||
}
|
||||
if (earlyNight === 'off') {
|
||||
setFan = "turn_off"
|
||||
@ -350,6 +347,7 @@ if (type === 'auto' && allowed === 'on' && meltdown === 'off' && vacation === 'o
|
||||
node.status({ fill: "green", shape: "dot", text: "Wakeup Schedule" })
|
||||
node.log("Master Bedroom Climate: Auto/Wakeup")
|
||||
if (sleeping === 'off') {
|
||||
context.set("isWakeup", false)
|
||||
node.send([null, sendFan, null, null, null])
|
||||
node.log("Master Bedroom Climate: Auto/Wakeup/Sleep Off")
|
||||
if (ac === 'on') {
|
||||
@ -357,6 +355,7 @@ if (type === 'auto' && allowed === 'on' && meltdown === 'off' && vacation === 'o
|
||||
node.log("Master Bedroom Climate: Auto/Wakeup/AC On")
|
||||
}
|
||||
} else if (sleeping === 'on') {
|
||||
context.set("isWakeup", true)
|
||||
node.send([null, null, sendSleep, null, null])
|
||||
node.log("Master Bedroom Climate: Auto/Wakeup/Sleep On")
|
||||
}
|
||||
@ -390,6 +389,7 @@ if (type === 'auto' && allowed === 'on' && meltdown === 'off' && vacation === 'o
|
||||
node.log("Master Bedroom Climate: Manual/Bedtime/AC")
|
||||
}
|
||||
}
|
||||
context.set("isWakeup", false)
|
||||
} else if (type === 'sleep') {
|
||||
node.log("Master Bedroom Climate: Sleep")
|
||||
if (time === 'night') {
|
||||
@ -402,12 +402,15 @@ if (type === 'auto' && allowed === 'on' && meltdown === 'off' && vacation === 'o
|
||||
}
|
||||
} else if (time === 'day') {
|
||||
node.status({ fill: "blue", shape: "dot", text: "Wakeup" })
|
||||
node.send([null, sendFan, sendEchoDotDND, null, sendBriefing])
|
||||
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.send([null, sendFan, sendEchoDotDND, null, null])
|
||||
@ -417,6 +420,7 @@ if (type === 'auto' && allowed === 'on' && meltdown === 'off' && vacation === 'o
|
||||
node.log("Master Bedroom Climate: Sleep/Bedtime/AC")
|
||||
}
|
||||
}
|
||||
context.set("isWakeup", false)
|
||||
} else if (meltdown === 'on') {
|
||||
node.status({ fill: "red", shape: "ring", text: "Blocked (Meltdown Protocol)" })
|
||||
node.log("Master Bedroom Climate: Blocked (Meltdown Protocol)")
|
||||
|
Reference in New Issue
Block a user