Message malformed: expected str for dictionary value @ data['triggers'][0]['platform']

I am trying to announce the time on the hour between the hours of 7am and 9pm. However, when I save the following yaml I receive this syntax error,
(Message malformed: expected str for dictionary value @ data[‘triggers’][0][‘platform’])

alias: Notification - Time announce
description: “”
trigger:

  • platform: time_pattern
    minutes: “0”
    seconds: “0”
    condition:

  • condition: time
    after: “06:00:00”
    before: “22:00:00”

    weekday:

    • mon
    • tue
    • wed
    • thu
    • fri
    • sat
    • sun
      action:
  • service: tts.google_translate_say
    metadata: {}
    data:
    cache: true
    entity_id: media_player.all
    message: Time is {{now().strftime("%I %M %p")}}

I have checked the sytax with two online yaml checkers both of which give this code a green light.

regards
Douglas (nube)

You need to post the yank correctly formatted.
Check the FAQ for guidance

alias: Notification - Time announce
description: “”
trigger:

  • platform: time_pattern
    minutes: “0”
    seconds: “0”
    condition:
  • condition: time
    after: 07:58:00
    before: 22:00:00
    weekday:
    • mon
    • tue
    • wed
    • thu
    • fri
    • sat
    • sun
      action:
  • service: tts.google_translate_say
    metadata: {}
    data:
    cache: true
    entity_id: media_player.all
    message: Time is {{now().strftime("%I %M %p")}}

Link for understanding how to post your code using the forum standards

:one::one: Format it properly

When sharing the code, share it as text and not an image. When you do that, remember that spacing is critical in YAML, and if you just throw the code on the page then it’ll look ugly and nobody will know if the problem is because of spacing. We need you to use code blocks and appropriate markup.

1 Like

Yes. You should format properly as stated above.

But I believe your first ‘condition’ should be plural.

<pre style='color:#1f1c1b;background-color:#ffffff;'>
alias: Notification - Time announce
description: &quot;&quot;
trigger:
  - platform: time_pattern
    minutes: &quot;0&quot;
    seconds: &quot;0&quot;
condition:
  - condition: time
    after: &quot;06:00:00&quot;
    before: &quot;22:00:00&quot;

    weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
      - sat
      - sun
action:
  - service: tts.google_translate_say
    metadata: {}
    data:
      cache: true
      entity_id: media_player.all
      message: Time is {{now().strftime(\&quot;%I %M %p\&quot;)}}
</pre>

sorry it has taken me several tries to retain formating of the code while sharing.`