DS18b20 temperature sensors on different pins

Hi guys,
I need your help, i would like to measure the temperature with several DS18B20 sensors which are connected to the different pins of ESP32 controller. I have wrote a code which worked properly with the old version of ESPhome, after the upgrade of ESPhome i can`t compily my code.
Here is a part of code which worked

dallas:

  • pin: GPIO16
    id: Sensor_1

  • pin: GPIO5
    id: Sensor_2

  • pin: GPIO4
    id: Sensor_3

  • pin: GPIO2
    id: Sensor_4

  • pin: GPIO13
    id: Sensor_5

  • pin: GPIO14
    id: Sensor_6

    update_interval: 10s

sensor:

  • platform: dallas
    dallas_id: Sensor_1
    index: 0
    name: “Kitchen Under Floor Sensor 1”
  • platform: dallas
    dallas_id: Sensor_2
    index: 0
    name: “Kitchen Under Floor Sensor 2”
  • platform: dallas
    dallas_id: Sensor_3
    index: 0
    name: “Hallway Under Floor Sensor 1”
  • platform: dallas
    dallas_id: Sensor_4
    index: 0
    name: “Hallway Under Floor Sensor 2”
  • platform: dallas
    dallas_id: Sensor_5
    index: 0
    name: “Bathroom Under Floor Sensor 1”
  • platform: dallas
    dallas_id: Sensor_6
    index: 0
    name: “Outside Temperature”

Hello and welcome.

Firstly, we need you to format your pasted config or it is difficult to read: How to help us help you - or How to ask a good question

As to your question, the Dallas component has been renamed one-wire. Check the he ESPHome documents again. 1-Wire Bus — ESPHome

There is also a forum post about this: Heads up for Esphome 2024.6 - #24 by tom_l

You should always read the release notes before updating, to check for breaking changes like this.

1 Like

Incidentally, this is not necessary, you can use all DS18B20s on one pin


#DS18B20
one_wire:
  - platform: gpio
    pin: GPIO23
    id: bus1

sensor:

#DS18B20
  - platform: dallas_temp
    address: 0x44012212da27cc11
    one_wire_id: bus1
    name: "BZ Schrank Temperatur" 
    accuracy_decimals: 2
    filters:
      - round: 2 # will round to 2 decimal place
      - offset: 0.05 # nach 10 Messpunkten nach oben
    update_interval: 20s # 60s ist default

  - platform: dallas_temp
    address: 0x10012212c16c3211
    one_wire_id: bus1
    name: "BZ Handwaschbecken Temperatur" 
    accuracy_decimals: 2
    filters:
      - round: 2 # will round to 2 decimal place
      - offset: 0.00 # nach 10 Messpunkten nach oben
    update_interval: 20s # 60s ist default

True, but in practice it’s a bad idea. You have 6 (or more) sensors. If one of them dies you’ll have no clue which one is dead if bad one goes to short (been there…). Then you have to remove them one-by-one…
So, if there’s a chance (enough pins) it’s always better to connect them separately.

I gotta ask… Do you mind sharing what it is your making? When i see someone using 6 ds18b20’s on one esp board it definitely makes me curious.

On the one bus or separate?

I’ve only ever used the one bus and had no issues.

one_wire:
  - platform: gpio
    pin: GPIO33

sensor:
  - platform: dallas_temp
    address: 0x1a3c01e07605b228
    name: "Tank Temperature"
    update_interval: 3s
    filters:
      - sliding_window_moving_average:
          window_size: 10
          send_every: 10
          send_first_at: 1

  - platform: dallas_temp
    address:  0x58000000167d7228
    name: "HP Inlet Temperature"
    update_interval: 3s
    filters:
      - sliding_window_moving_average:
          window_size: 10
          send_every: 10
          send_first_at: 1

  - platform: dallas_temp
    address: 0xa23c01e07646d628
    name: "HP Return Temperature"
    update_interval: 3s
    filters:
      - sliding_window_moving_average:
          window_size: 10
          send_every: 10
          send_first_at: 1

  - platform: dallas_temp
    address: 0x2000000018fee128
    name: "Hot Water Temperature"
    update_interval: 3s
    filters:
      - sliding_window_moving_average:
          window_size: 10
          send_every: 10
          send_first_at: 1

  - platform: dallas_temp
    address: 0xec00000019647a28
    name: "Tempered Water Temperature"
    update_interval: 3s
    filters:
      - sliding_window_moving_average:
          window_size: 10
          send_every: 10
          send_first_at: 1

  - platform: dallas_temp
    address: 0x7900000018552628
    name: "Air Temperature"
    update_interval: 3s
    filters:
      - sliding_window_moving_average:
          window_size: 10
          send_every: 10
          send_first_at: 1
1 Like

No

Each DS18B20 has a unique address and you assign a name in the yaml. You can also add a label => no problem at all

Thank you guys for your quick answers they was very helpful. I’m grateful.

I`m using this ESP module to measuring the underfloor heating temperature in my house and if in the future i will should replace some of the temperature sensors I will just replace the sensors and I will not need for searching the addresses and reprograming the controller.

Each DS18B20 has a unique address and you assign a name in the yaml. You can also add a label => no problem at all

apreick → You don’t understand, or, should i say, you live in ideal world where nothing ever dies… But, perhaps you just had luck, and you never experienced dead sensor in parallel connection.

Yes, each of them has unique address, which is only good as long as all sensors work. When ONE OF THEM dies and causes dataline to go SHORT to GND then suddenly none of the sensors work, since they can’t communicate if dataline is shorted to GND, can they? So, address is then of no use to you since you must remove them one-by-one and see when they will start to work again. If you have, say, 6 or more sensors and they are all soldered together it can be quite P.I.T.A. finding the bad one.

Trust, me, i know, I’ve had such situation. And according to Murphy’s law seventh of 8 sensors was faulty, so I’ve had to re-solder, re-insulate… all of them again. And that’s why i always connect each of them to a separate pin from that moment on…

1 Like

I use 3.5mm stereo plugs. If one ever goes short it should be easy to isolate it.

I agree with @Protoncek . If you have Esp full of unused pins, why to wire them parallel.
Ok, if sensors are located the way that parallel wiring is saving a “lot of wire”, I would go with that…

Only having one bus for the ESP main loop to manage would be a lot less software overheard, but I doubt bit would be significant difference.

Oh nice! That will be a good one!

Use the following as an example:

one_wire:
  - platform: gpio
    pin: GPIO0
    id: x1
  - platform: gpio
    pin: GPIO2
    id: x2
  - platform: gpio
    pin: GPIO14
    id: x3
  - platform: gpio
    pin: GPIO12
    id: x4
    
sensor:
  - platform: dallas_temp
    one_wire_id: x1
    name: temp_1
    update_interval: 1s
  - platform: dallas_temp
    one_wire_id: x2
    name: temp_2
    update_interval: 1s
  - platform: dallas_temp
    one_wire_id: x3
    name: temp_3
    update_interval: 1s
  - platform: dallas_temp
    one_wire_id: x4
    name: temp_4
    update_interval: 1s

Of coures put your own names as IDs and sensors’ names.