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,26 @@
const states = global.get('homeassistant.homeAssistant.states')
const earlyNightMode = states['binary_sensor.early_night_mode'].state
const frontPorchToggle = states['input_boolean.front_porch_light_on'].state
const holidaymode = states['input_boolean.holiday_mode'].state
const currentholiday = states['input_select.holiday_animation'].state
const holiday = currentholiday.toLowerCase()
let holidayMsg = {
"holiday": holiday
}
if (earlyNightMode === 'on' && frontPorchToggle === 'on') {
if (holidaymode === 'on') {
node.status({fill:"blue",shape:"dot",text:"Holiday On"})
node.send([holidayMsg,msg])
} else {
node.status({fill:"green",shape:"dot",text:"Holiday Off"})
node.send([null,msg])
}
} else {
if (frontPorchToggle === 'off') {
node.status({ fill: "red", shape: "ring", text: "Disabled" })
} else if (earlyNightMode === 'off') {
node.status({ fill: "red", shape: "ring", text: "Daytime" })
}
}

13
front-porch/delay.js Normal file
View File

@ -0,0 +1,13 @@
const states = global.get('homeassistant.homeAssistant.states')
const delay = states['input_number.front_porch_motion_off_delay'].state
const duration = delay * 60
const lights = states['light.front_porch_light'].state
msg.duration = duration
if (lights === 'on') {
node.status({fill:"green",shape:"dot",text: parseInt(delay) + " minutes"})
node.send(msg)
} else {
node.status({fill:"red",shape:"ring",text:"Light Off"})
}

12
front-porch/if-motion.js Normal file
View File

@ -0,0 +1,12 @@
const states = global.get('homeassistant.homeAssistant.states')
const deliveryMode = states['input_boolean.delivery_mode'].state
const detect = msg.detect
node.send([null,msg])
if (detect === 'motion' && deliveryMode === 'on') {
node.status({fill:"green",shape:"dot",text:"Motion/Delivery"})
node.send([msg,null])
} else {
node.status({fill:"green",shape:"dot",text:"Not Motion"})
}

20
front-porch/shut-off.js Normal file
View File

@ -0,0 +1,20 @@
const states = global.get('homeassistant.homeAssistant.states')
const frontPorchToggle = states['input_boolean.front_porch_light_on'].state
const deliveryMode = states['input_boolean.delivery_mode'].state
const holidaymode = states['input_boolean.holiday_mode'].state
const currentholiday = states['input_select.holiday_animation'].state
const holiday = currentholiday.toLowerCase()
if (frontPorchToggle === 'on' && deliveryMode === 'off') {
if (holidaymode === 'on') {
node.status({fill:"blue",shape:"dot",text:"Holiday On"})
node.send([msg,null])
} else {
node.status({fill:"green",shape:"dot",text:"Holiday Off"})
node.send([null,msg])
}
} else if (frontPorchToggle === 'off') {
node.status({fill:"red",shape:"ring",text:"Blocked (Automation Off"})
} else if (deliveryMode === 'on') {
node.status({fill:"red",shape:"ring",text:"Blocked (Delivery Mode)"})
}