Automation is giving error for input_datetime

I am new to HA , I am trying to record the last lights on Date Time from each room.
I found a code in community trying to save but getting an error.

input_datetime.yaml and configuration.yaml saved and restarted

This is the automation script I am trying to save

 - alias: "Update Last On Time for Living Room Light"
    trigger:
      - platform: state
        entity_id: light.cbr_center
        from: 'off'
        to: 'on'
    action:
      - service: input_datetime.set_datetime
        target:
          entity_id: input_datetime.last_on_living_room_light
        data:
          datetime: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }}"

Getting the Below Error
Message malformed: extra keys not allowed @ data[‘0’]

Is your input_datetime configured for both a date and time?

If so, this should do:

        data:
          datetime: "{{ now() }}"