Skip to content

kyme32/esphome-wx

 
 

Repository files navigation

ESPHome Weather Display

More information on my full weather station setup can be found in the docs folder, a good starting point is the background document.

As more devices are being added to the supported devices, the structure of this repository has recently undergone some changes. Common configuration and repeated code is being migrated to includes and packages where appropriate.

The configurations here expect all network, api, web and portal configuration to be found in an include file named common_network.yaml in the same directory.

Additionally the following packages are now included in this repository:

  • packages/ha_sensors.yaml - sensors used by demo code from Home Assistant
  • packages/internal_sensors.yaml - internal sensors (uptime, wifi signal)
  • packages/fonts.yaml - common fonts, colours and characters

The packages/fonts.yaml file utilises substitutions to abstract the unicode needed, these substitutions can be included along with your top level substitutions using an inline include:

e.g:

substitutions:
  NODE: "Kitchen Display"
  TEXT_TITLE: "CatsLair"
  FONT_SIZE_CLOCK: "52"
  FONT_SIZE_BIG: "30"
  FONT_SIZE_ICONS: "60"
  <<: !include includes/fonts_subs.yaml

These fonts substitutions require some font sizes to be defined in substitutions to allow easy transfer between different density displays demonstrated here.

Buying a ready made display

ESP32-2432S028

ESP32-2432S028

I recently picked up an Sunton ESP32-2432S028; integrated ILI1934, Touchscreen and ESP32 all-in-one board as an easy way to deploy a second WX screen to the smart house.

See ESP32-2432S028 for more information on this device.

This device also contains an LDR for display brightness adjustment, for this you can define an adjustment value, the voltage range and utilise auto_dim.h.

The full ESPhome configuration, as used by my coffee table unit can be found at esp32-2432s028.yaml.

This device is now fully supported by this code.

ESP32-2424S012

ESP32-2424S012

Another new addition to my devkit collection is the ESP32-2424S012, using a different TFT and touchscreen controller than the above board.

See ESP32-2424S012 for more information on this device.

Support of this device is a work in progress.

  • Touch screen is not currently working.
  • Display is working, using a component that is included in this repository (forked and maintained for latest esphome).

Building the display

Hardware Required

  • ESP32 (example uses a DOIT DevKit V1)
  • ESPhome compatible 240x320 TFT Screen (example uses an Adafruit ILI1934 2.8" TFT Touchscreen)

Wiring

Wiring Diagram

ESP32 ILI1934 Description
VCC VCC +3.3V Supply
GND GND Ground
D27 CS TFT SPI Cable Select
D25 RESET TFT Reset
D26 DC TFT DC
D23 SDI TFT SPI MOSI
D18 SCK TFT SPI CLK
RX2 LED TFT Backlight
D19 SDO TFT SPI MISO
  • Touchscreen functionality coming soon.

ESPHome Base Definitions

spi:
   - clk_pin: GPIO18
     mosi_pin: GPIO23
     miso_pin: GPIO19
     id: bus_tft

display:
  - platform: ili9xxx
    id: my_display
    spi_id: bus_tft
    reset_pin: GPIO25
    dc_pin: GPIO26
    cs_pin: GPIO27
    model: ili9341
    data_rate: 80MHz

Expected Sensor Names

ESPhome Type Description My Sensor
nettime Time Current Time Homeassistant Time
outside_temperature Sensor Outside Temperature (Balcony) Holman via RTL433
outside_humidity Sensor Outside Humidity (Balcony) Holman via RTL433
barometric_pressure Sensor Outside Barometric Pressure Holman via RTL433
rain_hr Sensor Rain Last Hour WeeWX/Holman
rain_today Sensor Rain Today WeeWX/Holman
wind_speed Sensor Balcony Windspeed Holman via RTL433
inside_temperature Sensor Inside Temperature (Lounge) Xiaomi Air Purifier 3H
inside_humidity Sensor Inside Humidity (Lounge) Xiaomi Air Purifier 3H
kitchen_temperature Sensor Kitchen Temperature Xiaomi Aqara Temp/Humidity
kitchen_humidity Sensor Kitchen Temperature Xiaomi Aqara Temp/Humidity
bedroom_temperature Sensor Bedroom Temperature ESPhome SHT30
bedroom_humidity Sensor Bedroom Temperature ESPhome SHT30
bedroom_pressure Sensor Bedroom Barometric Pressure ESPhome BME280
bathroom_temperature Sensor Bathroom Temperature Xiaomi Aqara Temp/Humidity
bathroom_humidity Sensor Bathroom Temperature Xiaomi Aqara Temp/Humidity
aquarium_temperature Sensor Aquarium Temperature ESPHome Dallas DS18B20
pm2_5 Sensor Lounge Particulate Matter Xiaomi Air Purifier 3H
tvoc Sensor Bedroom TVOC ESPhome SGP30
eco2 Sensor Bedroom eCO2 ESPhome SGP30
weather_condition Text Current Conditions OpenWeatherMap
moon Sensor Moon Phase Home Assitant
sunrise Sensor Moon Phase Home Assitant
sunset Sensor Moon Phase Home Assitant

Current conditions coded in the wx.yaml lambda function for the display convert OpenWeatherMap current conditions to a Material Iconset icon. This can easily be adapted for other current conditions reporting.

This list changes over time with changes to my environment; refer to the current packages/ha_sensors.yaml file for the latest definitions used in my sample code.

Get Started

Create a new ESPhome device

esphome wizard devicename.yaml

Edit the newly created devicename.yaml file, firstly adding the include file from this repository:

esphome:
  name: testscreen
  includes:
  - includes/display_functions.h

All sensors used in the demo code can be found in the packages/ha_sensors.yaml and packages/internal.yaml files.

Download the fonts used in my example; it expects to find them in the fonts/ directory:

Append the wx.yaml from this repository to your newly created ESPhome configuration.

To Do

  • Add media player controls/summary.
  • Add light/switch controls.
  • Add alarm panel.
  • Design a 3D Printed Case.

About

ESPhome TFT Weather Station

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 65.2%
  • C 22.7%
  • Python 12.1%