DS18B20 - Temperature sensors in ESP-Home

 

Complementary to the article: DS18B20 Temperature Sensors ESP32, MQTT and WiFi - HowTo, I have meanwhile replaced the Arduino project with ESP-Home. Simple projects can be implemented much easier in ESPHome. As an example, in ESPHome these 2 lines are enough to address the temperature sensors:

dallas:
  - pin: GPIO14

If the microcontroller is programmed, the IDs of the sensors appear in the output:

[09:58:14][D][dallas.sensor:082]:   Found sensors:
[09:58:14][D][dallas.sensor:084]:     0xf2031689c848ff28
[09:58:14][D][dallas.sensor:084]:     0xea031689ce28ff28
[09:58:14][D][dallas.sensor:084]:     0xee031689cab2ff28
[09:58:14][D][dallas.sensor:084]:     0xcb0416928fceff28
[09:58:14][D][dallas.sensor:084]:     0x5d041692c80bff28

The IDs can be used in the YAML config file as follows:

dallas:
  - pin: GPIO14

# Individual sensors
sensor:
  - platform: dallas
    address: 0xf2031689c848ff28
    name: "heating/t1"
  - platform: dallas
    address: 0xea031689ce28ff28
    name: "heating/t2"
...

The whole project will look like this:

[+]
esphome:
  name: heating

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "??"

ota:
  password: "??"

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Heating Fallback Hotspot"
    password: "??"

captive_portal:

dallas:
  - pin: GPIO14

# Individual sensors
sensor:
  - platform: dallas
    address: 0xf2031689c848ff28
    name: "heating/t1"
  - platform: dallas
    address: 0xea031689ce28ff28
    name: "heating/t2"
...

For details about ESPHome, see: esp-home

An alternative to the DS18B20 sensors offer DHT11/DHT22 temperature and humidity sensors

 

positive Bewertung({{pro_count}})
Rate Post:
{{percentage}} % positive
negative Bewertung({{con_count}})

THANK YOU for your review!

Updated: 2023-10-09 von Bernhard | Übersetzung Deutsch |🔔 | Comments:0

Home Assistant + DIY Microcontroller + ESP Home (Docker) | ESP32

Top articles in this section


ESP32 Flowmeter and RS485 Modbus

As described on the article ESP32 programming, Arduino - install requirements, my first goal was to read out a TUF-2000M Ultrasonic Flow Meter via an ESP32. I found an example for an ESP8266 on the internet: Reading a TUF-2000M Ultrasonic Flow Meter with an Arduino or ESP8266 and https://forum.arduino.cc/t/comunicacion-rs485/698786/2. I described the setup of the TUF-2000M in the following article: Field Report: Ultrasonic Flow Meter TUF-2000M. To be able to read out the TUF-2000M via RS485, it...


ESP32 WiFi example

In preparation for uploading sketches to a microcontroller, I installed the ESP32 board infromations and a USB to UART bridge driver, see: Preparations for programming an ESP32.


DS18B20 Temperature Sensors ESP32, MQTT and WiFi - HowTo

In addition to connecting a flow meter via RS485 I plugged 5-piece DS18B20 temperature sensors to the ESP32 so that their values are also transmitted to HomeAssistant via MQTT.

Questions / Comments


By continuing to browse the site, you agree to our use of cookies. More Details