Initial commit
This commit is contained in:
33
climate/master-bedroom/notifications.js
Normal file
33
climate/master-bedroom/notifications.js
Normal 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
|
||||
}
|
Reference in New Issue
Block a user