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