How to notify ac hvac_modes info to phone

I want to ac hvac_modes info ,when the hvac_mode changed ,change to any mode ,I want know .
I ask the chatgpt ,it give me the answer can’t used

automation:
  - alias: 监听空调模式变化
    trigger:
      platform: event
      event_type: state_changed
      event_data:
        entity_id: climate.your_ac_entity_id
        event_data:
          attribute: hvac_modes
    action:
      - service: notify.notify_platform
        data_template:
          message: '空调模式已变为 {{ trigger.event.data.new_state.attributes.hvac_modes }}'

does someone know how to set this?

I can offer an example which I know is working. This one adds a line to a text file every time the state of the burner on my boiler changes:

- id: id_boiler_burner
  alias: Boiler Burner
  trigger:
  - platform: state
    entity_id: binary_sensor.boiler_burner
  action:
    - service: notify.burnerlog
      data_template:
        message: "{{ now().strftime('%x') }} {{ now().strftime('%X') }}\tBurner {{ trigger.to_state.state\
          \ }}\t{{ ((trigger.to_state.last_changed|as_timestamp) - (trigger.from_state.last_changed|as_timestamp))\
          \ | timestamp_custom('%H:%M:%S',0) }}"

I can’t promise it’s the best way, or an efficient way. I can only tell you that it’s currently working. Here are the last few lines of the text file it creates:

|05/30/23 07:03:15|Burner off|00:02:34|
|05/30/23 08:10:16|Burner on|01:07:00|
|05/30/23 08:12:28|Burner off|00:02:11|

(I don’t know why this site changed my tabs to | characters.)

To send to a cell phone, I have other automations which use the smtp platform. I assume that’s what your notify_platform is.