26 lines
979 B
JavaScript
26 lines
979 B
JavaScript
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" })
|
|
}
|
|
} |