Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
b69aed0029
|
|||
|
cdf20900c9
|
|||
|
abc0004623
|
@@ -3,21 +3,13 @@ const toggle = msg.payload
|
||||
const ac = global.get('emmaBedroom.aircon.installed', "diskCon")
|
||||
const lastMode = flow.get("emmaBedroom.lastMode", "diskCon")
|
||||
const bedTemp = states['input_number.emma_bedroom_bedtime_temp'].state
|
||||
const ecoHold = states['switch.emma_bedroom_aircon_eco_hold'].state
|
||||
const fanMode = states['input_select.emma_bedroom_aircon_fan_mode'].state
|
||||
|
||||
const airconEntity = ["climate.emma_bedroom_aircon"]
|
||||
|
||||
let setTemp = bedTemp
|
||||
let setEco = 'turn_on'
|
||||
let setEco = 'turn_off'
|
||||
let setHvac = 'cool'
|
||||
let setAcFan = fanMode
|
||||
|
||||
if (ecoHold === 'on') {
|
||||
setEco = 'turn_on'
|
||||
} else {
|
||||
setEco = 'turn_off'
|
||||
}
|
||||
let setAcFan = 'High'
|
||||
|
||||
let sendHvac = {
|
||||
"payload": {
|
||||
|
||||
@@ -11,7 +11,7 @@ let fanOnlyMsg = {
|
||||
"topic": "Emma AC Mode: Fan Only"
|
||||
}
|
||||
|
||||
if (topic === 'emmabedroom-climate') {
|
||||
if (topic === 'emmabedroom-cooling') {
|
||||
if (acMode === 'AC') {
|
||||
node.status({fill:"green",shape:"dot",text:"AC Cooling"})
|
||||
return coolMsg
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
const outdoor = global.get("outdoorTemp.tempInt")
|
||||
const thresholdEntity = global.get("homeassistant.homeAssistant.states['input_number.emma_bedroom_aircon_mode_threshold'].state")
|
||||
const threshold = parseInt(thresholdEntity)
|
||||
|
||||
msg.outdoor = outdoor
|
||||
msg.modeThreshold = threshold
|
||||
|
||||
if (outdoor >= threshold) {
|
||||
node.status({fill:"green",shape:"dot",text:`${outdoor} >= ${threshold}`})
|
||||
return msg
|
||||
} else {
|
||||
node.status({fill:"red",shape:"ring",text:`${outdoor} < ${threshold}`})
|
||||
return null
|
||||
}
|
||||
@@ -18,8 +18,6 @@ const earlyNight = states["binary_sensor.early_night_mode"].state
|
||||
const danger = states['binary_sensor.heat_warning'].attributes.danger
|
||||
const meltdown = states['input_boolean.meltdown_protocol'].state
|
||||
const coolingActive = states['input_boolean.emma_bedroom_cooling_on'].state
|
||||
const ecoHold = states['input_boolean.emma_bedroom_aircon_eco_hold'].state
|
||||
const fanModeAircon = states['input_select.emma_bedroom_aircon_fan_mode'].state
|
||||
node.log("Emma Bedroom Climate: Constants Set")
|
||||
|
||||
// Define reusable constants
|
||||
@@ -41,7 +39,7 @@ function convertToTitleCase(str) {
|
||||
// init variables
|
||||
|
||||
let setTemp = dayTemp
|
||||
let setAcFan = fanModeAircon
|
||||
let setAcFan = 'auto'
|
||||
let setEco = 'turn_on'
|
||||
let setHvac = 'cool'
|
||||
let setCool = []
|
||||
@@ -99,7 +97,7 @@ if (time === 'day') {
|
||||
} else if (earlyNight === 'on') {
|
||||
if (ac === 'on') {
|
||||
if (danger === 'Extreme') {
|
||||
setTemp = bedTemp
|
||||
setTemp === bedTemp
|
||||
} else {
|
||||
setTemp = nightTemp
|
||||
}
|
||||
@@ -110,7 +108,11 @@ if (time === 'day') {
|
||||
} else {
|
||||
setHvac = 'off'
|
||||
}
|
||||
setEco = 'turn_on'
|
||||
if (hotDay === 'on') {
|
||||
setEco = 'turn_off'
|
||||
} else {
|
||||
setEco = 'turn_on'
|
||||
}
|
||||
}
|
||||
}
|
||||
// Night Time
|
||||
@@ -129,11 +131,7 @@ if (time === 'day') {
|
||||
}
|
||||
// Decide eco mode
|
||||
if (sleeping === 'on') {
|
||||
if (ecoHold === 'on') {
|
||||
setEco = 'turn_on'
|
||||
} else {
|
||||
setEco = 'turn_off'
|
||||
}
|
||||
setEco = 'turn_off'
|
||||
} else {
|
||||
setEco = 'turn_on'
|
||||
}
|
||||
@@ -150,11 +148,7 @@ if (time === 'day') {
|
||||
setPeople = 'turn_off'
|
||||
if (ac === 'on') {
|
||||
setTemp = bedTemp
|
||||
if (ecoHold === 'on') {
|
||||
setEco = 'turn_on'
|
||||
} else {
|
||||
setEco = 'turn_off'
|
||||
}
|
||||
setEco = 'turn_off'
|
||||
if (schedMode === 'AC') {
|
||||
setHvac = 'cool'
|
||||
setDisplay = 'turn_off'
|
||||
@@ -297,7 +291,7 @@ if (setDisplay.length > 0) {
|
||||
flow.set('emmaBedroom.airconDisplay',setDisplay,'diskCon')
|
||||
}
|
||||
|
||||
flow.set('emmaBedroom.airconfanModeAircon',setAcFan,'diskCon')
|
||||
flow.set('emmaBedroom.airconFanMode',setAcFan,'diskCon')
|
||||
|
||||
// Log the parameters that were chosen, for debugging purposes
|
||||
|
||||
@@ -328,7 +322,7 @@ if (type === 'auto' && allowed === 'on' && meltdown === 'off' && vacation === 'o
|
||||
node.status({ fill: "red", shape: "ring", text: "Blocked (sleep mode)" })
|
||||
node.log("Emma Bedroom Climate: Blocked (sleep mode)")
|
||||
} else {
|
||||
if (topic === 'emmabedroom-climate' && ac === 'on') {
|
||||
if (topic === 'emmabedroom-cooling' && ac === 'on') {
|
||||
node.status({ fill: "green", shape: "dot", text: "Cooling Schedule" })
|
||||
node.send([[sendDisplay, sendHvac, sendTemp, sendAcFan, sendEco], null, null])
|
||||
node.log("Emma Bedroom Climate: Auto/Cooling")
|
||||
|
||||
@@ -1,30 +1,15 @@
|
||||
const states = global.get('homeassistant.homeAssistant.states')
|
||||
const sleeping = states['input_boolean.emma_sleeping'].state
|
||||
|
||||
// Check if all settings support aircon usage
|
||||
|
||||
const ac = global.get('emmaBedroom.aircon.installed', "diskCon")
|
||||
const allowed = states['input_boolean.emma_bedroom_climate_protocol'].state
|
||||
const schedMode = states['input_select.scheduled_climate_mode_emma_bedroom'].state
|
||||
const coolingActive = states["input_boolean.emma_bedroom_cooling_on"].state
|
||||
const sleeping = states["input_boolean.emma_sleeping"].state
|
||||
|
||||
let proceed = false
|
||||
|
||||
if (ac === 'on' && allowed === 'on' && schedMode === 'AC' && coolingActive === 'on') {
|
||||
proceed = true
|
||||
}
|
||||
|
||||
if (sleeping != 'on') {
|
||||
if (sleeping !== 'on') {
|
||||
node.status({fill:'red',shape:'ring',text:'Emma not sleeping, watchdog disabled'})
|
||||
return null
|
||||
} else if (proceed === false) {
|
||||
node.status({fill:'red',shape:'ring',text:'Aircon not in use, watchdog disabled'})
|
||||
return null
|
||||
}
|
||||
|
||||
const airconEntity = ['climate.emma_bedroom_aircon']
|
||||
|
||||
// Gather relevant attributes from the aircon entity
|
||||
|
||||
const airconEntity = ['climate.emma_bedroom_aircon']
|
||||
const airconState = msg.payload.state
|
||||
const airconAttributes = msg.payload.attributes
|
||||
const airconEco = airconAttributes['eco_mode']
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
const states = global.get('homeassistant.homeAssistant.states')
|
||||
const earlyNight = states['binary_sensor.early_night_mode'].state
|
||||
const payload = msg.payload
|
||||
|
||||
if (payload === 'off') {
|
||||
if (earlyNight === 'on') {
|
||||
msg.mode = 'Night Mode'
|
||||
} else {
|
||||
msg.mode = 'Day Mode'
|
||||
}
|
||||
} else if (payload === 'on') {
|
||||
msg.mode = 'Bedtime Mode'
|
||||
}
|
||||
|
||||
return msg
|
||||
@@ -3,24 +3,16 @@ const toggle = msg.payload
|
||||
const ac = global.get('masterBedroom.aircon.installed', "diskCon")
|
||||
const lastMode = flow.get("masterBedroom.lastMode", "diskCon")
|
||||
const bedTemp = states['input_number.master_bedroom_bedtime_temp'].state
|
||||
const ecoHold = states['switch.master_bedroom_aircon_eco_hold'].state
|
||||
const fanMode = states['input_select.master_bedroom_aircon_fan_mode'].state
|
||||
|
||||
const airconEntity = ["climate.master_bedroom_aircon"]
|
||||
const fanEntity = ["fan.master_bedroom_fan"]
|
||||
|
||||
let setTemp = bedTemp
|
||||
let setEco = 'turn_on'
|
||||
let setEco = 'turn_off'
|
||||
let setHvac = 'cool'
|
||||
let setAcFan = fanMode
|
||||
let setAcFan = 'High'
|
||||
let setFan = 'turn_off'
|
||||
|
||||
if (ecoHold === 'on') {
|
||||
setEco = 'turn_on'
|
||||
} else {
|
||||
setEco = 'turn_off'
|
||||
}
|
||||
|
||||
let sendFan = {
|
||||
"payload": {
|
||||
"action": `fan.${setFan}`,
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
const outdoor = global.get("outdoorTemp.tempInt")
|
||||
const thresholdEntity = global.get("homeassistant.homeAssistant.states['input_number.master_bedroom_aircon_mode_threshold'].state")
|
||||
const threshold = parseInt(thresholdEntity)
|
||||
|
||||
msg.outdoor = outdoor
|
||||
msg.modeThreshold = threshold
|
||||
|
||||
if (outdoor >= threshold) {
|
||||
node.status({fill:"green",shape:"dot",text:`${outdoor} >= ${threshold}`})
|
||||
return msg
|
||||
} else {
|
||||
node.status({fill:"red",shape:"ring",text:`${outdoor} < ${threshold}`})
|
||||
return null
|
||||
}
|
||||
@@ -4,14 +4,12 @@ const states = global.get('homeassistant.homeAssistant.states')
|
||||
const dayTemp = parseInt(states['input_number.master_bedroom_daytime_temp'].state)
|
||||
const nightTemp = parseInt(states['input_number.master_bedroom_night_temp'].state)
|
||||
const bedTemp = parseInt(states['input_number.master_bedroom_bedtime_temp'].state)
|
||||
const ecoHold = states['switch.master_bedroom_aircon_eco_hold'].state
|
||||
const fanModeAircon = states['input_select.master_bedroom_aircon_fan_mode'].state
|
||||
|
||||
let dayMode = {
|
||||
"power": "turn_on",
|
||||
"temp": dayTemp,
|
||||
"hvac": "cool",
|
||||
"fan": fanModeAircon,
|
||||
"fan": "auto",
|
||||
"eco": "turn_on"
|
||||
}
|
||||
|
||||
@@ -19,16 +17,16 @@ let nightMode = {
|
||||
"power": "turn_on",
|
||||
"temp": nightTemp,
|
||||
"hvac": "cool",
|
||||
"fan": fanModeAircon,
|
||||
"eco": ecoHold === "on" ? "turn_on" : "turn_off"
|
||||
"fan": "auto",
|
||||
"eco": "turn_on"
|
||||
}
|
||||
|
||||
let bedMode = {
|
||||
"power": "turn_on",
|
||||
"temp": bedTemp,
|
||||
"hvac": "cool",
|
||||
"fan": fanModeAircon,
|
||||
"eco": ecoHold === "on" ? "turn_on" : "turn_off"
|
||||
"fan": "auto",
|
||||
"eco": "turn_off"
|
||||
}
|
||||
|
||||
let showerMode = {
|
||||
|
||||
@@ -11,7 +11,6 @@ const dayTemp = states['input_number.master_bedroom_daytime_temp'].state
|
||||
const nightTemp = states['input_number.master_bedroom_night_temp'].state
|
||||
const bedTemp = states['input_number.master_bedroom_bedtime_temp'].state
|
||||
const showerMode = states['input_boolean.shower_mode'].state
|
||||
const nightVolume = states['input_number.master_bedroom_echo_dot_night_volume'].state
|
||||
const fanMode = states['input_select.scheduled_climate_mode_master_bedroom_fan'].state
|
||||
const acMode = states['input_select.scheduled_climate_mode_master_bedroom_aircon'].state
|
||||
const sleeping = states['input_boolean.master_bedroom_sleeping'].state
|
||||
@@ -21,10 +20,8 @@ const showerCooldown = states["timer.shower_mode_cooldown"].state
|
||||
const earlyNight = states["binary_sensor.early_night_mode"].state
|
||||
const danger = states['binary_sensor.heat_warning'].attributes.danger
|
||||
const meltdown = states['input_boolean.meltdown_protocol'].state
|
||||
const coolingActive = states['input_boolean.master_bedroom_cooling_on'].state
|
||||
const echoDotDND = 'switch.basement_echo_dot_do_not_disturb_switch'
|
||||
const ecoHold = states['switch.master_bedroom_aircon_eco_hold'].state
|
||||
const fanModeAircon = states['input_select.master_bedroom_aircon_fan_mode'].state
|
||||
const currentMode = states['input_select.current_climate_mode_master_bedroom'].state
|
||||
node.log("Master Bedroom Climate: Constants Set")
|
||||
|
||||
// Define some entity IDs
|
||||
@@ -45,18 +42,17 @@ function convertToTitleCase(str) {
|
||||
// init variables
|
||||
|
||||
let setTemp = dayTemp
|
||||
let setAcFan = fanModeAircon
|
||||
let setEco = 'turn_on'
|
||||
let setAcFan = 'auto'
|
||||
let setEco = 'auto'
|
||||
let setHvac = 'cool'
|
||||
let setFan = []
|
||||
let setCool = []
|
||||
let setMode = []
|
||||
let validNight = ['Night Mode','Bedtime Mode']
|
||||
let setSleep = []
|
||||
let setPeople = []
|
||||
let setDisplay = 'turn_on'
|
||||
let time = []
|
||||
let echoDotService = []
|
||||
let setBriefing = []
|
||||
let setBriefingDelay = []
|
||||
let type = msg.type
|
||||
let topic = msg.topic
|
||||
let isWakeup = context.get("isWakeup")
|
||||
@@ -67,15 +63,18 @@ if (type === 'sleep' && payload === 'off') {
|
||||
setDisplay = 'turn_on'
|
||||
echoDotService = 'turn_off'
|
||||
setPeople = 'turn_on'
|
||||
if (coolingActive === 'on') {
|
||||
if (validNight.includes(currentMode)) {
|
||||
time = 'night'
|
||||
setMode = 'Night Mode'
|
||||
} else {
|
||||
time = 'day'
|
||||
setMode = 'Day Mode'
|
||||
}
|
||||
} else if (type === 'sleep' && payload === 'on') {
|
||||
setDisplay = 'turn_off'
|
||||
echoDotService = 'turn_on'
|
||||
time = 'bedtime'
|
||||
setMode = 'Bedtime Mode'
|
||||
} else {
|
||||
time = msg.time
|
||||
}
|
||||
@@ -84,20 +83,9 @@ if (topic === 'mrbedroom-wakeup') {
|
||||
setSleep = 'turn_off'
|
||||
}
|
||||
|
||||
// Setup TTS briefing
|
||||
if (topic === 'mrbedroom-wakeup') {
|
||||
setBriefing = "master_bedroom_wakeup_briefing"
|
||||
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'
|
||||
}
|
||||
setMode = 'Day Mode'
|
||||
if (earlyNight === 'off') {
|
||||
setFan = "turn_off"
|
||||
if (ac === 'on') {
|
||||
@@ -118,7 +106,7 @@ if (time === 'day') {
|
||||
} else if (earlyNight === 'on') {
|
||||
if (ac === 'on') {
|
||||
if (danger === 'Extreme') {
|
||||
setTemp = bedTemp
|
||||
setTemp === bedTemp
|
||||
} else {
|
||||
setTemp = nightTemp
|
||||
}
|
||||
@@ -134,15 +122,16 @@ if (time === 'day') {
|
||||
} else {
|
||||
setHvac = 'off'
|
||||
}
|
||||
setEco = 'turn_on'
|
||||
if (hotDay === 'on') {
|
||||
setEco = 'turn_off'
|
||||
} else {
|
||||
setEco = 'turn_on'
|
||||
}
|
||||
}
|
||||
}
|
||||
// Night Time
|
||||
} else if (time === 'night') {
|
||||
// If this is being run at scheduled time, turn on input_boolean.master_bedroom_cooling_on
|
||||
if (type === 'auto') {
|
||||
setCool = 'turn_on'
|
||||
}
|
||||
setMode = 'Night Mode'
|
||||
// Decide temperature
|
||||
if (type === 'sleep' && payload === 'off') {
|
||||
setTemp = dayTemp
|
||||
@@ -153,11 +142,7 @@ if (time === 'day') {
|
||||
}
|
||||
// Decide eco mode
|
||||
if (sleeping === 'on') {
|
||||
if (ecoHold === 'on') {
|
||||
setEco = 'turn_on'
|
||||
} else {
|
||||
setEco = 'turn_off'
|
||||
}
|
||||
setEco = 'turn_off'
|
||||
} else {
|
||||
setEco = 'turn_on'
|
||||
}
|
||||
@@ -177,14 +162,11 @@ if (time === 'day') {
|
||||
}
|
||||
// Bed Time
|
||||
} else if (time === 'bedtime') {
|
||||
setMode = 'Bedtime Mode'
|
||||
setPeople = 'turn_off'
|
||||
if (ac === 'on') {
|
||||
setTemp = bedTemp
|
||||
if (ecoHold === 'on') {
|
||||
setEco = 'turn_on'
|
||||
} else {
|
||||
setEco = 'turn_off'
|
||||
}
|
||||
setEco = 'turn_off'
|
||||
if (acMode === 'AC') {
|
||||
setHvac = 'cool'
|
||||
setDisplay = 'turn_off'
|
||||
@@ -215,13 +197,15 @@ let sendFan = {
|
||||
}
|
||||
}
|
||||
|
||||
let sendCool = {
|
||||
let sendMode = {
|
||||
"payload": {
|
||||
"action": `input_boolean.${setCool}`,
|
||||
"action": "input_select.select_option",
|
||||
"target": {
|
||||
"entity_id": ["input_boolean.master_bedroom_cooling_on"]
|
||||
"entity_id": ["input_select.current_climate_mode_master_bedroom"]
|
||||
},
|
||||
"data": {}
|
||||
"data": {
|
||||
"option": setMode
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,13 +246,6 @@ let notify = {
|
||||
"fanmode": fanMode
|
||||
}
|
||||
|
||||
let sendBriefing = {
|
||||
"payload": {
|
||||
"action": `script.${setBriefing}`,
|
||||
},
|
||||
"delay": setBriefingDelay
|
||||
}
|
||||
|
||||
let sendHvac = {
|
||||
"payload": {
|
||||
"action": "climate.set_hvac_mode",
|
||||
@@ -335,12 +312,10 @@ node.log(`setAcFan: ${setAcFan}`)
|
||||
node.log(`setEco: ${setEco}`)
|
||||
node.log(`setHvac: ${setHvac}`)
|
||||
node.log(`setFan: ${setFan}`)
|
||||
node.log(`setCool: ${setCool}`)
|
||||
node.log(`setMode: ${setMode}`)
|
||||
node.log(`setSleep: ${setSleep}`)
|
||||
node.log(`setPeople: ${setPeople}`)
|
||||
node.log(`setDisplay: ${setDisplay}`)
|
||||
node.log(`setBriefing: ${setBriefing}`)
|
||||
node.log(`setBriefingDelay: ${setBriefingDelay}`)
|
||||
node.log(`time: ${time}`)
|
||||
node.log(`type: ${type}`)
|
||||
node.log(`topic: ${topic}`)
|
||||
@@ -348,13 +323,13 @@ node.log("----- Master Bedroom Climate: End Parameters -----")
|
||||
|
||||
// If this was an automated trigger, set the cooling context for the bedroom accordingly.
|
||||
|
||||
if (type === 'auto' && time != 'bedtime') {
|
||||
node.send([null, null, sendCool, null, null])
|
||||
node.log("Master Bedroom Climate: Cooling Context Set")
|
||||
if (type === 'auto') {
|
||||
node.send([null, null, sendMode, null])
|
||||
node.log("Master Bedroom Climate: Cooling Mode Context Set")
|
||||
}
|
||||
|
||||
// Automated responses
|
||||
if (type === 'auto' && allowed === 'on' && meltdown === 'off' && vacation === 'off') { //! allowed === 'off' currently because of upstairs heat issues. Need to figure out a way to still allow wakeup flow to run.
|
||||
if (type === 'auto' && allowed === 'on' && meltdown === 'off' && vacation === 'off') {
|
||||
node.log("Master Bedroom Climate: Auto")
|
||||
if (sleeping === 'on' && topic != 'mrbedroom-wakeup') {
|
||||
node.status({ fill: "red", shape: "ring", text: "Blocked (sleep mode)" })
|
||||
@@ -365,36 +340,35 @@ if (type === 'auto' && allowed === 'on' && meltdown === 'off' && vacation === 'o
|
||||
node.send([[sendDisplay, sendHvac, sendTemp, sendAcFan, sendEco], null, null, null])
|
||||
node.log("Master Bedroom Climate: Auto/Cooling")
|
||||
} else if (topic === 'mrbedroom-bedtime') {
|
||||
node.send([null, null, sendPeople, null, null])
|
||||
node.send([null, null, sendPeople, null])
|
||||
node.status({ fill: "green", shape: "dot", text: "Bedtime" })
|
||||
node.log("Master Bedroom Climate: Auto/Bedtime")
|
||||
if (ac === 'on') {
|
||||
node.send([[sendDisplay, sendHvac, sendTemp, sendAcFan, sendEco], null, null, null, null])
|
||||
node.send([[sendDisplay, sendHvac, sendTemp, sendAcFan, sendEco], null, null, null])
|
||||
node.log("Master Bedroom Climate: Auto/Bedtime/AC")
|
||||
}
|
||||
if (fanMode === 'fan') {
|
||||
node.send([null, sendFan, null, null, null])
|
||||
node.send([null, sendFan, null, null])
|
||||
node.log("Master Bedroom Climate: Auto/Bedtime/Fan")
|
||||
}
|
||||
} else if (topic === 'mrbedroom-fan' && fanMode === 'Fan') {
|
||||
node.status({ fill: "green", shape: "dot", text: "Fan Schedule" })
|
||||
node.send([null, sendFan, null, null, null])
|
||||
node.send([null, sendFan, null, null])
|
||||
node.log("Master Bedroom Climate: Auto/Fan")
|
||||
} else if (topic === 'mrbedroom-wakeup') {
|
||||
node.send([null, null, null, null, sendBriefing])
|
||||
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.send([null, sendFan, null, null])
|
||||
node.log("Master Bedroom Climate: Auto/Wakeup/Sleep Off")
|
||||
if (ac === 'on') {
|
||||
node.send([[sendDisplay, sendHvac, sendTemp, sendAcFan, sendEco], null, null, null, null])
|
||||
node.send([[sendDisplay, sendHvac, sendTemp, sendAcFan, sendEco], null, null, null])
|
||||
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.send([null, null, sendSleep, null])
|
||||
node.log("Master Bedroom Climate: Auto/Wakeup/Sleep On")
|
||||
}
|
||||
}
|
||||
@@ -404,26 +378,26 @@ if (type === 'auto' && allowed === 'on' && meltdown === 'off' && vacation === 'o
|
||||
node.log("Master Bedroom Climate: Manual")
|
||||
if (time === 'night') {
|
||||
node.status({ fill: "blue", shape: "dot", text: "Manual Night" })
|
||||
node.send([null, sendFan, null, null, null])
|
||||
node.send([null, sendFan, null, null])
|
||||
node.log("Master Bedroom Climate: Manual/Night")
|
||||
if (ac === 'on') {
|
||||
node.send([[sendDisplay, sendHvac, sendTemp, sendAcFan, sendEco], null, null, null, null])
|
||||
node.send([[sendDisplay, sendHvac, sendTemp, sendAcFan, sendEco], null, null, null])
|
||||
node.log("Master Bedroom Climate: Manual/Night/AC")
|
||||
}
|
||||
} else if (time === 'day') {
|
||||
node.status({ fill: "blue", shape: "dot", text: "Manual Day" })
|
||||
node.send([null, sendFan, null, null, null])
|
||||
node.send([null, sendFan, null, null])
|
||||
node.log("Master Bedroom Climate: Manual/Day")
|
||||
if (ac === 'on') {
|
||||
node.send([[sendDisplay, sendHvac, sendTemp, sendAcFan, sendEco], null, null, null, null])
|
||||
node.send([[sendDisplay, sendHvac, sendTemp, sendAcFan, sendEco], null, null, null])
|
||||
node.log("Master Bedroom Climate: Manual/Day/AC")
|
||||
}
|
||||
} else if (time === 'bedtime') {
|
||||
node.status({ fill: "blue", shape: "dot", text: "Manual Bedtime" })
|
||||
node.send([null, sendFan, null, null, null])
|
||||
node.send([null, sendFan, null, null])
|
||||
node.log("Master Bedroom Climate: Manual/Bedtime")
|
||||
if (ac === 'on') {
|
||||
node.send([[sendDisplay, sendHvac, sendTemp, sendAcFan, sendEco], null, null, null, null])
|
||||
node.send([[sendDisplay, sendHvac, sendTemp, sendAcFan, sendEco], null, null, null])
|
||||
node.log("Master Bedroom Climate: Manual/Bedtime/AC")
|
||||
}
|
||||
}
|
||||
@@ -431,28 +405,25 @@ if (type === 'auto' && allowed === 'on' && meltdown === 'off' && vacation === 'o
|
||||
// Sleep Switch Responses
|
||||
} else if (type === 'sleep') {
|
||||
if (payload === 'off') {
|
||||
node.send([null, null, sendPeople, null, null])
|
||||
node.send([null, null, sendPeople, null])
|
||||
}
|
||||
node.log("Master Bedroom Climate: Sleep")
|
||||
if (time === 'bedtime') {
|
||||
node.status({ fill: "blue", shape: "dot", text: "Sleep" })
|
||||
node.send([null, sendFan, [sendEchoDotDND,sendPeople], null, null])
|
||||
node.send([null, sendFan, [sendEchoDotDND,sendPeople], null])
|
||||
node.log("Master Bedroom Climate: Sleep/Bedtime")
|
||||
if (ac === 'on') {
|
||||
node.send([[sendDisplay, sendHvac, sendTemp, sendAcFan, sendEco], null, null, null, null])
|
||||
node.send([[sendDisplay, sendHvac, sendTemp, sendAcFan, sendEco], null, null, null])
|
||||
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.send([null, sendFan, sendEchoDotDND, null])
|
||||
node.log("Master Bedroom Climate: Sleep/Day")
|
||||
if (ac === 'on') {
|
||||
node.send([[sendDisplay, sendHvac, sendTemp, sendAcFan, sendEco], null, null, null, null])
|
||||
node.send([[sendDisplay, sendHvac, sendTemp, sendAcFan, sendEco], 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)
|
||||
} else if (meltdown === 'on') {
|
||||
|
||||
@@ -9,14 +9,12 @@ const currentSetTemp = states['climate.master_bedroom_aircon'].attributes.temper
|
||||
const coolingTime = states['input_boolean.master_bedroom_cooling_on'].state
|
||||
const sleeping = states['input_boolean.master_bedroom_sleeping'].state
|
||||
const hotDay = states['input_boolean.hot_day'].state
|
||||
const ecoHold = states['switch.master_bedroom_aircon_eco_hold'].state
|
||||
const fanModeAircon = states['input_select.master_bedroom_aircon_fan_mode'].state
|
||||
const topic = msg.topic
|
||||
|
||||
const airconEntity = ["climate.master_bedroom_aircon"]
|
||||
|
||||
let setTemp = {}
|
||||
let setEco = 'turn_on'
|
||||
let setEco = {}
|
||||
let duration = {}
|
||||
let end = {}
|
||||
let setHvac = {}
|
||||
@@ -24,11 +22,7 @@ let setHvac = {}
|
||||
if (topic === 'toggle') {
|
||||
if (hotDay === 'on' || sleeping === 'on') {
|
||||
setTemp = bedTemp
|
||||
if (ecoHold === 'on') {
|
||||
setEco = 'turn_on'
|
||||
} else {
|
||||
setEco = 'turn_off'
|
||||
}
|
||||
setEco = 'turn_off'
|
||||
} else {
|
||||
setTemp = nightTemp
|
||||
setEco = 'turn_on'
|
||||
@@ -37,11 +31,7 @@ if (topic === 'toggle') {
|
||||
if (currentSetTemp == bedTemp) {
|
||||
setTemp = nightTemp
|
||||
if (hotDay === 'on') {
|
||||
if (ecoHold === 'on') {
|
||||
setEco = 'turn_on'
|
||||
} else {
|
||||
setEco = 'turn_off'
|
||||
}
|
||||
setEco = 'turn_off'
|
||||
} else {
|
||||
setEco = 'turn_on'
|
||||
}
|
||||
@@ -119,7 +109,7 @@ let sendAcFan = {
|
||||
"entity_id": airconEntity
|
||||
},
|
||||
"data": {
|
||||
"fan_mode": fanModeAircon
|
||||
"fan_mode": "auto"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,7 @@ const lux = parseInt(states['sensor.master_bedroom_illuminance'].state)
|
||||
const threshold = parseInt(states['input_number.master_bedroom_lux_threshold'].state)
|
||||
const masterBedroomSleep = states['input_boolean.master_bedroom_sleeping'].state
|
||||
const kallenBedroomSleep = states['input_boolean.kallen_sleeping'].state
|
||||
const emmaBedroomSleep = states['input_boolean.emma_sleeping'].state
|
||||
const peopleSleeping = (masterBedroomSleep === 'on' || kallenBedroomSleep === 'on' || emmaBedroomSleep === 'on')
|
||||
const peopleSleeping = (masterBedroomSleep === 'on' || kallenBedroomSleep === 'on')
|
||||
const nightMode = states['input_boolean.night_mode'].state
|
||||
const payload = msg.payload
|
||||
const newDuration = duration * 60
|
||||
|
||||
@@ -2,17 +2,11 @@ const states = global.get('homeassistant.homeAssistant.states')
|
||||
const lights = states['light.upstairs_bathroom_lights'].state
|
||||
const duration = states['input_number.upstairs_bathroom_motion_off_delay'].state
|
||||
const lux = parseInt(states['sensor.upstairs_bathroom_illuminance'].state)
|
||||
const threshold = parseInt(states['input_number.upstairs_bathroom_lux_threshold'].state)
|
||||
const showerMode = states['input_boolean.shower_mode'].state
|
||||
const emmaBedroomSleep = states['input_boolean.emma_sleeping'].state
|
||||
const payload = msg.payload
|
||||
const newDuration = duration * 60
|
||||
|
||||
let threshold = parseInt(states['input_number.upstairs_bathroom_lux_threshold'].state)
|
||||
|
||||
if (emmaBedroomSleep === 'on') {
|
||||
threshold = 10
|
||||
}
|
||||
|
||||
let timerCancel = {
|
||||
"payload": "stop"
|
||||
}
|
||||
@@ -38,11 +32,11 @@ if (showerMode === 'off') {
|
||||
}
|
||||
|
||||
node.log("----- Upstairs Bathroom Motion Parameters Start -----")
|
||||
node.log(`Upstairs Bathroom payload: ${payload}`)
|
||||
node.log(`Upstairs Bathroom lights: ${lights}`)
|
||||
node.log(`Upstairs Bathroom duration: ${duration}`)
|
||||
node.log(`Upstairs Bathroom newDuration: ${newDuration}`)
|
||||
node.log(`Upstairs Bathroom lux: ${lux}`)
|
||||
node.log(`Upstairs Bathroom threshold: ${threshold}`)
|
||||
node.log(`Upstairs Bathroom showerMode: ${showerMode}`)
|
||||
node.log("Upstairs Bathroom payload: " + payload)
|
||||
node.log("Upstairs Bathroom lights: " + lights)
|
||||
node.log("Upstairs Bathroom duration: " + duration)
|
||||
node.log("Upstairs Bathroom newDuration: " + newDuration)
|
||||
node.log("Upstairs Bathroom lux: " + lux)
|
||||
node.log("Upstairs Bathroom threshold: " + threshold)
|
||||
node.log("Upstairs Bathroom showerMode: " + showerMode)
|
||||
node.log("----- Upstairs Bathroom Motion Parameters End -----")
|
||||
Reference in New Issue
Block a user