Forgot to actually copy the changes for the timer-finished function
This commit is contained in:
@ -11906,7 +11906,7 @@
|
||||
"z": "5e238cbbe6d612c9",
|
||||
"g": "f16f28689b7ec2b4",
|
||||
"name": "On/Off",
|
||||
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst stairwellLights = states['light.stairwell_led_strip'].state\nconst hallwayLights = states['light.hallway_overhead'].state\nconst earlyNightMode = states['binary_sensor.early_night_mode'].state\nconst nightMode = states['input_boolean.night_mode'].state\nconst goodnight = states['input_boolean.goodnight'].state\nconst masterBedroomSleep = states['input_boolean.master_bedroom_sleeping'].state\nconst duration = states['input_number.stairwell_lights_off_delay'].state\nconst lux = parseInt(states['sensor.stairwell_bottom_illuminance'].state)\nconst threshold = parseInt(states['input_number.stairwell_lux_threshold'].state)\nconst payload = msg.payload\nconst newDuration = duration * 60\n\nlet hallwayScene = {}\nlet hallwayAction = {}\n\nif (payload === 'on') {\n if (goodnight === 'on') {\n hallwayAction = 'off'\n } else if (nightMode === 'on' || masterBedroomSleep === 'on') {\n hallwayAction = 'on'\n hallwayScene = 'Dimmed'\n } else if (earlyNightMode === 'on') {\n hallwayAction = 'on'\n hallwayScene = 'Adaptive'\n } else {\n hallwayAction = 'off'\n }\n}\n\nmsg.hallway = hallwayAction\nmsg.scene = hallwayScene\n\nif (payload === 'on') {\n if (lux <= threshold || stairwellLights === 'on' || hallwayLights === 'on') {\n if (hallwayScene === 'Adaptive') {\n node.send([null,null,msg,msg])\n } else if (hallwayAction === 'on') {\n node.send([null,null,msg,null])\n }\n node.status({fill:'green',shape:'dot',text:'Lights On'})\n node.send([msg,null,null,null])\n } else {\n node.status({fill:'red',shape:'ring',text:'Too bright'})\n }\n} else if (payload === 'off') {\n if (stairwellLights === 'on') {\n msg.duration = newDuration\n node.status({fill:\"green\",shape:\"dot\",text:parseInt(duration) + ' minutes'})\n node.send([null,msg,null])\n } else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Lights already off\"})\n }\n}",
|
||||
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst stairwellLights = states['light.stairwell_led_strip'].state\nconst hallwayLights = states['light.hallway_overhead'].state\nconst earlyNightMode = states['binary_sensor.early_night_mode'].state\nconst nightMode = states['input_boolean.night_mode'].state\nconst goodnight = states['input_boolean.goodnight'].state\nconst masterBedroomSleep = states['input_boolean.master_bedroom_sleeping'].state\nconst duration = states['input_number.stairwell_lights_off_delay'].state\nconst lux = parseInt(states['sensor.stairwell_bottom_illuminance'].state)\nconst threshold = parseInt(states['input_number.stairwell_lux_threshold'].state)\nconst payload = msg.payload\nconst newDuration = duration * 60\n\nlet hallwayScene = {}\nlet hallwayAction = {}\n\nif (payload === 'on') {\n if (goodnight === 'on') {\n hallwayAction = 'off'\n } else if (nightMode === 'on' || masterBedroomSleep === 'on') {\n hallwayAction = 'on'\n hallwayScene = 'Dimmed'\n } else if (earlyNightMode === 'on') {\n hallwayAction = 'on'\n hallwayScene = 'Adaptive'\n } else {\n hallwayAction = 'off'\n }\n}\n\nmsg.hallway = hallwayAction\nmsg.scene = hallwayScene\n\nif (payload === 'on') {\n if (lux <= threshold || stairwellLights === 'on' || hallwayLights === 'on') {\n if (hallwayScene === 'Adaptive') {\n node.send([null,null,msg,msg])\n } else if (hallwayAction === 'on') {\n node.send([null,null,msg,null])\n }\n node.status({fill:'green',shape:'dot',text:'Lights On'})\n node.send([msg,null,null,null])\n } else {\n node.status({fill:'red',shape:'ring',text:'Too bright'})\n }\n} else if (payload === 'off') {\n if (stairwellLights === 'on') {\n msg.duration = newDuration\n node.status({fill:\"green\",shape:\"dot\",text:parseInt(duration) + ' minutes'})\n node.send([null,msg,null,null])\n } else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Lights already off\"})\n }\n}",
|
||||
"outputs": 4,
|
||||
"timeout": "",
|
||||
"noerr": 0,
|
||||
@ -12455,7 +12455,7 @@
|
||||
"z": "5e238cbbe6d612c9",
|
||||
"g": "f16f28689b7ec2b4",
|
||||
"name": "Settings",
|
||||
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst earlyNightMode = states['binary_sensor.early_night_mode'].state\nconst nightMode = states['input_boolean.night_mode'].state\nconst goodnight = states['input_boolean.goodnight'].state\nconst masterBedroomSleep = states['input_boolean.master_bedroom_sleeping'].state\n\nlet hallwayScene = {}\nlet hallwayAction = {}\n\nif (goodnight === 'on') {\n hallwayAction = 'off'\n} else if (masterBedroomSleep === 'off' && (earlyNightMode === 'on' || nightMode === 'on')) {\n hallwayAction = 'on'\n hallwayScene = 'Nightlight'\n} else {\n hallwayAction = 'off'\n}\n\nmsg.hallway = hallwayAction\n\n// Turn off Stairwell LED Strip\nnode.send([msg,null])\n\n// Hallway actions\nif (hallwayAction === 'on') {\n msg.scene = hallwayScene\n node.status({fill:'green',shape:'dot',text:'Hallway ' + hallwayScene})\n node.send([null,null,msg])\n} else if (hallwayAction === 'off') {\n node.status({fill:'green',shape:'dot',text:'Hallway Off'})\n node.send([null,msg,null])\n}",
|
||||
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst earlyNightMode = states['binary_sensor.early_night_mode'].state\nconst nightMode = states['input_boolean.night_mode'].state\nconst goodnight = states['input_boolean.goodnight'].state\nconst masterBedroomSleep = states['input_boolean.master_bedroom_sleeping'].state\n\nlet hallwayScene = {}\nlet hallwayAction = {}\n\nif (goodnight === 'on') {\n hallwayAction = 'off'\n} else if (masterBedroomSleep === 'off' && (earlyNightMode === 'on' || nightMode === 'on')) {\n hallwayAction = 'on'\n hallwayScene = 'Nightlight'\n} else {\n hallwayAction = 'off'\n}\n\nmsg.hallway = hallwayAction\n\n// Turn off Stairwell LED Strip\nnode.send([null,null,msg])\n\n// Hallway actions\nif (hallwayAction === 'on') {\n msg.scene = hallwayScene\n node.status({fill:'green',shape:'dot',text:'Hallway ' + hallwayScene})\n node.send([msg,null,null])\n} else if (hallwayAction === 'off') {\n node.status({fill:'green',shape:'dot',text:'Hallway Off'})\n node.send([null,msg,null])\n}",
|
||||
"outputs": 3,
|
||||
"timeout": 0,
|
||||
"noerr": 0,
|
||||
|
Reference in New Issue
Block a user