Skip to content

Instantly share code, notes, and snippets.

@mikesmitty
Created January 26, 2022 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikesmitty/706c644301fef3b0560597ce40c37244 to your computer and use it in GitHub Desktop.
Save mikesmitty/706c644301fef3b0560597ce40c37244 to your computer and use it in GitHub Desktop.
No-solder Home Assistant/ESPHome temperature/humidity sensors
Components
============================================
~$4 NodeMCUv2 ESP8266 (fairly generic, get wherever's convenient)
~$6 Adafruit SHT40: https://www.adafruit.com/product/4885
~$1 Adafruit StemmaQT to female Dupont cable: https://www.adafruit.com/product/4397
USB wall wart (Optional, however you power the ESP8266 is fine)
USB A to micro B (Optional, however you power the ESP8266 is fine)
Assembly
============================================
Plug the StemmaQT cable end into the SHT40 temp sensor (the plug on either side is fine)
Run the red wire to the 3V3 pin on the NodeMCUv2 next to D4
Run the black wire to the GND pin next to the previous 3V3 pin
Run the blue wire to D5
Run the yellow wire to D6 (All four should be in a row now: red, black, blue, yellow)
ESPHome Config
============================================
Add the following to your basic ESPHome config for the sensor (Remove
esphome:
name: living_room_temp
platform: ESP8266
board: nodemcuv2
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "${name} Fallback Hotspot"
password: !secret wifi_fallback_password
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
sensor:
- platform: wifi_signal
name: "${name} WiFi Signal"
update_interval: 60s
- platform: sht4x
temperature:
filters:
- lambda: return x * (9.0/5.0) + 32.0;
unit_of_measurement: "°F"
name: "Living Room Temperature"
humidity:
name: "Living Room Humidity"
update_interval: 60s
i2c:
sda: D5
scl: D6
Flash the sensor with ESPHome and add to Home Assistant, and that's it!
If you want temps in Celcius (the default) just remove these two lines from the sensor section:
filters:
- lambda: return x * (9.0/5.0) + 32.0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment