I'm a moron who should not be allowed near mathematical operations
This commit is contained in:
@ -19385,7 +19385,7 @@
|
||||
"z": "b5717a86ce55bc29",
|
||||
"g": "eeafd13be593ae69",
|
||||
"name": "Check Parameters",
|
||||
"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}",
|
||||
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst outdoorLux = parseInt(states['sensor.home_tempest_illuminance'].state)\nconst threshold = parseInt(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,
|
||||
|
Reference in New Issue
Block a user