I want the motion sensor that turns on and off lights in the hallway to only turn on the lights if it's less than 300 lux outside, measured by a motion sensor outside on the same side as the hallway.
I can get the value in this template:
{{states("sensor.bevegelsessensor_ute_mellom_garasjen_og_hytta_illuminance") | float(0)}}
I just don't know how to get from there to use it as a condition in this motion sensor (that is triggered if the motion sensor light is activated with the boolean and any one sensor in the group "all motion sensors" in the hall is triggered)
{{ ('on' in states('input_boolean.bevegelsesstyrt_lys_i_ganga')) and ('on' in states('binary_sensor.alle_bevegelsessensorer_i_ganga')) and **('if the light outside is less than 300 lux')** }}
Can somebody please help me?