Imbrication of condition

hello,

is it possible to put 2 conditions, but 1 inverted with “not” in same “if”?

- if:
            condition:
               - switch.is_off : template_switch
               not:              
                   - script.is_running: delayscript
               
            then:
              - light.turn_on: light_led
            else:
              - logger.log: "bouton pressé, mais sonnette desactiver pour deux heures"

thank you

Sébastien

Don’t post images of text.

But lambda condition is possible.

1 Like

OK can you show me an exemple please ?
sorry for image, there is no balise menu in android app.

Something like this:

        - if:
            condition:
                lambda: |-
                        if(id(template_switch).state == true && id(delayscript).state == false){
                          return true;
                        }else{
                          return false;
                        }
            then:
              - light.turn_on: light_led
            else:
              - logger.log: "bouton pressé, mais sonnette desactiver pour deux heures"
thank you

assuming the id’s is correct. But I have no way of knowing if it is.

1 Like

Thank you Hellis81 for your reply,

I have find the correct solution here:

   on_press:
      then:
      - if:
            condition:
                 lambda: |-
                  return !id(template_switch).state && !id(delayscript).is_running() ;
            then:
              - light.turn_on: light_led
            else:
              - logger.log: "bouton pressé, mais sonnette désactivée pour deux heures"