Subtract !input from number

I know that I’m trying to subtract and string and a number (i think) but with all my research I can not figure out how to. I’ve tried several different things I’ve found searching and can not get anything to work. I keep getting error: expected int for dictionary value @ data[‘below’]. Got None.

Here is the input: code

      name: Vent Open During Fan Circulation
      default: 97
          min: 3
          max: 97

and the line that keeps giving me the error I removed everything I’ve tried and just left the !input and number I want to subtract

      - condition: device
        domain: cover
        entity_id: !input room_vent
        device_id: !input room_vent
        type: is_position
        below: !input vent_open_fan - 10

Any help is much appreciated. Still trying different things.

You need to parse your input to an integer value in order to be able to do any maths with it.
Add a variables section above your trigger section and create a variable into which you put the vent_open_fan.

  below_value: !input vent_open_fan

Then parse that value to an integer and deduct the value.

below: {{ below_value | int - 10 }}

Thank you for the help

I must not be holding my mouth right. Still getting an error.

invalid key: "OrderedDict([('open_vent_fan_below | int - 10', None)])" in "/config/blueprints/automation/MeBadDog/hvac_vent_control_test3.yaml", line 131, column 0

added and changed the following like you said

  open_vent_fan_below: !input vent_open_fan
below: {{ open_vent_fan_below | int - 10 }}
1 Like