How to display NO/YES instead of 0/1 in a RESTful sensor value_template?

The below working RESTful sensor’s Value Template can retrieve and display either a 0 or 1 status:

rest:
  - resource: http://192.168.1.2:55555
    sensor:
      - name: "Package Ring Thermal Throttling"
        value_template: "{{value_json 
                          | selectattr('SensorClass', 'equalto', 'CPU [#0]: Intel Core i7-13700K: DTS') 
                          | selectattr('SensorName', 'equalto', 'Package/Ring Thermal Throttling') 
                          | map(attribute='SensorValue') 
                          | first}}"

I would like to modify the above code to display NO or YES instead of 0 or 1 , respectively.

.

The 2 attempts below were my best effort; but, still wrong!

ATTEMPT #1: (always/incorrectly displays UNKNOWN)

rest:
  - resource: http://192.168.1.2:55555
    sensor:
      - name: "Package Ring Thermal Throttling"
        value_template: "{{value_json 
                          | selectattr('SensorClass', 'equalto', 'CPU [#0]: Intel Core i7-13700K: DTS') 
                          | selectattr('SensorName', 'equalto', 'Package/Ring Thermal Throttling') 
                          | map(attribute='SensorValue') 
                          | first}}
                            {% if is_state(value_template, '0') %}
                              NO
                            {% elif is_state(value_template, '1') %}
                              YES
                            {% else %}
                              UNKNOWN
                            {% endif %}"

ATTEMPT #2: (Incorrectly displays NO, instead of YES when the value retrieved is 1)

rest:
  - resource: http://192.168.1.2:55555
    sensor:
      - name: "Performance Limit Reasons"
        value_template: "{% if value_json 
                          | selectattr('SensorClass', 'equalto', 'CPU [#0]: Intel Core i7-13700K: Performance Limit Reasons') 
                          | selectattr('SensorUnit', 'equalto', 'Yes/No') 
                          | map(attribute='SensorValue') 
                          | first == 1 %}
                            YES
                          {% else %}
                            NO
                          {% endif %}"

I’m hoping someone can help. I’ve spent a lot of time trying to get this on my own… but, don’t know what else to do for it to work correctly.

Solution:
My second attempt was almost perfect. However, I didn’t consider the value returned from the REST API endpoint is a string, not a number. I put single-quotes around the 1, that’s all that was missing.

rest:
  - resource: http://192.168.1.2:55555
    sensor:
      - name: "Performance Limit Reasons"
        value_template: "{% if value_json 
                          | selectattr('SensorClass', 'equalto', 'CPU [#0]: Intel Core i7-13700K: Performance Limit Reasons') 
                          | selectattr('SensorUnit', 'equalto', 'Yes/No') 
                          | map(attribute='SensorValue') 
                          | first == '1' %}
                            YES
                          {% else %}
                            NO
                          {% endif %}"