Trouble with Automation when charging phone wirelessly

I’m brand new to Home Assistant, I’m just testing it out on a Synology server, so I don’t have any zwave or zigbee devices. (Currently using Hubitat, just doing some testing before I go all in.)

I want some automations to start when I start charging my phone wirelessly. For now, I just want it to send me a message that says ‘test’. Then later, I’ll have it start messing with lights, etc.

Here is what I have. I’m getting the error message: “Message malformed: expected a dictionary @ data[‘trigger’][0]”

- id: 'charging'
  alias: charging
  description: ''
  trigger:
  - entity_id: sensor.pixel_5_battery_state
    from: discharging
    platform: state
    to: charging
  condition:
  - condition: template
    value_template: '{{ is_state_attr(''sensor.pixel_5_charger_type'', ''charger_type'',
      ''wireless'') }}'

device_id: dc5bcab5a889e02847e5481f85d857d7
domain: mobile_app
type: notify
message: test
title: test

This is normally a yaml formatting error. In your case, you have not indented enough on some lines. Should be:

- id: 'charging'
  alias: charging
  description: ''
  trigger:
    - entity_id: sensor.pixel_5_battery_state
      from: discharging
      platform: state
      to: charging
  condition:
    - condition: template
      value_template: '{{ is_state_attr(''sensor.pixel_5_charger_type'', ''charger_type'',
      ''wireless'') }}'
  action:
    device_id: dc5bcab5a889e02847e5481f85d857d7
    domain: mobile_app
    type: notify
    message: test
    title: test

Edit: i would say, until you are familiar with writing yaml, i would use the UI to write automations as it is much easier and will ensure correct formatting.