Use percentage value from one to another

The automation seems to be correctly in the Development tools - Template but entity: fan.cooling didn't take it. can anyone see my error here?

- id: cr10_cooling_fan
  alias: "CR-10 Cooling Fan Speed"
    - platform: template
      value_template: "{{ states ('sensor.3d_printer_fan_speed') | int > 0 }}"
    - service: fan.set_percentage
        entity_id: fan.cooling
        percentage: "{{ states ( 'sensor.3d_printer_fan_speed') }}"

Please use proper formatting with the </> in the menu bar

fix it. Thanks

I wonder is it a proper calling?

states ('sensor.3d_printer_fan_speed')

I mean a whitespace.

I don't think it's matter. as you can see in the result percentage which return proper value, 25.
I did change service: fan.turn_on then It works but only once.
  1. Do not use a “code” formatting for a non-code part of your post.
  2. Have you checked with Dev tools - Services to confirm that your call is correct?

action only trigger once time when fan speed has new value from 0, after that action don’t execute unless fan speed reset back to zero and slide to new number.

Yes, that’s how a template trigger works, when the template changes from false to true.

You probably want a state trigger:

  - platform: state
    entity_id: sensor.3d_printer_fan_speed

I also found that from another post. Got it now. Thanks.
I shorted onboard cooling fan circuit while replace another cooling fan, that circuit is dead but its slider on klipper still work so I want to map its percentage speed to ESP8266_pwm + MOS FET PWM module It acts like the onboard pwm fan now.