Night mode home sensor

I need some help with my template please…

  • 2 x pressure sensors on the bed
  • 1 x Lux sensor outside

I am to make a binary template sensor that triggers after 30 seconds if pleasure 1 or 2 is above 1.00 and it is between X time and below 25 lux leave.

I thought I had it correct but get this error…

TInvalid config for [template]: invalid template (TemplateSyntaxError: expected token ')', got '=') for dictionary value @ data['binary_sensor'][0]['state']. Got "{% set time = states('sensor.time') %}\n {{ states('sensor.pressure_1')|float > 1.00\n or states('sensor.pressure_2')|float > 1.00 or \n ( '20:00' < time < '24:00' ) or ( '00:00' =< time < '10:00' ) \n and states('sensor.out_side_lux')|float < 25 }}\n". (See /config/template.yaml, line 0).

 - name: "night mode home"
        state: >
          {% set time = states('sensor.time') %}
            {{ states('sensor.pressure_1')|float > 1.00
            or states('sensor.pressure_2')|float > 1.00  or 
            ( '20:00' < time < '24:00' ) or ( '00:00' =< time < '10:00' ) 
            and states('sensor.out_side_lux')|float < 25 }}
        delay_on: "00:00:30"

Any help would be Great… :slight_smile:

>= not =<

“Greater that or equal to” not “equal to or greater than”.

Also I assume the name indentation is a copy paste error.

Thanks for you help !