What am I doing wrong in this yaml for a template trigger?

I’m attempting use a button on the UI to record an input_number value to the database through the recorder.

I created the input_number and then configured a template sensor to read that value…but now I’m trying to only get it to read that value when I press the button.

Here’s my yaml:

- trigger:
    - platform: event
      event_type: call_service
      service_data:  <----- this doesn't seem to work per the error notification I get.
        entity_id: script.test_number
  sensor:
    - name: Test Number
      state: "{{ states.input_number.test_number.state}}"

What’s the correct method to watch the call_service for a specific script to be run?

try “event_data:” instead:

I just whipped this up in the UI editor as a test and it at least passed the config checker:

- id: '1621975130750'
  alias: New Automation
  description: ''
  trigger:
  - platform: event
    event_type: call_service
    event_data:
      domain: fan
      service: turn_on
      service_data:
        entity_id: fan.master_bedroom_fan
  condition: []
  action:
  - service: input_boolean.turn_on
    target:
      entity_id: input_boolean.bool_13
  mode: single

I tested it and it worked.

FYI, you can listen for the events in the dev tools and use that event that gets triggered when you call the service and see what the syntax for the event is.