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

Hello,

Been searching this issue for hours, erad many posts regarding this, but acnnot figure what wrong. Beginner (you guessed) with home assistant, been using another sytem for more than 15 years.

Here’s the yaml that causes trouble :

alias: Ouvre VR Cage
description: "Ouvre partiellement ou totalement les volets, selon température, à heure fixée en variable ou au lever du soleil, le dernier de ces deux évènements"
triggers:
  - alias: Last of sunrise or 08:00
#    variables:
#      we: 1
#      h_sem: "07:00:00"
#      h_we:  "09:00:00"
  - platform: sun.sun
    event: sunrise
    offset: 0
  - platform: time
    at: "08:00:00"
#    - choose:
#      - conditions: "{{ we = 1 }}"
#        at: "{{ h_we }}"
#      - conditions: "{{ we = 0 }}"
#        at: "{{ h_sem }}"
conditions:
  - condition: sun.sun
    after: sunrise
  - condition: time
    after: "08:00:00"
#    - choose:
#      - conditions: "{{ we = 1 }}"
#        after: "{{ h_we }}"
#      - conditions: "{{ we = 0 }}"
#        after: "{{ h_sem }}"
#conditions:
  - condition: time
    weekday:
      - fri
      - thu
      - wed
      - tue
      - mon
    alias: Si Semaine
actions:
  - variables:
    t: {{ state_attr('weather.forecast_home', 'temperature') | float }}
  - choose:
    - conditions: "{{ t < 5.0 }}"
      sequence:
      - alias: Vr Nord Fermé, VR Porte à moitié 
        action: scene.turn_on
        metadata: {}
        target:
          entity_id: scene.vr_cage_tps_froid
    - conditions: "{{ t >= 5.0 }}"
      sequence:
      - alias: Vr Nord et Porte Ouverts
        action: scene.turn_on
        metadata: {}
        target:
          entity_id: scene.vr_cage_ouverts
mode: single

I’ve aready commented out multiple parts to simplify. Also tried to ‘debug’ by commenting out some parts in the “triggers” section, but the issue remains even with a triggers section reduced to the following. I don’t get it.

triggers: 
  - trigger: time
    at: "08:00:00"

Thanks for any help on this subject, I know it’s already been asked many times.

That line should be commented out.

As to the rest of it…

  • choose is an Action, it only belongs in the actions block.
  • t: should be indented 2 spaces.
  • All templates need to be either surrounded by quotes or indicated using a block scalar.

Removed most comments, including the “alias” line you mentionned, and added the missing indent in front of “t:”, resulting in this :

alias: Ouvre VR Cage
description: "Ouvre partiellement ou totalement les volets, selon température, à heure fixée en variable ou au lever du soleil, le dernier de ces deux évènements"
triggers: 
  - trigger: sun
    event: sunrise
    offset: 0
  - platform: time
  - trigger: time
    at: "08:00:00"
conditions: []
actions:
  - variables:
      t: {{ state_attr('weather.forecast_home', 'temperature') | float }}
  - choose:
    - conditions: "{{ t < 5.0 }}"
      sequence:
      - alias: Vr Nord Fermé, VR Porte à moitié 
        action: scene.turn_on
        metadata: {}
        target:
          entity_id: scene.vr_cage_tps_froid
    - conditions: "{{ t >= 5.0 }}"
      sequence:
      - alias: Vr Nord et Porte Ouverts
        action: scene.turn_on
        metadata: {}
        target:
          entity_id: scene.vr_cage_ouverts
mode: single

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

This one doesn’t have any data…

And the template for t is still missing quotes.

If you are new to YAML you may want to read YAML for Non-Programmers. It was helpful for me when I started out.

If you can explain the behavior you were trying for with the weekday/weekend conditions, we can probably help.

The - platform: time was to remove, it’s getting too late here (1 am almost) !
And the quotes for the “t” variable were the culprit for this error message.

I still don’t get why it relates to data[‘triggers’][0][‘platform’], when the eror was located at “action” level!
I’ve seen numerous posts where this kind of message was not easy to unterstand, and it’s also the case for me… why not something like data[‘actions’][0][‘variables’] in my case ??

Anyway, thanks a lot for sorting it out :wink:

Edit: going to bed now !