Use sensor value as value in automation target

I would like to use the numeric value of a sensor (sensor.ultra_power_battery_soc) that is the current state of charge of a battery in % as the value in an automation action. The action in the automation is ‘set number value’. As is stands you can actually only type a number in that field.

In plain English terms, I want to take the current state of charge of battery 1 and use it to set the backup reserve level of battery 2 to the same number when certain other conditions are true (time of day, load). I have the triggers and conditions working exactly as I want them, I just don’t understand what I need to do to be able to get a numeric sensor value into the action value to set. I’m pretty new to this so any help appreciated.

Currently it looks like this with the value I want to set as 45 (the turning off of a light is just there as a test feature so I can easily check the trigger and conditions are working correctly):

alias: Stream bank 2 idle
description: ""
triggers:
  - trigger: state
    entity_id:
      - sensor.house_usage_power_grid_global
conditions:
  - condition: time
    after: "05:30:00"
    before: "23:29:00"
    weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
      - sat
      - sun
  - condition: numeric_state
    entity_id: sensor.house_usage_power_grid_global
    below: 0.2
    above: -0.2
actions:
  - action: number.set_value
    data:
      value: "45"
    target:
      entity_id:
        - number.ultra_backup_reserve_level
    enabled: true
  - type: turn_off
    device_id: 4bc5b01002d531cc5ebfd17a50cc0634
    entity_id: 695c2c835a2534c6452cbd968f825d59
    domain: light
mode: single

Use template to get the value to set.

- action: number.set_value
    data:
      value: "{{ states('sensor.ultra_power_battery_soc')|int }}"
    metadata: {}
    target:
      entity_id: sensor.ultra_power_battery_soc

Thank you so much!
I kind of guessed this would probably be straightforward, but after searching for sometime I hadn’t been able to find the actual answer and really didn’t know how to construct it myself.
Your suggestion works perfectly and does exactly what I wanted it to do as quickly just tested.

Please mark the post from @juergenjw as the solution vs your post.

This post

For future reference, the documentation you were looking for is located here: Templating.