Automation Message Action

All,

New here and racking my brain here on why the YAML editor is giving me this error and others when I’m trying to create this notification automation. I basically want to have a push notification sent when the attribute “errorMessage” for “vacuum.chopper” changes from null to some other value and I want to push the error message and the time to a notify group.

The push notification is working, but not with the data pulled form the entity’s attributes. I can’t seem to get the formatting correct.

Error

missed comma between flow collection entries at line 120, column 63:
     ... vacuum.chopper', 'friendly_name') }} is reporting ":" {{ state_a ... 
                          ^

Automation

- id: '1631847434654'
  alias: Automower Notifications
  description: Advise me when Chopper is having issues
  trigger:
  - platform: state
    entity_id: vacuum.chopper
    attribute: errorMessage
    for:
      hours: 0
      minutes: 0
      seconds: 30
      milliseconds: 0
  condition:
  - condition: not
    conditions:
    - condition: state
      entity_id: vacuum.chopper
      attribute: errorMessage
      state: null
  action:
  - service: notify.all_devices
    data:
      message: {{ state_attr('vacuum.chopper', 'friendly_name') }} is reporting ":" {{ state_attr('vacuum.chopper', 'errorMessage') }} at {{ state_attr('vacuum.chopper', 'errorTime') }}
      title: Automower Error
  mode: single

State Attributes:

battery_level: 38
battery_icon: mdi:battery-40
mode: MAIN_AREA
activity: MOWING
state: IN_OPERATION
errorMessage: null
errorTime: null
nextStart: null
action: NO_SOURCE
restrictedReason: NOT_APPLICABLE
statusTimestamp: '2021-09-17 10:26:09'
friendly_name: Chopper
icon: mdi:robot-mower
supported_features: 12380
  action:
  - service: notify.all_devices
    data:
      message: >-
        {{ state_attr('vacuum.chopper', 'friendly_name') }} is reporting : {{ state_attr('vacuum.chopper', 'errorMessage') }} at {{ state_attr('vacuum.chopper', 'errorTime') }}
      title: Automower Error
  mode: single

If you dont have outer quotes ", make it multiline template by adding >-

I appreciate that. YAML editor accepts that and it appears to work. Why does the Automation UI YAML editor then not allow it and display this error:

Message malformed: required key not provided @ data['condition'][0]['conditions'][0]['state']

It formats the Actions to look like this even though what I edited in the YAML file directly is not wrapped and appears correct and to work:

service: notify.all_devices
data:
  message: >-
    {{ state_attr('vacuum.chopper', 'friendly_name') }} is reporting : {{
    state_attr('vacuum.chopper', 'errorMessage') }} at {{
    state_attr('vacuum.chopper', 'errorTime') }}
  title: Automower Error

Try changing-

  condition:
  - condition: not
    conditions:
    - condition: state
      entity_id: vacuum.chopper
      attribute: errorMessage
      state: null

….to this-

  condition: "{{ state_attr('vacuum.chopper', 'errorMessage') is not none }}"