Initial commit

This commit is contained in:
2023-09-28 12:28:27 -04:00
commit 25780c8c5d
30 changed files with 1777 additions and 0 deletions

View File

@ -0,0 +1,33 @@
const topic = msg.topic
const nightTemp = msg.nighttemp
const acMode = msg.acmode
const fanMode = msg.fanmode
let coolMsg = {
"payload": 'Master bedroom AC temp has been set to ' + nightTemp + '°F as scheduled',
"topic": 'AC Mode: Cooling'
}
let fanOnlyMsg = {
"payload": 'Too cold outside, AC running fan only.',
"topic": "AC Mode: Fan Only"
}
let fanSchedMsg = {
"payload": 'Master bedroom fan has been activated as scheduled.',
"topic": 'Fan Schedule Activated'
}
if (topic === 'mrbedroom-cooling') {
if (acMode === 'AC') {
node.status({fill:"green",shape:"dot",text:"AC Cooling"})
return coolMsg
} else if (acMode === 'Fan') {
node.status({fill:"green",shape:"dot",text:"AC Fan Only"})
return fanOnlyMsg
}
} else if (topic === 'mrbedroom-fan' && fanMode === 'Fan') {
node.status({fill:"green",shape:"dot",text:"Fan Schedule"})
return fanSchedMsg
} else {
node.status({fill:"red",shape:"ring",text:"Notification not sent"})
return null
}