Automation trigger below template

Hello guys,

I’m trying to get my phone battery to last a bit longer, so I created an automation that automatically turns my charger off when it reaches the required battery percentage.

Now I also want to create a trigger that turns the charger on when my battery percentage dips below the required percentage - 10%. What am I doing wrong?

trigger:
  - platform: numeric_state
    entity_id: sensor.phone_battery_level
    above: input_number.phone_requested_battery_level

  - platform: template
    value_template: >-
      {% if ( states( 'sensor.phone_battery_level' ) | float) < ( states(
      'input_number.phone_requested_battery_level' )  - 10| float ) %}true {% endif
      %}

The first trigger is working as expected, the second template trigger is not triggering.

You have your float filter in the wrong place and the less than comparison will output true/false for you. Also it is best practice to supply defaults for your filters.

  - platform: template
    value_template: >
      {{ states('sensor.phone_battery_level') | float(0) < ( states('input_number.phone_requested_battery_level') | float(0) - 10 ) }}

Thanks, this was indeed the issue. Still getting used to templating, what does the 0 parameter in the float filter refer to?