Setup conditions in automation

Hi! I need some help to configure conditions in my automation. I want to set up two conditions and if one or both of them is not confimed the automation will not execute. How should I set up the conditions part in my automation?

Set both events as triggers and also as conditions. When either becomes true, the automation will trigger, but it will stop if a condition fails.

Could you give me an example?

My plan is that a magnetic sensor shall work as the trigger for my automation. Then I want conditions that controls if the automation shall execute or not. The conditions terms I want is:

if one of the conditions is not confirmed then the automation will not be fired.

Did you read this manual?

I have, but i cant figure it out. I think mixed and and or can help me, but dont understand how to set it up.

Maybe you can tell some details, what you are trying to setup

My automation is now two automation. Is i possible to put them together?

alias: "Alarm not_trigged"
trigger:
  - platform: state
    entity_id: switch.larm_grovkk
    state: "on"
condition:
  condition: and
  conditions:
    - condition: state
      entity_id: 'group.hemma'
      state: 'not_home'
    - condition: state
      entity_id: 'switch.alarm'
      state: 'off'
    - condition: or
      conditions:
      - condition: state
        entity_id: 'group.hemma'
        state: 'home'
      - condition: state
        entity_id: switch.alarm
        state: 'on'
action:
  service: script.alarm_triggered

and

alias: "Alarm trigged"
trigger:
  - platform: state
    entity_id: switch.larm_grovkk
    state: "on"
condition:
  condition: and
  conditions:
    - condition: state
      entity_id: 'group.hemma'
      state: 'not_home'
    - condition: state
      entity_id: 'switch.alarm'
      state: 'on'
action:
  service: script.alarm_triggered

I’m not sure why you’d want to combine those. Do you do the same thing when it’s triggered and when it’s not?

You’ve got “switch.larm_grovkk = on” triggering both automations. Is that intended?

Also - if that’s a switch, it just means that you’re triggering the automation whenever that switch is flipped. Or does the switch represent your alarm being tripped?