Compare blueprint entity states with number input in condition

Looking for some help with performing math on an a blueprint input.
I want to check if the value of the entity ‘tesla_charging_amps_number_entity’ is equal to or greater than a number value set in the template ‘tesla_charging_amps_upper_value’

I am trying to use a condition: numeric_state at the moment and then subtract -1 from the number provided and then check if the value is above. Not sure if this is the best way.
So say the value provided is 16 then I want to subtract 1 from that, then check if the current value of the entity above 15 using the numeric_state condition.

Not sure if there is a better way, maybe using a template but been struggling to get the correct syntax.

  input:
    tesla_charging_amps_number_entity:
      name: Select the entity which represents the Tesla charging amps (e.g. number.tesla_charging_amps)
      selector:
        entity: 
          filter:
            - domain: number
              integration: tesla_custom
    tesla_charging_amps_upper_value:
      name: Select the number of amps that charging should not increase past
      default: 10
      selector:
        number:
          min: 0
          max: 32
          step: 1
          mode: slider

variables:
  var_tesla_charging_amps_upper_value: !input tesla_charging_amps_upper_value
  var_tesla_charging_amps_number_entity: !input tesla_charging_amps_number_entity

action:
  - if:
    then: 
    else:
      - condition: not
        conditions:
          - condition: numeric_state
            entity_id: !input var_tesla_charging_amps_number_entity
            above: {{ state_attr(var_tesla_charging_amps_upper_value) | int -1 }}

Not sure what you are trying to do, but if you want to write a blueprint, I suggest you get your idea working as an automation first. Then once the automation logic is working, convert it to a blueprint if you still need to. One thing at a time.

Read here:

Thanks,
I had started with a automation but strayed from it while building the template, going back and making the change I was trying to do in the blueprint in the original automation made me realise what I needed to do.
Have figured it out now, was making it way more complicated than it needed to be.

    else:
      - condition: numeric_state
        entity_id: !input tesla_charging_amps_number_entity
        below: !input tesla_charging_amps_upper_value
1 Like