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