Change to switch for eco mode in master bedroom aircon
home_automation/Home-Assistant-Configs#237
This commit is contained in:
@ -100,15 +100,15 @@ if (time === 'day') {
|
||||
if (ac === 'on') {
|
||||
if (danger === 'Extreme') {
|
||||
setTemp = nightTemp
|
||||
setEco = "eco"
|
||||
setEco = "turn_on"
|
||||
setHvac = "cool"
|
||||
} else if (hotDay === 'on' || heatWarning === 'on') {
|
||||
setTemp = dayTemp
|
||||
setEco = "eco"
|
||||
setEco = "turn_on"
|
||||
setHvac = "cool"
|
||||
} else {
|
||||
setTemp = nightTemp
|
||||
setEco = "eco"
|
||||
setEco = "turn_on"
|
||||
setHvac = "off"
|
||||
}
|
||||
}
|
||||
@ -132,9 +132,9 @@ if (time === 'day') {
|
||||
setHvac = 'off'
|
||||
}
|
||||
if (hotDay === 'on') {
|
||||
setEco = 'none'
|
||||
setEco = 'turn_off'
|
||||
} else {
|
||||
setEco = 'eco'
|
||||
setEco = 'turn_on'
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -154,9 +154,9 @@ if (time === 'day') {
|
||||
}
|
||||
// Decide eco mode
|
||||
if (sleeping === 'on') {
|
||||
setEco = 'none'
|
||||
setEco = 'turn_off'
|
||||
} else {
|
||||
setEco = 'eco'
|
||||
setEco = 'turn_on'
|
||||
}
|
||||
// Decide HVAC mode
|
||||
if (acMode === 'AC') {
|
||||
@ -177,7 +177,7 @@ if (time === 'day') {
|
||||
setPeople = 'turn_off'
|
||||
if (ac === 'on') {
|
||||
setTemp = bedTemp
|
||||
setEco = 'none'
|
||||
setEco = 'turn_off'
|
||||
if (acMode === 'AC') {
|
||||
setHvac = 'cool'
|
||||
} else if (acMode === 'Fan') {
|
||||
@ -286,13 +286,11 @@ let sendTemp = {
|
||||
|
||||
let sendEco = {
|
||||
"payload": {
|
||||
"action": "climate.set_preset_mode",
|
||||
"action": `switch.${setEco}`,
|
||||
"target": {
|
||||
"entity_id": masterBedroomAircon
|
||||
"entity_id": ["switch.master_bedroom_aircon_eco_mode"]
|
||||
},
|
||||
"data": {
|
||||
"preset_mode": setEco
|
||||
}
|
||||
"data": {}
|
||||
}
|
||||
}
|
||||
|
||||
@ -354,14 +352,14 @@ if (type === 'auto' && allowed === 'on' && meltdown === 'off' && vacation === 'o
|
||||
} else {
|
||||
if (topic === 'mrbedroom-cooling' && ac === 'on') {
|
||||
node.status({ fill: "green", shape: "dot", text: "Cooling Schedule" })
|
||||
node.send([[sendHvac, sendTemp, sendEco, sendAcFan], null, null, null])
|
||||
node.send([[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.status({ fill: "green", shape: "dot", text: "Bedtime" })
|
||||
node.log("Master Bedroom Climate: Auto/Bedtime")
|
||||
if (ac === 'on') {
|
||||
node.send([[sendHvac, sendTemp, sendEco, sendAcFan], null, null, null, null])
|
||||
node.send([[sendHvac, sendTemp, sendAcFan, sendEco], null, null, null, null])
|
||||
node.log("Master Bedroom Climate: Auto/Bedtime/AC")
|
||||
}
|
||||
if (fanMode === 'fan') {
|
||||
@ -381,7 +379,7 @@ if (type === 'auto' && allowed === 'on' && meltdown === 'off' && vacation === 'o
|
||||
node.send([null, sendFan, null, null, null])
|
||||
node.log("Master Bedroom Climate: Auto/Wakeup/Sleep Off")
|
||||
if (ac === 'on') {
|
||||
node.send([[sendHvac, sendTemp, sendEco, sendAcFan], null, null, null, null])
|
||||
node.send([[sendHvac, sendTemp, sendAcFan, sendEco], null, null, null, null])
|
||||
node.log("Master Bedroom Climate: Auto/Wakeup/AC On")
|
||||
}
|
||||
} else if (sleeping === 'on') {
|
||||
@ -399,7 +397,7 @@ if (type === 'auto' && allowed === 'on' && meltdown === 'off' && vacation === 'o
|
||||
node.send([null, sendFan, null, null, null])
|
||||
node.log("Master Bedroom Climate: Manual/Night")
|
||||
if (ac === 'on') {
|
||||
node.send([[sendHvac, sendTemp, sendEco, sendAcFan], null, null, null, null])
|
||||
node.send([[sendHvac, sendTemp, sendAcFan, sendEco], null, null, null, null])
|
||||
node.log("Master Bedroom Climate: Manual/Night/AC")
|
||||
}
|
||||
} else if (time === 'day') {
|
||||
@ -407,7 +405,7 @@ if (type === 'auto' && allowed === 'on' && meltdown === 'off' && vacation === 'o
|
||||
node.send([null, sendFan, null, null, null])
|
||||
node.log("Master Bedroom Climate: Manual/Day")
|
||||
if (ac === 'on') {
|
||||
node.send([[sendHvac, sendTemp, sendEco, sendAcFan], null, null, null, null])
|
||||
node.send([[sendHvac, sendTemp, sendAcFan, sendEco], null, null, null, null])
|
||||
node.log("Master Bedroom Climate: Manual/Day/AC")
|
||||
}
|
||||
} else if (time === 'bedtime') {
|
||||
@ -415,7 +413,7 @@ if (type === 'auto' && allowed === 'on' && meltdown === 'off' && vacation === 'o
|
||||
node.send([null, sendFan, null, null, null])
|
||||
node.log("Master Bedroom Climate: Manual/Bedtime")
|
||||
if (ac === 'on') {
|
||||
node.send([[sendHvac, sendTemp, sendEco, sendAcFan], null, null, null, null])
|
||||
node.send([[sendHvac, sendTemp, sendAcFan, sendEco], null, null, null, null])
|
||||
node.log("Master Bedroom Climate: Manual/Bedtime/AC")
|
||||
}
|
||||
}
|
||||
@ -431,7 +429,7 @@ if (type === 'auto' && allowed === 'on' && meltdown === 'off' && vacation === 'o
|
||||
node.send([null, sendFan, [sendEchoDotDND,sendPeople], null, null])
|
||||
node.log("Master Bedroom Climate: Sleep/Bedtime")
|
||||
if (ac === 'on') {
|
||||
node.send([[sendDisplay, sendHvac, sendTemp, sendEco, sendAcFan], null, null, null, null])
|
||||
node.send([[sendDisplay, sendHvac, sendTemp, sendAcFan, sendEco], null, null, null, null])
|
||||
node.log("Master Bedroom Climate: Sleep/Bedtime/AC")
|
||||
}
|
||||
} else {
|
||||
@ -439,7 +437,7 @@ if (type === 'auto' && allowed === 'on' && meltdown === 'off' && vacation === 'o
|
||||
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.send([[sendDisplay, sendHvac, sendTemp, sendAcFan, sendEco], null, null, null, null])
|
||||
node.log(`Master Bedroom Climate: Sleep/${convertToTitleCase(time)}/AC`)
|
||||
}
|
||||
if (time === 'day' && isWakeup === false) {
|
||||
|
Reference in New Issue
Block a user