Sensor for the sum of the values of two sensors

I have two DS18b20 sensors on an esp01, they work very well so far. Additionally I need another template sensor, which gives me the average value of the two sensors. But I can’t get any further with the configuration.

Post what you have.


now I have two sensors:

 - platform: dallas
    address: 0xF501192A17D2D628
    id: left_side
    name: "Sensor1"
  - platform: dallas
    address: 0xBC01192A0FF24928
    id: right_side
    name: "Sensor2"

what I have, to create 3rd sensor, which give me the overage of Sensor1 and Sensor2

Please edit your post and format it correctly. See point 11 here.

I hope so is ok?


value_template: "{{ (states('sensor.Sensor1') |float + states('sensor.Sensor2') | float ) / 2}}"

That’s for home assistant. Look at the post category, an ESPHome template is required.

Try this Diddlik:

  - platform: template
    name: "Average Temperature"
    lambda: |-
      return (id(left_side).state + id(right_side).state)/2;
    update_interval: 60s

ups sorry :-X

1 Like

It works fine!!!

1 Like

Don’t feel bad. I made the same mistake ukro, then Sneaky edited my post :slight_smile:

ahah haha :rofl: