Improve front porch light shutoff function
This commit is contained in:
@ -1,18 +1,30 @@
|
||||
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()
|
||||
const holidayMode = states['input_boolean.holiday_mode'].state
|
||||
const holidayHold = states['input_boolean.holiday_mode_hold'].state
|
||||
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 (holidaymode === 'on') {
|
||||
msg.holiday = holiday
|
||||
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])
|
||||
if (earlyNight === 'off') {
|
||||
if (holidayMode === 'on' && holidayHold === 'on') {
|
||||
node.status({fill:"blue",shape:"dot",text:"Daytime (Holiday Hold)"})
|
||||
node.send([msg,null])
|
||||
} else {
|
||||
node.status({fill:"red",shape:"ring",text:"Daytime"})
|
||||
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') {
|
||||
node.status({fill:"red",shape:"ring",text:"Blocked (Automation Off"})
|
||||
|
Reference in New Issue
Block a user