Differential temperature pump control

I am new to Home Assistant and I am trying to use part of a configuration yaml from Feb 2018 by xbmcnut & mf_social. I keep getting the error sensor: duplicated. I have used different configs of the above to no avail. I am Using HA with esphome on a esp32. Any help will be much appreciated.

  name: "sensor_diff"
  platform: ESP32
  board: nodemcu-32s
wifi:
  ssid: "xxxx"
  password: "xxxx"
  manual_ip: 
  static_ip: 192.168.1.102
  gateway: 192.168.1.1
  subnet: 255.255.255.0 

api:
web_server:
  port: 80
logger:
ota:
  password: "xxxx"

dallas:
  - pin: 23

# Individual Sensors
sensor:
  - platform: dallas
    address: 0xb80000030864ca28
    name: "panel"
    id: "panel"
  - platform: dallas
    address: 0x60000003084c2b28
    name: "tank"
    id: "tank"
  - platform: value_template
    id: Temperature Difference
    unit_of_measurement: °C
    update_interval: 60s
    lambda: 'return id(panel).state - id(tank).state;'


    sensors:
      temp_diff:
        friendly_name: Temperature Difference
        value_template: >
          {% if ((states.sensor.panel_temperature.state | float ) - (states.sensor.tank_temperature.state | float))
            < (states.input_number.pump_on_offset.state | float ) %} pump_off
          {% elif ((states.sensor.panel_temperature.state | float ) - (states.sensor.tank_temperature.state | float))
            > (states.input_number.pump_on_offset.state | float ) %} pump_on
          {% else %} pending {% endif %}

input_number:
  pump_on_offset:
    name: Pump ON offset
    min: 0
    max: 7
    step: 0.5

  pump_off_offset:
    name: Pump OFF offset
    min: 0
    max: 4
    step: 0.5



automation:
  - id: ID12
    alias: 'Pump hot water if hotter than tank - stop if not'
    initial_state: 'on'
    trigger:
      platform: state
      entity_id: sensor.temp_diff
    action:
      entity_id: switch.solar_pump
      service_template: >
        {% if is_state ('sensor.temp_diff' , 'pump_on') %} switch.turn_on
        {% else %} switch.turn_off {% endif %}```
Adhoc77

Moved to ESPHome topic.

I am no expert, but shouldn’t your two dallas sensors have different addresses?

Look again. They do.

Arrrrggghhhh ignore me . Most people do.

Hello, I am starting with HA and Esphome. I need to do differential termometr to my solar hit pipe system. But I do not how to program esp32 with your yamal code. Please somebody help me.