Creating calendar event with input_number

I’m trying to create a button that will use user input from an input_number helper I created to create a calendar event in the local calendar in a given amount of days. I already have an input_number helper called trip_length and a calendar entity. This is what my UI looks like so far:

Ideally, the user could type in a number of days that they will be on a trip and click “Create Trip End Event” which will create a event in the calendar in the given amount of days. For the button, the configuration I have so far is:

show_name: true
show_icon: false
type: button
  action: call-service
  service: calendar.create_event
    summary: Trip
      days: {{ states(input_number.trip_length) }}
    entity_id: calendar.mobile_homies_calendar
entity: calendar.mobile_homies_calendar
name: Create Trip End Event

However, I get an error that says Failed to call service calendar/create_event. expected int for dictionary value @ data['in']['days']. I’ve tried using {{ states(input_number.trip_length)|int }} to make this an integer, but keep getting the same error.

Any help is appreciated! Thanks!

Button cards (and most core cards) do not accept templates. You can use a different card or change your tap action to call a script which performs your templated calendar action.

Also, your template needs to be wrapped in quotes.

Making a script worked, thank you for the advice

Are you able to post what script you made?
I am interested in creating a button that will allow me to create a calendar event based on user input