Onewire temperature sensor with esp home doesn't work (yet)

Hi everybody,
I want to connect an waterproof temprature sensor to my esp with esphome on it. I have other sensors on my ESP and that works, but with the onewire sensor I have no luck. I have connected the sensor to pin 5, and this is my code:

one_wire:
  - platform: gpio
    pin: 5
    name: "Temprature sensor"

I am probably missing something, but I don’t know what :wink:

already thanks!

Hi, you need both one_wire and the Dallas device setup for the sensor to operate:

Also follow this method to obtain the device ID:

Thanks!

it works now. totally forgot the dallas step.

Hi, back again to this topic. today I got another onewire sensor (same one as the past one) but when i wanted to get the sensor ID, it doesn’t show any. maybe that I am doing something wrong, or that the sensor is faulty, but just want to check it.

this is the code that I’m using:

esphome:
  name: ESP-1
  friendly_name: ESP 1

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "7l6liZEO7BpGaH/e1p9wDjV43CX5xPrngOKjubI2Tcg="

ota:
  - platform: esphome
    password: "ec368cc5dbc7858c4478e666974963c7"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Box-2-Bed Fallback Hotspot"
    password: "99hq4s8EvkzZ"

captive_portal:


one_wire:
  - platform: gpio
    pin: GPIO14

the sensor that I want to read the id from is connected to gpio 14 on the esp

Aren’t you missing this declaration?

sensor:
  - platform: dallas_temp

I can try that today. But I thought this was the code that is used to get the sensor ID?

It’s written like this on the man page:

“A 1-Wire bus is required to be set up in your configuration for this sensor to work.”

I added it to the code, but still have no luck with it. this is the log that I am getting from the onewire:

[15:54:48][C][gpio.one_wire:020]: GPIO 1-wire bus:
[15:54:48][C][gpio.one_wire:021]:   Pin: GPIO12
[15:54:48][W][gpio.one_wire:078]:   Found no devices!
[15:54:48][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Float Switch 1'
[15:54:48][C][gpio.binary_sensor:016]:   Pin: GPIO14
[15:54:48][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Float Switch 2'
[15:54:48][C][gpio.binary_sensor:016]:   Pin: GPIO16
[15:54:48][C][dallas.temp.sensor:029]: Dallas Temperature Sensor:
[15:54:48][W][dallas.temp.sensor:031]:   Unable to select an address
[15:54:48][C][captive_portal:089]: Captive Portal:

I also have the problem that when the esp is connected to the sensor and I boot it it stays offline and gives this error:

[15:57:17]rst:0x10 (RTCWDT_RTC_RESET),boot:0x33 (SPI_FAST_FLASH_BOOT)
[15:57:17]invalid header: 0xffffffff
[15:57:17]invalid header: 0xffffffff
[15:57:17]invalid header: 0xffffffff
[15:57:17]invalid header: 0xffffffff
[15:57:17]invalid header: 0xffffffff
[15:57:17]invalid header: 0xffffffff
[15:57:17]invalid header: 0xffffffff
[15:57:17]ets Jul 29 2019 12:21:46
[15:57:17]
[15:57:17]rst:0x10 (RTCWDT_RTC_RESET),boot:0x33 (SPI_FAST_FLASH_BOOT)
[15:57:17]invalid header: 0xffffffff
[15:57:17]invalid header: 0xffffffff
[15:57:17]invalid header: 0xffffffff
[15:57:17]invalid header: 0xffffffff
[15:57:17]invalid header: 0xffffffff
[15:57:17]invalid header: 0xffffffff
[15:57:17]invalid header: 0xffffffff
[15:57:17]ets Jul 29 2019 12:21:46
[15:57:17]
[15:57:17]rst:0x10 (RTCWDT_RTC_RESET),boot:0x33 (SPI_FAST_FLASH_BOOT)
[15:57:17]invalid header: 0xffffffff
[15:57:17]invalid header: 0xffffffff
[15:57:17]invalid header: 0xffffffff
[15:57:18]invalid header: 0xffffffff
[15:57:18]invalid header: 0xffffffff
[15:57:18]invalid header: 0xffffffff
[15:57:18]invalid header: 0xffffffff
[15:57:18]ets Jul 29 2019 12:21:46
[15:57:18]
[15:57:18]rst:0x10 (RTCWDT_RTC_RESET),boot:0x33 (SPI_FAST_FLASH_BOOT)
[15:57:18]invalid header: 0xffffffff
[15:57:18]invalid header: 0xffffffff
[15:57:18]invalid header: 0xffffffff
[15:57:18]invalid header: 0xffffffff
[15:57:18]invalid header: 0xffffffff
[15:57:18]invalid header: 0xffffffff
[15:57:18]invalid header: 0xffffffff
[15:57:18]ets Jul 29 2019 12:21:46
[15:57:18]
[15:57:18]rst:0x10 (RTCWDT_RTC_RESET),boot:0x33 (SPI_FAST_FLASH_BOOT)
[15:57:18]invalid header: 0xffffffff
[15:57:18]invalid header: 0xffffffff
[15:57:18]invalid header: 0xffffffff
[15:57:18]invalid header: 0xffffffff
[15:57:18]invalid header: 0xffffffff
[15:57:18]invalid header: 0xffffffff
[15:57:18]invalid header: 0xffffffff
[15:57:18]ets Jul 29 2019 12:21:46

and when I disconnect the sensor it goes back online and this error stops. when I plug in the esp first, and after that I plug in the sensor, it stays online, and doesn’t do this.