Invalid config error for custom doorbell

I’d use a triggered template sensor instead:

template:
  - trigger:
      - platform: mqtt
        topic: dev/test
        payload: 'Capture!'
    sensor:
      - name: "Doorbell Pressed at"
        state: "{{ now() }}"

This sensor state will have the following format: 2021-09-02 21:09:12.231825+10:00

You can format it however you like though.

See this topic: