ESPhome - Wemos D1 mini pro v2 & SHT30 (working) & HP303B pressure shield (not working)

Hi,

first of all i am a noob regarding home assistant but i read a lot and got it up and running.
But now ii have problems im trying to solve since 2 days searching the inet and the forum but i cannot get it working.

I bought the wemos d1 mini pro and some mini shields for my first tproject building up an outdoor weather station. Thought its a good idea to start with shields i can put on each other to get into buiding more complex stuff later on.

The stuff i bought:
https://www.wemos.cc/en/latest/d1/d1_mini_pro.html
https://www.wemos.cc/en/latest/d1_mini_shiled/sht30.html

picture of the mini and sensors ( sht30 connected wth the cable, pressure and anbient light on top of the mini pro):

I first installed hassio on a nuc -working
then add ESPhome addon -working
Afterwards i made my first simple yamls -working
and updated the wemos mini -working

But now i wanted to add more sensors for temperature (sht30), barometric pressure (HP303B) and the ambient light (BH1750FVI). But im struggling at the first step connecting the sht30 mini shield.

Im using the i2c interface to connect the shield to the mini and tried different approaches to set sda and scl and the adress but i always get the message: Communication with SHT3xD failed!

I got the combination running on Arduino therefor i thought i did the configuration righttherefor i dont know whats going wrong here.

the scratch is looking like this:

esphome:
  name: out_tempfeuchtdruck
  platform: ESP8266
  board: d1_mini_pro

wifi:
  ssid: "ssid"
  password: "password"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "ssid"
    password: "password"
 
i2c:
  sda: 2
  scl: 3
  scan: True
  id: bus_a

sensor:
  - platform: sht3xd
    address: 0x45
    i2c_id: bus_a
    temperature:
      name: "Living Room Temperature"
      id: "temperature"
    humidity:
      name: "Living Room Humidity"
      id: "humidity"
    update_interval: 10s



captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
INFO Reading configuration /config/esphome/out_tempfeuchtdruck.yaml...
INFO Generating C++ source...
INFO Compiling app...
INFO Running:  platformio run -d /config/esphome/out_tempfeuchtdruck
Processing out_tempfeuchtdruck (board: d1_mini_pro; framework: arduino; platform: [email protected])
--------------------------------------------------------------------------------
HARDWARE: ESP8266 80MHz, 80KB RAM, 16MB Flash
Dependency Graph
|-- <ESPAsyncTCP-esphome> 1.2.2
|   |-- <ESP8266WiFi> 1.0
|-- <ESP8266WiFi> 1.0
|-- <ESP8266mDNS> 1.2
|   |-- <ESP8266WiFi> 1.0
|-- <ESPAsyncWebServer-esphome> 1.2.6
|   |-- <ESPAsyncTCP-esphome> 1.2.2
|   |   |-- <ESP8266WiFi> 1.0
|   |-- <Hash> 1.0
|   |-- <ESP8266WiFi> 1.0
|-- <Wire> 1.0
|-- <DNSServer> 1.1.1
|   |-- <ESP8266WiFi> 1.0
Compiling /data/out_tempfeuchtdruck/.pioenvs/out_tempfeuchtdruck/src/main.cpp.o
Linking /data/out_tempfeuchtdruck/.pioenvs/out_tempfeuchtdruck/firmware.elf
Building /data/out_tempfeuchtdruck/.pioenvs/out_tempfeuchtdruck/firmware.bin
Retrieving maximum program size /data/out_tempfeuchtdruck/.pioenvs/out_tempfeuchtdruck/firmware.elf
Checking size /data/out_tempfeuchtdruck/.pioenvs/out_tempfeuchtdruck/firmware.elf
DATA:    [=====     ]  45.1% (used 36916 bytes from 81920 bytes)
PROGRAM: [====      ]  39.1% (used 407936 bytes from 1044464 bytes)
Creating BIN file "/data/out_tempfeuchtdruck/.pioenvs/out_tempfeuchtdruck/firmware.bin" using "/data/out_tempfeuchtdruck/.pioenvs/out_tempfeuchtdruck/firmware.elf"
========================= [SUCCESS] Took 2.80 seconds =========================
INFO Successfully compiled program.
INFO Resolving IP address of out_tempfeuchtdruck.local
INFO  -> 192.168.1.xxx
INFO Uploading /data/out_tempfeuchtdruck/.pioenvs/out_tempfeuchtdruck/firmware.bin (412096 bytes)
Uploading: [============================================================] 100% Done...


INFO Waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from out_tempfeuchtdruck.local using esphome API
WARNING Error resolving IP address of out_tempfeuchtdruck.local. Is it connected to WiFi?
WARNING (If this error persists, please set a static IP address: https://esphome.io/components/wifi.html#manual-ips)
WARNING Initial connection failed. The ESP might not be connected to WiFi yet (Error resolving IP address: Error resolving address with mDNS: Did not respond. Maybe the device is offline., [Errno -5] No address associated with hostname). Re-Trying in 1 seconds
WARNING Error resolving IP address of out_tempfeuchtdruck.local. Is it connected to WiFi?
WARNING (If this error persists, please set a static IP address: https://esphome.io/components/wifi.html#manual-ips)
WARNING Initial connection failed. The ESP might not be connected to WiFi yet (Error resolving IP address: Error resolving address with mDNS: Did not respond. Maybe the device is offline., [Errno -5] No address associated with hostname). Re-Trying in 1 seconds
INFO Connecting to out_tempfeuchtdruck.local:6053 (192.168.1.30)
INFO Successfully connected to out_tempfeuchtdruck.local
[22:58:29][I][app:100]: ESPHome version 1.14.3 compiled on Jan 26 2020, 22:57:53
[22:58:29][C][wifi:415]: WiFi:
[22:58:29][C][wifi:283]:   SSID: 

[redacted]
[22:58:29][C][wifi:284]:   IP Address: 192.168.1.xxx
[22:58:29][C][wifi:286]:   BSSID: 

[redacted]
[22:58:29][C][wifi:287]:   Hostname: 'hostname'
[22:58:29][C][wifi:291]:   Signal strength: -58 dB ▂▄▆█
[22:58:29][C][wifi:295]:   Channel: 5
[22:58:29][C][wifi:296]:   Subnet: 255.255.255.0
[22:58:29][C][wifi:297]:   Gateway: 192.168.1.xxx
[22:58:29][C][wifi:298]:   DNS1: 192.168.1.xxx
[22:58:29][C][wifi:299]:   DNS2: (IP unset)
[22:58:29][C][i2c:028]: I2C Bus:
[22:58:29][C][i2c:029]:   SDA Pin: GPIO2
[22:58:29][C][i2c:030]:   SCL Pin: GPIO3
[22:58:29][C][i2c:031]:   Frequency: 50000 Hz
[22:58:29][I][i2c:033]: Scanning i2c bus for active devices...
[22:58:29][I][i2c:049]: Found no i2c devices!
[22:58:29][C][logger:175]: Logger:
[22:58:29][C][logger:176]:   Level: DEBUG
[22:58:29][C][logger:177]:   Log Baud Rate: 115200
[22:58:29][C][logger:178]:   Hardware UART: UART0
[22:58:29][C][sht3xd:034]: SHT3xD:
[22:58:29][C][sht3xd:035]:   Address: 0x45
[22:58:29][E][sht3xd:037]: Communication with SHT3xD failed!
[22:58:29][C][sht3xd:039]:   Update Interval: 10.0s
[22:58:29][C][sht3xd:041]:   Temperature 'Living Room Temperature'
[22:58:29][C][sht3xd:041]:     Unit of Measurement: '°C'
[22:58:29][C][sht3xd:041]:     Accuracy Decimals: 1
[22:58:29][C][sht3xd:041]:     Icon: 'mdi:thermometer'
[22:58:29][C][sht3xd:042]:   Humidity 'Living Room Humidity'
[22:58:29][C][sht3xd:042]:     Unit of Measurement: '%'
[22:58:29][C][sht3xd:042]:     Accuracy Decimals: 1
[22:58:29][C][sht3xd:042]:     Icon: 'mdi:water-percent'
[22:58:29][C][captive_portal:169]: Captive Portal:
[22:58:29][C][ota:029]: Over-The-Air Updates:
[22:58:29][C][ota:030]:   Address: out_tempfeuchtdruck.local:8266
[22:58:29][C][api:095]: API Server:
[22:58:29][C][api:096]:   Address: out_tempfeuchtdruck.local:6053

I hope anybody can help me with this case. I like home assistant a lot but its hard to struggle with the first simple project ;-(

Thx a lot in advance!

The other shields and tft:

https://www.wemos.cc/en/latest/d1_mini_shiled/barometric_pressure.html

https://www.wemos.cc/en/latest/d1_mini_shiled/ambient_light.html

https://www.wemos.cc/en/latest/d1_mini_shiled/tft_i2c_connector.html

https://www.wemos.cc/en/latest/d1_mini_shiled/tft_2_4.html

Try

i2c:  
  sda: GPIO5
  scl: GPIO4

I’d also leave out the address and bus, since you’re scanning, and there’s no possible address conflict with these devices.

This line is worrying.

Do you have a multimeter ?
If so your first step might be to confirm you have voltage between the 3V3 and GND pads on the sensor board. And to help with fault finding, removing the ambient light board will simplify things

Also, as suggested above, comment out or delete the line

address: 0x45

Although I doubt this will have any effect as the bus scan is not finding any devices.

i2c: 
  sda: 2 
  scl: 3 
  scan: True 
  id: bus_a

The pins are D1 and D2, not GPIO2 and GPIO3. See https://wiki.wemos.cc/products:d1_mini_shields:sht30_shield

Hi,

thx a lot for the quick reply and the help. It works!!!

Changing the adress and pins and it works.

sda: GPIO4
scl: GPIO5

address: 0x45

but i encountered the next problem: Maybe its as easy as the above for you.

I put the barometric pressure shield on top and the adress is recognized

08:39:57][I][i2c:040]: Found i2c device at address 0x77

but im too silly to find the platform name:
i searched along these posts and found out that somebody already integrated it custom. But if i use it i get an error at:

  includes:
    - hp303b.h

https://github.com/dmptrluke/esphome_hp303b
If I understand this post right it should be already integrated by @OttoWinter
But i cannot find out the platform name i should paste in. Maybe just a beginner mistake. But im struggling finding out the right documents.

Status quo of the scratch:

esphome:
  name: wetterstation_outdoor
  platform: ESP8266
  board: d1_mini_pro
  
  libraries:
    - "wemos/LOLIN_HP303B_Library" # lib from github
    - "SPI" # lib from platformio
  includes:
    - hp303b.h
  
wifi:
  ssid: "ssid"
  password: "password"
  
  manual_ip:
    # Set this to the IP of the ESP
    static_ip: 192.168.1.xxx
    # Set this to the IP address of the router. Often ends with .1
    gateway: 192.168.1.xxx
    # The subnet of the network. 255.255.255.0 works for most home networks.
    subnet: 255.255.255.0

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Out Tempfeuchtdruck"
    password: "password"
 
i2c:
  - sda: GPIO4
    scl: GPIO5
    id: bus_a

sensor:
  - platform: sht3xd
    i2c_id: bus_a
    address: 0x45
    
    temperature:
      name: "Außentemperatur"
      id: "temperature"
    humidity:
      name: "Luftfeuchtigkeit Außen"
      id: "humidity"
    update_interval: 10s
    
  - platform: custom
    i2c_id: bus_a
    address: 0x77

    lambda: |-
      auto hp_sensor = new HP303BSensor();
      App.register_component(hp_sensor);
      return {hp_sensor};

    sensors:
      name: "Barometric Pressure"
      icon: "mdi:gauge"
      unit_of_measurement: hPa
      accuracy_decimals: 1
    update_interval: 10s

# Not working!!! ToDo: Find out why adress 0x23 or 0x5c cannot be recognized
#  - platform: bh1750
#    i2c_id: bus_a
#    address: 0x5c
#    #address: 0x23
#    name: "Helligkeit Außen"
#    id: "lumen"
#    update_interval: 10s

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

https://github.com/esphome/feature-requests/issues/287

If somebody need to whole scratch enclosed the one working with sht30:

Working sketch for wemos d1 mini pro v2 and sht30 shield:

esphome:
  name: out_tempfeuchtdruck
  platform: ESP8266
  board: d1_mini_pro

wifi:
  ssid: "paste in your wlan name here"
  password: "wlan password"
  
  manual_ip:
    # Set this to the IP of the ESP
    static_ip: 192.168.1.xx # put in the ip of your wemos
    # Set this to the IP address of the router. Often ends with .1
    gateway: 192.168.1.1 #change it if you need it
    # The subnet of the network. 255.255.255.0 works for most home networks.
    subnet: 255.255.255.0

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Out Tempfeuchtdruck"
    password: "password"
 
i2c:
  - sda: GPIO4
    scl: GPIO5
    id: bus_a

sensor:
  - platform: sht3xd
    i2c_id: bus_a
    address: 0x45
    
    temperature:
      name: "Außentemperatur"
      id: "temperature"
    humidity:
      name: "Luftfeuchtigkeit Außen"
      id: "humidity"
    update_interval: 10s



captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
5 Likes

Thanks for great work, this helpt me alot!

Have you workt with the wemos pir shield with i2c and got it to work?

PIR shield does not need I2C. You just need to point it to the correct pin. For Wemos/Lolin PIR shield it is GPIO0. It can run in parallel to the temperature/humidity sensor.

binary_sensor:
  - platform: gpio
    pin: GPIO0
    name: "PIR Sensor"
    device_class: motion