Use outdoor light level to determine whether porch light is needed

This commit is contained in:
2025-05-15 04:04:55 -04:00
parent 6734a213a1
commit 0e6d7d1906

View File

@ -19385,7 +19385,7 @@
"z": "b5717a86ce55bc29",
"g": "eeafd13be593ae69",
"name": "Check Parameters",
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst earlyNightMode = states['binary_sensor.early_night_mode'].state\nconst frontPorchToggle = states['input_boolean.front_porch_light_on'].state\nconst holidaymode = states['input_boolean.holiday_mode'].state\nconst currentholiday = states['input_select.holiday_animation'].state\nconst holiday = currentholiday.toLowerCase()\n\nlet holidayMsg = {\n \"holiday\": holiday\n}\n\nif (earlyNightMode === 'on' && frontPorchToggle === 'on') {\n if (holidaymode === 'on') {\n node.status({fill:\"blue\",shape:\"dot\",text:\"Holiday On\"})\n node.send([holidayMsg,msg])\n } else {\n node.status({fill:\"green\",shape:\"dot\",text:\"Holiday Off\"})\n node.send([null,msg])\n }\n} else {\n if (frontPorchToggle === 'off') {\n node.status({ fill: \"red\", shape: \"ring\", text: \"Disabled\" })\n } else if (earlyNightMode === 'off') {\n node.status({ fill: \"red\", shape: \"ring\", text: \"Daytime\" })\n }\n}",
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst outdoorLux = states['sensor.home_tempest_illuminance'].state\nconst threshold = states['input_number.front_porch_lux_threshold'].state\nconst frontPorchToggle = states['input_boolean.front_porch_light_on'].state\nconst holidaymode = states['input_boolean.holiday_mode'].state\nconst currentholiday = states['input_select.holiday_animation'].state\nconst holiday = currentholiday.toLowerCase()\n\nlet holidayMsg = {\n \"holiday\": holiday\n}\n\nif ((outdoorLux >= threshold) && frontPorchToggle === 'on') {\n if (holidaymode === 'on') {\n node.status({fill:\"blue\",shape:\"dot\",text:\"Holiday On\"})\n node.send([holidayMsg,msg])\n } else {\n node.status({fill:\"green\",shape:\"dot\",text:\"Holiday Off\"})\n node.send([null,msg])\n }\n} else {\n if (frontPorchToggle === 'off') {\n node.status({ fill: \"red\", shape: \"ring\", text: \"Disabled\" })\n } else if (outdoorLux < threshold) {\n node.status({ fill: \"red\", shape: \"ring\", text: \"Daytime\" })\n }\n}",
"outputs": 2,
"timeout": "",
"noerr": 0,