Kogan Kettle - Reading temperature template

I have Tasmota (v8.3.1) on my kettle as per https://templates.blakadder.com/kogan-KASMCDSKTLA.html but can’t configure a sensor for the temperature.
Home Assistant 0.111.4

as per docs I have added the following

# Kogan Kettle temperature
  - platform: mqtt
    name: "Kettle Temperature"
    state_topic: kettle/tele/RESULT
    value_template: >-
      {% if 5 == value_json.TuyaReceived.DpId %}
         {{ value_json.TuyaReceived.DpIdData | int(base=16) }}
      {% else %}
        {{ states('sensor.kogan_temperature') }}
      {% endif %}
    unit_of_measurement: '°C'

the payload appears correct and tried testing it in Developer Tools \ Template but it is not extracting the data.

Imitate available variables:
{% set value_json = {
   "TuyaReceived":{
      "Data":"55AA0007001C01010001000502000400000039650100010066040001006704000100A7",
      "Cmnd":7,
      "CmndData":"01010001000502000400000039650100010066040001006704000100",
      "DpType1Id1":0,
      "1":{
         "DpId":1,
         "DpIdType":1,
         "DpIdData":"00"
      },
      "DpType2Id5":57,
      "5":{
         "DpId":5,
         "DpIdType":2,
         "DpIdData":"00000039"
      },
      "DpType1Id101":0,
      "101":{
         "DpId":101,
         "DpIdType":1,
         "DpIdData":"00"
      },
      "DpType4Id102":0,
      "102":{
         "DpId":102,
         "DpIdType":4,
         "DpIdData":"00"
      },
      "DpType4Id103":0,
      "103":{
         "DpId":103,
         "DpIdType":4,
         "DpIdData":"00"
      }
   }
} %}

      {% if 5 == value_json.TuyaReceived.DpId %}
         {{ value_json.TuyaReceived.DpIdData | int(base=16) }}
      {% else %}
        Not Working
      {% endif %}

How should I be getting the decimal version of “00000039”?

Thanks

{{ value_json.TuyaReceived['5'].DpIdData | int(base=16) }}

If there’s a possibility that the received payload doesn’t contain a key named TuyaReceived['5'] then the template should first confirm that it exists before it attempts to use it.

      {% if value_json.TuyaReceived['5'] is defined %}
         {{ value_json.TuyaReceived['5'].DpIdData | int(base=16) }}
      {% else %}
        Not Working
      {% endif %}

Thank you for the quick reply.

The final sensor config was

# Kogan Kettle temperature
  - platform: mqtt
    name: "Kettle Temperature"
    state_topic: kettle/tele/RESULT
    value_template: >-
      {% if value_json.TuyaReceived['5'] is defined %}
         {{ value_json.TuyaReceived['5'].DpIdData | int(base=16) }}
      {% else %}
        {{ states('sensor.kettle_temperature') }}
      {% endif %}
    unit_of_measurement: '°C'