Automation Action Sequence Error

Hey ya’ll. I am working on some automation for Schneider Insight gateways and XW+ Inverters. I am successfully reading and writing via ModBus. I can use a Select_Input combobox to set the Auxiliary Relay Control to “Automatic,” “Manual Off,” or “Manual On.” When I try to add additional actions to the Sequence, it ends up with an error every time.

- id: AuxRelay_Status
  alias: Auxiliary Relay Status
  description: "Write the Auxiliary Relay status to ModBus."
  mode: single
  triggers:
    - trigger: state
      entity_id: input_select.Aux_Relay
  conditions: []
  actions:
    - choose:
      # First condition/action pair.
      - conditions:
        - condition: state
          entity_id: input_select.Aux_Relay
          state: "Manual Off"
        sequence:
          - data:
              hub: Schneider_SunVault
              address: 444
              slave: 12
              value: 0
            action: modbus.write_register
          - delay:
            milliseconds: 100
          - service: persistent_notifiation.create
            data:
              title: "Automatkon Alert"
              message: >
                The Auxiliary Relay was successfully set to Manual Off.
                notification_id: "AuxRelayUpdate"
      # Second condition/action pair.
      - conditions:
        - condition: state
          entity_id: input_select.Aux_Relay
          state: "Manual On"
        sequence:
          - service: modbus.write_register
            data:
              hub: Schneider_SunVault
              address: 444
              slave: 12
              value: 1
      # Third condition/action pair.
      - conditions:
        - condition: state
          entity_id: input_select.Aux_Relay
          state: "Automatic"
        sequence:
          - service: modbus.write_register
            data:
              hub: Schneider_SunVault
              address: 444
              slave: 12
              value: 2

      default:
        - service: persistent_notification.create
          data:
            title: "Automation Alert"
            message: "Auxiliary Relay set to Default Action."
            notification_id: "99999"

    - service: persistent_notification.create
      data:
        title: "Automation Alert"
        message: >
          A sensor was triggered. The current time is {{ now().strftime('%H:%M') }}.
          
          Auxiliary Relay is set to {{ states('sensor.SchneiderXW_Auxiliary_Relay_Status') }}.
        notification_id: "12345678901234567890"

This is my handwritten code included in the Automations.yaml file. Like I said, the code works perfectly, so long as I only have the modbus.write_register action enabled. As soon as I add the delay or notification, it fails with the error:

The automation “Auxiliary Relay Status” (automation.auxiliary_relay_status) is not active because the configuration has errors.

Error:extra keys not allowed @ data['actions'][0]['choose'][0]['sequence'][1]['milliseconds']. Got 100 offset None should be format 'HH:MM', 'HH:MM:SS' or 'HH:MM:SS.F' for dictionary value @ data['actions'][0]['choose'][0]['sequence'][1]['delay']. Got None.

As a sidenote, I am not able to create Automations via the GUI, either. I can completely create them and edit the code, but I receive the following error when I try to save it. The code is saved in my Automations.yaml file, but is never read on configuration load.

Your new automation was saved, but waiting for it to set up has timed out. This could be due to errors parsing your configuration.yaml, please check the configuration in developer tools. Your automation will not be visible until this is corrected and automations are reloaded. Changes to area, category, or labels were not saved and must be reapplied.
You may continue to wait for a response from the server, in case it is just taking an unusually long time to process this automation.

I have cleared my browser cache, cleared all browser data, restarted the Home Assistant Pi, and tried on a different computer with a different Pi. Both have very similar file and documentation setups (replicating the system at home vs work on slightly different solar installlations). Both create the exact same error.

# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  extra_module_url:
    - /local/card-mod.js
  themes: !include_dir_merge_named themes

# Enable the Logger for ModBus.
logger:
  default: warning
  logs:
    homeassistant.components.modbus: debug
    pymodbus: debug

# Load template sensors.
automation ui: #include Automations.yaml
automation yaml: !include_dir_merge_list Automations
modbus: !include_dir_merge_list ModBus503/
scene: !include scenes.yaml
# script: !include_dir merge_list Scripts/
template: !include_dir_merge_list Templates/

input_select:
  aux_relay:
    name: "Aux Relay Status"
    options:
      - "Automatic"
      - "Manual On"
      - "Manual Off"
    initial: "Manual Off"
          - delay:
            milliseconds: 100

Should be:

          - delay:
              milliseconds: 100

See the examples here: Script Syntax - Home Assistant

Ugh, all of that debugging for a small indent error! I completely missed it. The File Editor checked it off as a properly formatted and indented file, too. The case-sensitive environment also messes me sometimes.

Thanks so much!

1 Like