Skip to content

Example of connecting e-paper display with temp/hum sensor to Home Assistant

Notifications You must be signed in to change notification settings

pawel-piwowar/home-assistant-thermometer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

E-paper thermometer for Home Assistant

Project features

  • Integrates with Home Assistant using WIFI and MQTT.
  • High quality temperature sensor SHT35 is used with precision 0.1 - 0.2 °C
  • 2.13inch E-Paper Cloud Module with ESP32 chip and attached battery. The final package is light and small. Could be used without external power source. Also could be powered and charged via usb-c without any additional circuits
  • Very low power consumption, light sleep mode of ESP32 is used.
  • Partial screen refresh function is used. Screen does not flicker, like it does when full refresh is made. Other sleep modes (e.g. deep sleep) could be used as well reducing power consumption even more (however I did not manage to avoid screen refreshes after deep sleep wake up).

Hardware used:

hardware.png

Wiring

Since E-Paper Cloud Module contains integrated ESP32, wiring is pretty easy.
wiring.png

Please note, that in case of this board, you will have to solder wires to ESP32 chip, since this board does not have gold pins socket, or even an option to mount it.

wiring2.png

Required libraries:

Home Assistant configuration

  • Install Home Assistant (HA) : https://www.home-assistant.io/installation/ .
  • Install MQTT broker add-on in HA : https://haprofs.com/setting-up-mqtt-mosquitto-broker-home-assistant/ Use "homeassistant.local" as broker name, remember user and password used for connection, it will be needed later.
  • Set "Enable Discovery" option in MQTT broker to on. Leave default discovery prefix set to "homeassistant" (This exact prefix is also used by MQTT library) MQTT_enable_discovery.png
  • Recommended : install: https://mqtt-explorer.com/ . Test if you can make a connection to MQTT broker (it will be also useful later for checking if end device is properly sending MQTT messages)
  • When everything is installed and thermometer device is operational and starts sending MQTT messages, it will be possible to add entities to HA dashboard using this MQQT broker screen: img_1.png

Code configuration

  • Prepare development environment, e.g. Arduino IDE: https://www.arduino.cc/en/software, set correct board, COM port, etc.
  • Enter your WIFI SID and password, MQTT user and password in: esp32_epaper_temp_hum_mqtt.ino
  • You can also modify other setting, e.g. SLEEP_SECONDS, if you want fast reaction in HA for being able to run automation based on temperature reading.
  • Provide your own implementation in place of Temp_Hum_Sensor_Sht_35.cpp if you want to use different model of sensor
  • Upload code, check logs in serial monitor
  • Check if new device is visible in HA/settings/Devices and Services/MQTT
  • Then you can add new entities to your dashboard in HA, create automations based on reading, see charts, etc.

Final effect

Dashboard in Home Assistant

img.png

Device

Temperature and humidity are shown one after the other. First humidity, then there is 2 seconds delay, temperature is shown next, following with sleep for 10 seconds. This way power consumption is minimalized.

big_digits_hum.jpg big_digits_temp.jpg

How it works

Temperature and humidity values are read using simple API provided by Temp_Hum_Sensor.h This way it is quite easy to use implementation for any sensor without modifying main code, e.g. : Temp_Hum_Sensor_Sht_35.cpp
Then if USE_DISPLAY option is set, temperature/humidity values are shown on epaper display. Again dedicated API is used here: Epaper_digits.h
This way all details of epaper maintenance are encapsulated in separate implementation code: Epaper_digits.cpp
I decided to use custom bitmap fonts for showing 0-9 digits and other symbols (dot, celsius symbol, etc.).
The last part is integration with Home Assistant. General idea is shown below: esp32-temp-hum-mqtt.drawio.png

I used this library : https://github.com/dawidchyrzynski/arduino-home-assistant for MQTT connection. It sends discovery MQTT messages for all of the sensors. This way no YAML configuration is required in HA. It also sends actual data read by sensors as MQTT messages.

Example of discovery MQTT message:
img.png

Example of data message:
img.png

About

Example of connecting e-paper display with temp/hum sensor to Home Assistant

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages