Required key not provided @ data[4]['platform']

Hi,

I’ve this error in log,

Automation with alias 'Tariffe energetiche' could not be validated and has been disabled: required key not provided @ data['action']. Got None required key not provided @ data['trigger'][4]['platform']. Got None

and automation doesn’t start. File editor, validate it
Can you help me?

- id: "Tariffe_energetiche"
  alias: "Tariffe energetiche"
  description: ''
  initial_state: true
  trigger:
      - platform: time
        id: "7"
        at: '7:00:00'
        variables:
          tariff: "F2"
      - platform: time
        id: "8"
        at: '8:00:00'
        variables:
          tariff: "F1"
      - platform: time
        id: "19"
        at: '19:00:00'
        variables:
          tariff: "F2"
      - platform: time
        id: "23"
        at: '23:00:00'
        variables:
          tariff: "F3"
        condition:
        action:
      - choose:
          - conditions:
              - condition: trigger
                id: "7"
            sequence:
              - condition: time
                weekday:
                - mon
                - tue
                - wed
                - thu
                - fri
                - sat
              - service: select.select_option
                target:
                  entity_id: select.montly_energy
                data:
                  option: "{{ tariff }}"
          - conditions:
              - condition: trigger
                id: "8"
            sequence:
              - condition: time
                weekday:
                - mon
                - tue
                - wed
                - thu
                - fri
              - service: select.select_option
                target:
                  entity_id: select.montly_energy
                data:
                  option: "{{ tariff }}"
          - conditions:
              - condition: trigger
                id: "19"
            sequence:
              - condition: time
                weekday:
                - mon
                - tue
                - wed
                - thu
                - fri
              - service: select.select_option
                target:
                  entity_id: select.montly_energy
                data:
                  option: "{{ tariff }}"
          - conditions:
              - condition: trigger
                id: "23"
            sequence:
              - service: select.select_option
                target:
                  entity_id: select.montly_energy
                data:
                  option: "{{ tariff }}"
                mode: single

In configuration.yaml I’ve this code

utility_meter:
  montly_energy:
    source: sensor.tot_kwh
    cycle: monthly
    tariffs:
      - F1
      - F2
      - F3

Thx

Roberto

Your yaml is not properly aligned.
Those 2 should be at the same level as trigger:

2 Likes

That should be

- id: "Tariffe_energetiche"
  alias: "Tariffe energetiche"
  description: ''
  initial_state: true
  trigger:
    - platform: time
      id: "7"
      at: '7:00:00'
      variables:
        tariff: "F2"
    - platform: time
      id: "8"
      at: '8:00:00'
      variables:
        tariff: "F1"
    - platform: time
      id: "19"
      at: '19:00:00'
      variables:
        tariff: "F2"
    - platform: time
      id: "23"
      at: '23:00:00'
      variables:
        tariff: "F3"
  condition: []
  action:
    - choose:
        - conditions:
            - condition: trigger
              id: "7"
          sequence:
            - condition: time
              weekday:
              - mon
              - tue
              - wed
              - thu
              - fri
              - sat
            - service: select.select_option
              target:
                entity_id: select.montly_energy
              data:
                option: "{{ tariff }}"
        - conditions:
            - condition: trigger
              id: "8"
          sequence:
            - condition: time
              weekday:
              - mon
              - tue
              - wed
              - thu
              - fri
            - service: select.select_option
              target:
                entity_id: select.montly_energy
              data:
                option: "{{ tariff }}"
        - conditions:
            - condition: trigger
              id: "19"
          sequence:
            - condition: time
              weekday:
              - mon
              - tue
              - wed
              - thu
              - fri
            - service: select.select_option
              target:
                entity_id: select.montly_energy
              data:
                  option: "{{ tariff }}"
        - conditions:
            - condition: trigger
              id: "23"
          sequence:
            - service: select.select_option
              target:
                entity_id: select.montly_energy
              data:
                option: "{{ tariff }}"
  mode: single