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!

Questions / Comments


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