Choose together with other action

In this automatoin I have a under action: a service statement (which has to be executed always) and
a choose statement.

Although a condition from one of the choose options was true, the depending statment was not executed. :neutral_face:

  alias: Alarm Trigger DW Sensoren
  trigger:
  - platform: state
    entity_id: group.dw_sensoren
    to: 'on'
  condition:
    condition: or
    conditions:
    - condition: state
      entity_id: alarm_control_panel.home_alarm
      state: armed_away
    - condition: state
      entity_id: alarm_control_panel.home_alarm
      state: armed_home
  action:
  - service: alarm_control_panel.alarm_trigger
    entity_id: alarm_control_panel.home_alarm
  - choose:
      - conditions:
          - condition: state
            entity_id: group.dw_sensor_ug
            state: 'on'
        sequence:
          - service: switch.turn_on
            entity_id: group.light_ug
      - conditions:
          - condition: state
            entity_id: group.dw_sensor_eg
            state: 'on'
        sequence:
          - service: switch.turn_on
            entity_id: group.light_eg
    default: []

In general, it’s possible to use other statements on same level as choose statments under action?

You supplied either the wrong entities or the wrong service calls here:

      - conditions:
          - condition: state
            entity_id: group.dw_sensor_ug
            state: 'on'
        sequence:
          - service: switch.turn_on   <---- Switch
            entity_id: group.light_ug <---- Group
      - conditions:
          - condition: state
            entity_id: group.dw_sensor_eg
            state: 'on'
        sequence:
          - service: switch.turn_on   <---- Switch
            entity_id: group.light_eg <---- Group
  • If you want to turn on a Switch, change entity_id so it contains a Switch entity.
  • If you want to turn on a Group, change service so it contains the homeassistant.turn_on service.
1 Like

Oh, thank you! :crazy_face:
I thought I’ve copied this out of a running automation, but it seems that I’ve mixed up the code by restructuring my automations… :woozy_face:

1 Like