Automatin not triggered when turned on

Hi all,
please help, why is not triggered this automation when I turn it on?

 - alias: "rain water pump on"
   trigger:
    - platform: numeric_state
      entity_id: sensor.rain_water_pressure
      below: 333
    - platform: state
      entity_id: automation.rain_water_pump_on
      to: "on"
   action:
    - service: light.turn_on
      entity_id: light.rain_water_pump

Thanks.

That’s chicken and egg.
If the automation is not activated, it will not be executed when activated.

You should use an “input_boolean” for this kind of situation.

Triggers are acting on a change, ie. On-> Off or Above-> Below.
Conditions are acting on a range ie. below a value or on.

You used triggers, so you need the change to occur, ie the automation state changing from some value to on, but the automation is itself.
This is what will happend.

  • The automation is off.
  • No checks are being done on triggers.
  • You now set the automation to on.
  • Check if triggers occur, but the trigger that checks for a change to on is not being activated, because the state is on already. The trigger that checks the pressure will be triggered once the pressure switch from a value of 333 to one below 333, but not from a value below 333 to another value below 333, like 300->200.

Also remember that triggers are ORed and conditions are generally ANDed, unless otherwise specified.