Error from If -then else on announcement in time period

HI Guys
I have several automations connected to washing machines, dryers and dishwasher that have several actions during a cycle process. I use a helper to count my tables / pods i also have it send a message to telegram but i also use announce to an Alexa group. Due to energy prices and potential plans i have decided to run these through the night. But i don’t want the Alexa group screaming at 3am what has finished. But i still want them on during the day if i run them.
I cannot just add a time because it turns off all actions. So a suggestion was use if then just for that action.
I have tried and tried but cannot get it to work here is my code.
But i get an error Message malformed: expected a dictionary for dictionary value @ data[‘action’][1][‘then’][0][‘target’]

Please can somebody help me

Use a “choose” in the action part, the “sequence” will only be executed if the condition is verified:


    alias: Cellar Washer One Finished (Duplicate)
    description: ""
    mode: single
    trigger:
      - platform: numeric_state
        entity_id: sensor.washer_one_current_consumption
        for:
          hours: 0
          minutes: 2
          seconds: 0
          milliseconds: 0
        below: "20"
    condition:
      - condition: state
        entity_id: input_boolean.washing_machine_one_running
        state: "on"
    action:
      - service: counter.decrement
        target:
          entity_id: counter.washing_machine_tablets
        data: {}
      - service: notify.bearcave
        data:
          message: >-
            Washer One has now finished, please leave the door open after you empty it
      - service: input_boolean.turn_off
        entity_id: input_boolean.washing_machine_one_running
      - choose:
          - conditions:
              - condition: time
                after: "07:00:00"
                before: "22:00:00"
            sequence:
              - service: notify.alexa_media
                data:
                  type: announce
                  message: >-
                    Washer One has now finished, please leave the door open after you empty it
                target:
                  - group.alexa_notify_media_players

HI
I cannot see how to add this in UI or do i just add in yaml and condition will be picked up in UI?
I have tried and it breaks it

I am developping directly in yaml so I cannot help you why this is not working in the UI…

Try this instead:

      - service: counter.decrement
        target:
          entity_id: counter.washing_machine_tablets
        data: {}
      - service: notify.bearcave
        data:
          message: >-
            Washer One has now finished, please leave the door open after you empty it
      - service: input_boolean.turn_off
        entity_id: input_boolean.washing_machine_one_running
      - condition: time
        after: "07:00:00"
        before: "22:00:00"
      - service: notify.alexa_media
        data:
          type: announce
          message: >-
            Washer One has now finished, please leave the door open after you empty it
        target:
          - group.alexa_notify_media_players