Improve front porch light shutoff function
This commit is contained in:
@ -1,19 +1,31 @@
|
|||||||
const states = global.get('homeassistant.homeAssistant.states')
|
const states = global.get('homeassistant.homeAssistant.states')
|
||||||
const frontPorchToggle = states['input_boolean.front_porch_light_on'].state
|
const frontPorchToggle = states['input_boolean.front_porch_light_on'].state
|
||||||
const deliveryMode = states['input_boolean.delivery_mode'].state
|
const deliveryMode = states['input_boolean.delivery_mode'].state
|
||||||
const holidaymode = states['input_boolean.holiday_mode'].state
|
const holidayMode = states['input_boolean.holiday_mode'].state
|
||||||
const currentholiday = states['input_select.holiday_animation'].state
|
const holidayHold = states['input_boolean.holiday_mode_hold'].state
|
||||||
const holiday = currentholiday.toLowerCase()
|
const currentHoliday = states['input_select.holiday_animation'].state
|
||||||
|
const earlyNight = states['binary_sensor.early_night_mode'].state
|
||||||
|
const holiday = currentHoliday.toLowerCase()
|
||||||
|
|
||||||
if (frontPorchToggle === 'on' && deliveryMode === 'off') {
|
if (frontPorchToggle === 'on' && deliveryMode === 'off') {
|
||||||
if (holidaymode === 'on') {
|
if (earlyNight === 'off') {
|
||||||
msg.holiday = holiday
|
if (holidayMode === 'on' && holidayHold === 'on') {
|
||||||
node.status({fill:"blue",shape:"dot",text:"Holiday On"})
|
node.status({fill:"blue",shape:"dot",text:"Daytime (Holiday Hold)"})
|
||||||
node.send([msg,null])
|
node.send([msg,null])
|
||||||
} else {
|
} else {
|
||||||
node.status({fill:"green",shape:"dot",text:"Holiday Off"})
|
node.status({fill:"red",shape:"ring",text:"Daytime"})
|
||||||
node.send([null,msg])
|
node.send([null,msg])
|
||||||
}
|
}
|
||||||
|
} else if (earlyNight === 'on') {
|
||||||
|
if (holidayMode === 'on') {
|
||||||
|
msg.holiday = holiday
|
||||||
|
node.status({fill:"blue",shape:"dot",text:"Night (Holiday On)"})
|
||||||
|
node.send([msg,null])
|
||||||
|
} else {
|
||||||
|
node.status({fill:"green",shape:"dot",text:"Night (Holiday Off)"})
|
||||||
|
node.send([null,msg])
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if (frontPorchToggle === 'off') {
|
} else if (frontPorchToggle === 'off') {
|
||||||
node.status({fill:"red",shape:"ring",text:"Blocked (Automation Off"})
|
node.status({fill:"red",shape:"ring",text:"Blocked (Automation Off"})
|
||||||
} else if (deliveryMode === 'on') {
|
} else if (deliveryMode === 'on') {
|
||||||
|
Reference in New Issue
Block a user