diff --git a/front-porch/check-parameters.js b/front-porch/check-parameters.js index a3130f8..18ba2f8 100644 --- a/front-porch/check-parameters.js +++ b/front-porch/check-parameters.js @@ -1,5 +1,6 @@ const states = global.get('homeassistant.homeAssistant.states') -const earlyNightMode = states['binary_sensor.early_night_mode'].state +const outdoorLux = states['sensor.home_tempest_illuminance'].state +const threshold = states['input_number.front_porch_lux_threshold'].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 @@ -9,7 +10,7 @@ let holidayMsg = { "holiday": holiday } -if (earlyNightMode === 'on' && frontPorchToggle === 'on') { +if ((outdoorLux >= threshold) && frontPorchToggle === 'on') { if (holidaymode === 'on') { node.status({fill:"blue",shape:"dot",text:"Holiday On"}) node.send([holidayMsg,msg]) @@ -20,7 +21,7 @@ if (earlyNightMode === 'on' && frontPorchToggle === 'on') { } else { if (frontPorchToggle === 'off') { node.status({ fill: "red", shape: "ring", text: "Disabled" }) - } else if (earlyNightMode === 'off') { + } else if (outdoorLux < threshold) { node.status({ fill: "red", shape: "ring", text: "Daytime" }) } } \ No newline at end of file