Can I use a math function with an input number

My HA runs my irrigation for my yard. I have an input_number entity that I set to tell the system how long to run each zone. One of my zones is getting too much water and really just needs to run about half as long as the other zones. Can I add a formula to that zone’s script to make it run for half the time as other zones? Something like"input_number/2"?

Here is my current script.

irrigation_run_all_zones:
  sequence:
  - service: switch.turn_on
    target:
      entity_id: switch.master_valve
  - service: switch.turn_on
    target:
      entity_id: switch.zone_1
  - delay:
      minutes: '{{ states(''input_number.irrigation_timer_minutes'') | int }}'
  - service: switch.turn_off
    target:
      entity_id: switch.zone_1

Yes, you can do it like this:

  - delay:
      minutes: '{{ (states(''input_number.irrigation_timer_minutes'') | int / 2) | round(0) }}'

The round(0) filter ensures it doesn’t report fractional values like 3.5 minutes (it will be rounded up to 4).

Example using the Template Editor:

Thanks for the help!

You’re welcome!

Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions. For more information refer to guideline 21 in the FAQ.