Help to edit nspanel code

Hello I have NSPanel with this code:
How I can grab temperature from my external temperature sensor ?
I what disable internal NTC sensor because it is very inaccurate, and therefore I would like to take advantage of a xiaomi sensor currently in use present in HA.
can you help me to edit the code in use?

esphome:
  name: nspanel
  comment: Sonoff NSPanel 01 - Ingresso

esp32:
  board: esp32dev

wifi:
  ssid: "WiFi"
  password: "12345678901234567890"
  manual_ip:
    static_ip: 192.168.1.25
    gateway: 192.168.1.1
    subnet: 255.255.255.0
    dns1: 8.8.8.8
    dns2: 1.1.1.1

time:
  - platform: homeassistant
    id: homeassistant_time

logger:
  on_message:
    level: DEBUG
    then:

ota:

web_server:

# HTTP Request component needed for wttr.in weather web query
http_request:
  useragent: esphome/device
  timeout: 5s

substitutions:
# Unique ID for Sensors.
  switch_id: "nsp01"
  friendly_name: "NSPanel 01"
  wttr_location: "ipswich"

uart:
  tx_pin: 16
  rx_pin: 17
  baud_rate: 115200

# Use Local modified NSPanel component
external_components:
  - source: github://pr#2702
    components: ["nspanel"]
    refresh: 0s
  - source: github://pr#3331
    components: ["json"]
#  - source: 
#      type: local
#      path: components
#    components: ["nspanel"]
#    refresh: 0s

# Update Weather Hourly
interval:
  - interval: 60min
    then:
       - script.execute: nspanel_weather

# NSPanel Component for access to panel.
# Updates temperature, date, time, Relay indicators
# Provides JSON interface to panel
nspanel:
  id: nspanel1
  time_id: homeassistant_time
  temperature: ${switch_id}_temperature
  eco_mode_switch: ${switch_id}_eco_mode
  screen_power_switch: ${switch_id}_screen_power
  relays:
    - ${switch_id}_relay_1
    - ${switch_id}_relay_2
  on_json_message:
    then:
      # Widget 1 (type:0x86 id:light7) 
      - if:
          condition:
            lambda: 'return (type == 0x86 && root.containsKey("id") && strcasecmp(root["id"], "light7") == 0);'
          then:
            - if:
                condition:
                  lambda: 'return (root["params"].containsKey("switch") && root["params"]["switch"] == "on");'
                then:
                  - homeassistant.service:
                      service: light.turn_on
                      data:
                        entity_id: light.dim_09_light
            - if:
                condition:
                  lambda: 'return (root["params"].containsKey("switch") && root["params"]["switch"] == "off");'
                then:
                  - homeassistant.service:
                      service: light.turn_off
                      data:
                        entity_id: light.dim_09_light
            - if:
                condition:
                  lambda: 'return (root["params"].containsKey("white"));'
                then:
                  - homeassistant.service:
                      service: light.turn_on
                      data:
                        entity_id: light.dim_09_light
                        brightness: !lambda 'return int(root["params"]["white"]["br"].as<float>() / 100 * 255);'
      # Widget 2 (type:0x86 id:wled_test) 
      - if:
          condition:
            lambda: 'return (type == 0x86 && root.containsKey("id") && strcasecmp(root["id"], "wled_test") == 0);'
          then:
            - if:
                condition:
                  lambda: 'return (root["params"].containsKey("switch") && root["params"]["switch"] == "on" && !root["params"].containsKey("bright"));'
                then:
                  - homeassistant.service:
                      service: light.turn_on
                      data:
                        entity_id: light.wled_test
            - if:
                condition:
                  lambda: 'return (root["params"].containsKey("switch") && root["params"]["switch"] == "off");'
                then:
                  - homeassistant.service:
                      service: light.turn_off
                      data:
                        entity_id: light.wled_test
            - if:
                condition:
                  lambda: 'return (root["params"].containsKey("bright"));'
                then:
                  - homeassistant.service:
                      service: script.set_light_on_rgb
                      data:
                        entity_name: light.wled_test
                        brightness: !lambda 'return int(root["params"]["bright"].as<float>() / 100 * 255);'
                        red: !lambda 'return root["params"]["colorR"].as<int>();'
                        green: !lambda 'return root["params"]["colorG"].as<int>();'
                        blue: !lambda 'return root["params"]["colorB"].as<int>();'
      # Widget 3 (type:0x86 id:plug_09) 
      - if:
          condition:
            lambda: 'return (type == 0x86 && root.containsKey("id") && strcasecmp(root["id"], "plug_09") == 0);'
          then:
            - if:
                condition:
                  lambda: 'return (root["params"].containsKey("switch") && root["params"]["switch"] == "on");'
                then:
                  - homeassistant.service:
                      service: switch.turn_on
                      data:
                        entity_id: switch.plug_09_relay_1
            - if:
                condition:
                  lambda: 'return (root["params"].containsKey("switch") && root["params"]["switch"] == "off");'
                then:
                  - homeassistant.service:
                      service: switch.turn_off
                      data:
                        entity_id: switch.plug_09_relay_1
      # Widget 4 (type:0x86 id:group_01 = plug_08 + plug_11) 
      - if:
          condition:
            lambda: 'return (type == 0x86 && root.containsKey("id") && strcasecmp(root["id"], "group_01") == 0);'
          then:
            - if:
                condition:
                  lambda: 'return (root["params"].containsKey("switches") && root["params"]["switches"][0]["switch"] == "on");'
                then:
                  - homeassistant.service:
                      service: switch.turn_on
                      data:
                        entity_id: switch.plug_08_relay_1
            - if:
                condition:
                  lambda: 'return (root["params"].containsKey("switches") && root["params"]["switches"][0]["switch"] == "off");'
                then:
                  - homeassistant.service:
                      service: switch.turn_off
                      data:
                        entity_id: switch.plug_08_relay_1
            - if:
                condition:
                  lambda: 'return (root["params"].containsKey("switches") && root["params"]["switches"][1]["switch"] == "on");'
                then:
                  - homeassistant.service:
                      service: switch.turn_on
                      data:
                        entity_id: switch.plug_11_relay_1
            - if:
                condition:
                  lambda: 'return (root["params"].containsKey("switches") && root["params"]["switches"][1]["switch"] == "off");'
                then:
                  - homeassistant.service:
                      service: switch.turn_off
                      data:
                        entity_id: switch.plug_11_relay_1
      # Widget 5 (type:0x86 id:test_curtain) 
      - if:
          condition:
            lambda: 'return (type == 0x86 && root.containsKey("id") && strcasecmp(root["id"], "test_curtain") == 0);'
          then:
            - if:
                condition:
                  lambda: 'return (root["params"].containsKey("switch") && root["params"]["switch"] == "on");'
                then:
                  - homeassistant.service:
                      service: cover.open_cover
                      data:
                        entity_id: cover.test_curtain
            - if:
                condition:
                  lambda: 'return (root["params"].containsKey("switch") && root["params"]["switch"] == "off");'
                then:
                  - homeassistant.service:
                      service: cover.close_cover
                      data:
                        entity_id: cover.test_curtain
            - if:
                condition:
                  lambda: 'return (root["params"].containsKey("switch") && root["params"]["switch"] == "pause");'
                then:
                  - homeassistant.service:
                      service: cover.stop_cover
                      data:
                        entity_id: cover.test_curtain
            - if:
                condition:
                  lambda: 'return (root["params"].containsKey("setclose"));'
                then:
                  - homeassistant.service:
                      service: input_number.set_value
                      data:
                        entity_id: input_number.test_curtain_pos
                        value: !lambda 'return 100 - root["params"]["setclose"].as<int>();'
      # Thermostat (type:0x84) 
      - if:
          condition:
            lambda: 'return (type == 0x84);'
          then:
            - if:
                condition:
                  lambda: 'return (root.containsKey("ATCEnable") && root["ATCEnable"] == 1);'
                then:
                  - homeassistant.service:
                      service: climate.turn_on
                      data:
                        entity_id: sensor.temperature_158d00010f993f
            - if:
                condition:
                  lambda: 'return (root.containsKey("ATCEnable") && root["ATCEnable"] == 0);'
                then:
                  - homeassistant.service:
                      service: climate.turn_off
                      data:
                        entity_id: sensor.temperature_158d00010f993f
            - if:
                condition:
                  lambda: 'return (root.containsKey("ATCExpect0"));'
                then:
                  - homeassistant.service:
                      service: climate.set_temperature
                      data:
                        entity_id: sensor.temperature_158d00010f993f
                        temperature: !lambda 'return root["ATCExpect0"].as<int>();'
                        hvac_mode: heat
 
output:
  - platform: ledc
    id: ${switch_id}_buzzer_out
    pin:
      number: 21

rtttl:
  id: ${switch_id}_buzzer
  output: ${switch_id}_buzzer_out

api:
  id: api_id
  services:
    # Expose "send_json" to Home Assistant for scripts/testing
    - service: send_json
      variables:
        my_type: int
        my_json: string
      then:
        - lambda: 'id(nspanel1).send_json_command(my_type,my_json);'

switch:
  # Restart Switch in HA
  - platform: restart
    name: "${switch_id} Restart"
  - platform: gpio
    # Panel Left Hand relay
    name: ${switch_id} Relay 1
    id: ${switch_id}_relay_1
    pin:
      number: 22
  - platform: gpio
    # Panel Right Hand relay
    name: ${switch_id} Relay 2
    id: ${switch_id}_relay_2
    pin:
      number: 19
  - platform: gpio
    # Panel Screen Power
    name: ${switch_id} Screen Power
    id: ${switch_id}_screen_power
    entity_category: config
    pin:
      number: 4
      inverted: true
    restore_mode: ALWAYS_OFF
    on_turn_on:
      # Initiliase Screen - These timings could be more aggressive
      then:
        - delay: 6s
        - script.execute: nspanel_init
        - delay: 3s
        - script.execute: nspanel_weather
          # Must send Wifi State for widgets to update (particulalry after power-on of screen only
          # code taken from within NSPanel component code
        - lambda: |-
            uint8_t rssi = 0;
            rssi = (wifi::global_wifi_component->wifi_rssi() * -1) / 20.0f;
            std::string json_str = json::build_json([rssi](JsonObject root) {
              root["wifiState"] = "connected";
              root["rssiLevel"] = rssi;
            });
            id(nspanel1).send_json_command(0x85, json_str);

  - platform: template
    # Template switch to enable/disable screen dimming
    name: ${switch_id} Energy Saving Mode
    id: ${switch_id}_eco_mode
    entity_category: config
    restore_state: true
    optimistic: true
    
binary_sensor:
# NS Panel Hard Switches
  - platform: gpio
    id: ${switch_id}_button_1
    name: ${switch_id} Left Button
    pin:
      number: 14
      inverted: true
    on_click:
      - switch.toggle: ${switch_id}_relay_1

  - platform: gpio
    id: ${switch_id}_button_2
    name: ${switch_id} Right Button
    pin:
      number: 27
      inverted: true
    on_click:
      - switch.toggle: ${switch_id}_relay_2
# HA Tracking sensors for device states
# Update nspanel on state change
  - platform: homeassistant
    id: dim_09_light
    entity_id: light.dim_09_light
    on_press:
      then:
        - lambda: 'id(nspanel1).send_json_command(0x86,"{\"id\":\"light7\",\"params\":{\"switch\":\"on\"}}");'
    on_release:
      then:
        - lambda: 'id(nspanel1).send_json_command(0x86,"{\"id\":\"light7\",\"params\":{\"switch\":\"off\"}}");'
  - platform: homeassistant
    id: wled_test_light
    entity_id: light.wled_test
    on_press:
      then:
        - lambda: 'id(nspanel1).send_json_command(0x86,"{\"id\":\"wled_test\",\"params\":{\"switch\":\"on\"}}");'
    on_release:
      then:
        - lambda: 'id(nspanel1).send_json_command(0x86,"{\"id\":\"wled_test\",\"params\":{\"switch\":\"off\"}}");'
  - platform: homeassistant
    id: plug_09_switch
    entity_id: switch.plug_09_relay_1
    on_press:
      then:
        - lambda: 'id(nspanel1).send_json_command(0x86,"{\"id\":\"plug_09\",\"params\":{\"switch\":\"on\"}}");'
    on_release:
      then:
        - lambda: 'id(nspanel1).send_json_command(0x86,"{\"id\":\"plug_09\",\"params\":{\"switch\":\"off\"}}");'
  - platform: homeassistant
    id: plug_08_switch
    entity_id: switch.plug_08_relay_1
    on_press:
      then:
        - lambda: 'id(nspanel1).send_json_command(0x86,"{\"id\":\"group_01\",\"params\":{\"switches\":[{\"switch\":\"on\",\"outlet\":0}]}}");'
    on_release:
      then:
        - lambda: 'id(nspanel1).send_json_command(0x86,"{\"id\":\"group_01\",\"params\":{\"switches\":[{\"switch\":\"off\",\"outlet\":0}]}}");'
  - platform: homeassistant
    id: plug_11_switch
    entity_id: switch.plug_11_relay_1
    on_press:
      then:
        - lambda: 'id(nspanel1).send_json_command(0x86,"{\"id\":\"group_01\",\"params\":{\"switches\":[{\"switch\":\"on\",\"outlet\":1}]}}");'
    on_release:
      then:
        - lambda: 'id(nspanel1).send_json_command(0x86,"{\"id\":\"group_01\",\"params\":{\"switches\":[{\"switch\":\"off\",\"outlet\":1}]}}");'
sensor:
# Extra sensor to keep track of plug uptime
  - platform: uptime
    name: ${switch_id} Uptime Sensor
# Wifi Signal
  - platform: wifi_signal
    name: "${switch_id} WiFi Signal Sensor"
    update_interval: 60s
# nspanel related temperature sensors
  - platform: adc
    id: ${switch_id}_ntc_source
    pin: 38
    update_interval: 10s
    attenuation: 11db
  - platform: resistance
    id: ${switch_id}_resistance_sensor
    sensor: ${switch_id}_ntc_source
    configuration: DOWNSTREAM
    resistor: 11.2kOhm
  - platform: ntc
    id: ${switch_id}_temperature
    sensor: ${switch_id}_resistance_sensor
    calibration:
      b_constant: 3950
      reference_temperature: 25°C
      reference_resistance: 10kOhm
    name: "${switch_id} Temperature"   
# Home Assistant Light State Sensors to update panel
  - platform: homeassistant
    # Light light.dim_09_light brightness (0-255)
    id: dim_09_light_bright
    entity_id: light.dim_09_light
    attribute: brightness
    on_value:
      then:
        - script.execute: ha_dim_09_light_update
  - platform: homeassistant
    # Light light.wled_test brightness (0-255)
    id: wled_test_bright
    entity_id: light.wled_test
    attribute: brightness
    on_value:
      then:
        - script.execute: ha_wled_test_update
  - platform: homeassistant
    # Light light.wled_test brightness (0-255)
    id: test_curtain_pos
    entity_id: cover.test_curtain
    attribute: current_position
    on_value:
      then:
        - script.execute: ha_test_curtain_update_pos
  - platform: homeassistant
    # Thermostat set temp
    id: climate_temp
    name: ${switch_id} Climate Temp
    entity_id: sensor.temperature_158d00010f993f
    attribute: temperature
    internal: true
    on_value:
      then:
        - script.execute: ha_thermostat_update_temp
text_sensor:
# Text Sensors to track attirbutes from HA (HA -> Panel)
  - platform: homeassistant
    name: "HA wled_test RGB"
    id: wled_test_rgb
    entity_id: light.wled_test
    attribute: rgb_color
    internal: false
    on_value:
      then:
        - script.execute: ha_wled_test_update
  - platform: homeassistant
    id: test_curtain_state
    name: "Test Curtain State"
    entity_id: cover.test_curtain
    internal: true
    on_value:
      then:
        - script.execute: ha_test_curtain_update_state
  - platform: homeassistant
    id: climate_state
    name: "Climate State"
    entity_id: sensor.temperature_158d00010f993f
    internal: true
    on_value:
      then:
        - script.execute: ha_thermostat_update_state
script:
  - id: ha_dim_09_light_update
    then:
      - lambda: |-
          if (id(dim_09_light).state) {
            int i_brightness = int(id(dim_09_light_bright).state / 255 * 100); 
            id(nspanel1).send_json_command(0x86,"{\"id\":\"light7\",\"params\":{\"switch\":\"on\",\"ltype\":\"white\",\"white\":{\"br\":" + to_string(i_brightness) + "}}}");
          } else {
            id(nspanel1).send_json_command(0x86,"{\"id\":\"light7\",\"params\":{\"switch\":\"off\"}}");
          }

  - id: ha_wled_test_update
    # Decode RGB Attribute ((r,g,b) and send to panel
    then:
      - lambda: |-
          if (id(wled_test_light).state) {
            int i_brightness = int(id(wled_test_bright).state / 255 * 100); 
            std::string s = id(wled_test_rgb).state;
            std::string r = "255";
            std::string g = "0";
            std::string b = "0";
            int p1 = s.find(",");
            if (p1 > 0) {
                int p2 = s.find(",",p1+1);
                r = s.substr(1, p1-1).erase(0,s.find_first_not_of(" ")); 
                g = s.substr(p1+2,p2-p1-2).erase(0,s.find_first_not_of(" ")); 
                b = s.substr(p2+2,s.length()-2).erase(0,s.find_first_not_of(" ")); 
            }
            id(nspanel1).send_json_command(0x86,"{\"id\":\"wled_test\",\"params\":{\"switch\":\"on\",\"light_type\":1,\"mode\":1,\"bright\":" + to_string(i_brightness) + ",\"colorR\":" + to_string(r) + ",\"colorG\":" + to_string(g) + ",\"colorB\":" + to_string(b) + "}}");
          } else {
            id(nspanel1).send_json_command(0x86,"{\"id\":\"wled_test\",\"params\":{\"switch\":\"off\"}}");
          }
  - id: ha_plug_09_update
    then:
      - lambda: |-
          if(id(plug_09_switch).state) {
            id(nspanel1).send_json_command(0x86,"{\"id\":\"plug_09\",\"params\":{\"switch\":\"on\"}}");
          } else {
            id(nspanel1).send_json_command(0x86,"{\"id\":\"plug_09\",\"params\":{\"switch\":\"off\"}}");
          }
  - id: ha_plug_08_update
    then:
      - lambda: |-
          if(id(plug_08_switch).state) {
            id(nspanel1).send_json_command(0x86,"{\"id\":\"group_01\",\"params\":{\"switches\":[{\"switch\":\"on\",\"outlet\":0}]}}");
          } else {
            id(nspanel1).send_json_command(0x86,"{\"id\":\"group_01\",\"params\":{\"switches\":[{\"switch\":\"off\",\"outlet\":0}]}}");
          }
  - id: ha_plug_11_update
    then:
      - lambda: |-
          if(id(plug_11_switch).state) {
            id(nspanel1).send_json_command(0x86,"{\"id\":\"group_01\",\"params\":{\"switches\":[{\"switch\":\"on\",\"outlet\":1}]}}");
          } else {
            id(nspanel1).send_json_command(0x86,"{\"id\":\"group_01\",\"params\":{\"switches\":[{\"switch\":\"off\",\"outlet\":1}]}}");
          }
  - id: ha_test_curtain_update_state
    then:
      - lambda: |-
         if(id(test_curtain_state).state == "open") {
            id(nspanel1).send_json_command(0x86,"{\"id\":\"test_curtain\",\"params\":{\"switch\":\"on\"}}");
          } else {
            id(nspanel1).send_json_command(0x86,"{\"id\":\"test_curtain\",\"params\":{\"switch\":\"off\"}}");
          }
  - id: ha_test_curtain_update_pos
    then:
      - lambda: |-
          id(nspanel1).send_json_command(0x86,"{\"id\":\"test_curtain\",\"params\":{\"setclose\":" + to_string(100 - id(test_curtain_pos).state) + "}}");
  - id: ha_thermostat_update_state
    then:
      # Update Thermostat On/Off
      - lambda: |-
          if (id(climate_state).state == "heat") { 
           id(nspanel1).send_json_command(0x84,"{\"ATCEnable\":1}");
          } else {
           id(nspanel1).send_json_command(0x84,"{\"ATCEnable\":0}");
          }
  - id: ha_thermostat_update_temp
    then:
      # Update Thermostat Temperature
      - lambda: |-
          if ( (int) id(climate_temp).state > 15 && (int) id(climate_temp).state < 32 && id(climate_state).state == "heat") {
            id(nspanel1).send_json_command(0x84,"{\"ATCExpect0\":" + to_string((int) id(climate_temp).state) + "}");
          }
  - id: nspanel_init
    # Script to initialise panel on full power on (or when screen is powered on from ESP)
    then:
      # Setup Widgets - must send all 8
      # Widget 1
      - lambda: |-
          id(nspanel1).send_json_command(0x86,"{\"HMI_resources\":[{\"index\":1,\"ctype\":\"device\",\"id\":\"light7\",\"uiid\":52}]}"); id(nspanel1).send_json_command(0x86,"{\"relation\":[{\"ctype\":\"device\",\"id\":\"light7\",\"name\":\"DIM09\",\"online\":1,\"params\":{\"switch\":\"off\",\"ltype\":\"white\",\"white\":{\"br\":0,\"ct\":0}}]}");
      # Widget 2
      - lambda: |-
          id(nspanel1).send_json_command(0x86,"{\"HMI_resources\":[{\"index\":2,\"ctype\":\"device\",\"id\":\"wled_test\",\"uiid\":33}]}");
          id(nspanel1).send_json_command(0x86,"{\"relation\":[{\"ctype\":\"device\",\"id\":\"wled_test\",\"name\":\"WLED\",\"online\":1,\"params\":{\"switch\":\"on\"}]}");
      # Widget 3
      - lambda: |-
          id(nspanel1).send_json_command(0x86,"{\"HMI_resources\":[{\"index\":3,\"ctype\":\"device\",\"id\":\"plug_09\",\"uiid\":1}]}");
          id(nspanel1).send_json_command(0x86,"{\"relation\":[{\"ctype\":\"device\",\"id\":\"plug_09\",\"name\":\"PLUG09\",\"online\":1,\"params\":{\"switch\":\"on\"}]}");
      # Widget 4
      - lambda: |-
          id(nspanel1).send_json_command(0x86,"{\"HMI_resources\":[{\"index\":4,\"ctype\":\"device\",\"id\":\"group_01\",\"uiid\":2}]}");
          id(nspanel1).send_json_command(0x86,"{\"relation\":[{\"ctype\":\"device\",\"id\":\"group_01\",\"name\":\"Plugs\",\"online\":1,\"params\":{\"switches\":[{\"switch\":\"on\",\"outlet\":0},{\"switch\":\"on\",\"outlet\":1}]}");
      # Widget 5
      - lambda: |-
          id(nspanel1).send_json_command(0x86,"{\"HMI_resources\":[{\"index\":5,\"ctype\":\"device\",\"id\":\"test_curtain\",\"uiid\":11}]}");
          id(nspanel1).send_json_command(0x86,"{\"relation\":[{\"ctype\":\"device\",\"id\":\"test_curtain\",\"name\":\"Cover\",\"online\":1,\"params\":{\"switch\":\"on\"}]}");
      # Widget 6
      - lambda: 'id(nspanel1).send_json_command(0x86,"{\"index\":6,\"type\":\"delete\"}");'
      # Widget 7
      - lambda: 'id(nspanel1).send_json_command(0x86,"{\"index\":7,\"type\":\"delete\"}");'
      # Widget 8
      - lambda: 'id(nspanel1).send_json_command(0x86,"{\"index\":8,\"type\":\"delete\"}");'
      # Update existing Entities / Widgets
      - script.execute: ha_dim_09_light_update
      - script.execute: ha_wled_test_update
      - script.execute: ha_plug_09_update
      - script.execute: ha_plug_08_update
      - script.execute: ha_plug_11_update
      - script.execute: ha_test_curtain_update_state
      - script.execute: ha_test_curtain_update_pos
      # Setup Thermostat
      - lambda: 'id(nspanel1).send_json_command(0x84,"{\"HMI_ATCDevice\":{\"ctype\":\"device\",\"id\":\"climate\",\"outlet\":0,\"etype\":\"hot\"}}");'
      - lambda: 'id(nspanel1).send_json_command(0x84,"{\"ATCMode\":0}");'
      # Update Thermostat
      - script.execute: ha_thermostat_update_state
      - script.execute: ha_thermostat_update_temp
  - id: nspanel_weather
    # Grab weather status (JSON) from https://wttr.in
    then:
      - logger.log: "nspanel_weather started"
      - lambda: |-
          WiFiClientSecure client;
          HTTPClient http;
          int wicon,wicon_out;
          std::string buffer;
          // Disable certificate checking
          client.setInsecure();
          
          ESP_LOGD("nspanel_weather", "Init Complete");
          //use appropriate location - test in browser without "?format=j2" for normal output
          http.begin(client,"wttr.in",443,"/${wttr_location}?format=j2",true);
          ESP_LOGD("nspanel_weather", "http.begin OK");

          http.useHTTP10(true);
          int httpCode = http.GET();
          ESP_LOGD("nspanel_weather", "http.GET OK");

          if (httpCode > 0) {
            // http response received
            ESP_LOGD("nspanel_weather", "HTTP response code is %i", httpCode);

            if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY) {
              // setup JSON object for HTTP response

              DynamicJsonDocument root(4000);
              DeserializationError error = deserializeJson(root, http.getStream());

              if (root.containsKey("current_condition")) {
                ESP_LOGD("nspanel_weather", "JSON Parse OK");

                wicon = int( root["current_condition"][0]["weatherCode"].as<signed int>());
                ESP_LOGD("nspanel_weather", "weather code received: %i",wicon);
                
                // Translate wttr.in weather code to use correct nspanel icon
                // Mapping from Tasmota nspanel.be code
                wicon_out = 30; // Unknown / Default
                if (wicon == 113) { wicon_out = 1; }  //    # Sunny      
                if (wicon == 116) { wicon_out = 2; }  //    # PartlyCloudy   
                if (wicon == 119) { wicon_out = 2; }  //    # Cloudy             
                if (wicon == 122) { wicon_out = 7; }  //    # VeryCloudy           
                if (wicon == 143) { wicon_out = 11; } //    # Fog                 
                if (wicon == 176) { wicon_out = 40; } //    # LightShowers     
                if (wicon == 179) { wicon_out = 24; } //    # LightSleetShowers 
                if (wicon == 182) { wicon_out = 24; } //    # LightSleet        
                if (wicon == 185) { wicon_out = 24; } //    # LightSleet        
                if (wicon == 200) { wicon_out = 42; } //    # ThunderyShowers  
                if (wicon == 227) { wicon_out = 20; } //    # LightSnow  
                if (wicon == 230) { wicon_out = 22; } //    # HeavySnow        
                if (wicon == 260) { wicon_out = 11; } //    # Fog                 
                if (wicon == 263) { wicon_out = 40; } //    # LightShowers     
                if (wicon == 266) { wicon_out = 40; } //    # LightRain      
                if (wicon == 281) { wicon_out = 24; } //    # LightSleet        
                if (wicon == 284) { wicon_out = 24; } //    # LightSleet        
                if (wicon == 293) { wicon_out = 40; } //    # LightRain      
                if (wicon == 296) { wicon_out = 40; } //    # LightRain      
                if (wicon == 299) { wicon_out = 18; } //    # HeavyShowers      
                if (wicon == 302) { wicon_out = 18; } //    # HeavyRain        
                if (wicon == 305) { wicon_out = 18; } //    # HeavyShowers      
                if (wicon == 308) { wicon_out = 18; } //    # HeavyRain        
                if (wicon == 311) { wicon_out = 24; } //    # LightSleet        
                if (wicon == 314) { wicon_out = 24; } //    # LightSleet        
                if (wicon == 317) { wicon_out = 24; } //    # LightSleet        
                if (wicon == 320) { wicon_out = 20; } //    # LightSnow  
                if (wicon == 323) { wicon_out = 22; } //    # LightSnowShowers 
                if (wicon == 326) { wicon_out = 22; } //    # LightSnowShowers 
                if (wicon == 329) { wicon_out = 22; } //    # HeavySnow        
                if (wicon == 332) { wicon_out = 22; } //    # HeavySnow        
                if (wicon == 335) { wicon_out = 29; } //    # HeavySnowShowers   
                if (wicon == 338) { wicon_out = 22; } //    # HeavySnow        
                if (wicon == 350) { wicon_out = 24; } //    # LightSleet        
                if (wicon == 353) { wicon_out = 24; } //    # LightSleet        
                if (wicon == 356) { wicon_out = 18; } //    # HeavyShowers      
                if (wicon == 359) { wicon_out = 18; } //    # HeavyRain        
                if (wicon == 362) { wicon_out = 24; } //    # LightSleetShowers 
                if (wicon == 365) { wicon_out = 24; } //    # LightSleetShowers 
                if (wicon == 368) { wicon_out = 22; } //    # LightSnowShowers 
                if (wicon == 371) { wicon_out = 29; } //    # HeavySnowShowers   
                if (wicon == 374) { wicon_out = 24; } //    # LightSleetShowers 
                if (wicon == 377) { wicon_out = 24; } //    # LightSleet        
                if (wicon == 386) { wicon_out = 42; } //    # ThunderyShowers  
                if (wicon == 389) { wicon_out = 42; } //    # ThunderyHeavyRain  
                if (wicon == 392) { wicon_out = 42; } //    # ThunderySnowShowers
                if (wicon == 395) { wicon_out = 29; } //    # HeavySnowShowers   
                // Create JSON to update nspanel
                // Weather Code for weather icon
                // Current Temp = current_0["temp_C"]
                // Temp range min = weather_0["mintempC"]
                // Temp range max = weather_0["maxtempC"]
                id(nspanel1).send_json_command(0x81,"{\"HMI_weather\":" + to_string(wicon_out) + ",\"HMI_outdoorTemp\":{\"current\":" + root["current_condition"][0]["temp_C"].as<const char*>() + ",\"range\":\"" +root["weather"][0]["mintempC"].as<const char*>() + "," +  root["weather"][0]["maxtempC"].as<const char*>() + "\"}}");
              } else {
                ESP_LOGD("nspanel_weather", "Current Condition not found");
              }
            }              
          }
        

Assuming your external temperature sensor is a HA entity, you can import it to ESPhome with this Home Assistant Sensor — ESPHome

yes, but how do I replace the display value with the data taken from my sensor?
I am not able to edit the original nspanel code:

I am late to the party but this can help you:

and then this:
https://docs.nspanel.pky.eu/prepare_nspanel_ioBroker/

Overkill, you can use the nicer stock UI and change the temperature numbers on screen.

Demo and description