/esphome-tiny-display

A simple config for a 0.96" OLED Display used with an ESP8266 D1 Mini.

esphome-tiny-display

A simple config for a 0.96" OLED Display used with an ESP8266 D1 Mini.

20220104_10214320220110_204443

I recently created this project to learn how to use a simple display with esphome. I use a few entities from Home Assistant to fetch the current weather as well as forecast weather.

What you will need

How to get started

  • Solder pin headers onto the display as well as the D1 Mini. A tip is to solder on female headers onto the D1 Mini, so you can plug in the male headers from the display directly into the female headers of the D1 Mini. 20220104_102159
  • Copy the yaml file as well as the font files into your esphome folder
  • Ensure your Secrets file in Esphome is up to date
  • Modify the yaml file substitutions fields according to your parameters
    • Your device name
    • Your Static IP Details. If you dont want to set a static IP, comment out this line as well as the lines for manual_ip under the wifi section!
    • Entities for an internal temperature sensor and an external temperature sensor
    • An entity for the current weather condition - I use SMHI in Sweden, you could select your local weather service
    • Entities to show the forecast low and forecast high for today. See forecast section below.
  • Compile and upload to your hardware!

Make the right connections

D1 Mini Pin Display Pin
5V VCC
GND GND
D4 SCL
D3 SDA

Weather and Forecast using weather service

I use the SMHI integration in Home Assistant since I live in Sweden as my default weather service. You can use whichever local weather service you have in your area.

By default, the state of the weather service corresponds to the current weather condition (cloudy, clear etc.), as per the Home Assistant weather page.

weather entity

The forecast high and low for the day are contained as state attributes within the weather entity in Home Assistant. I created template sensors in Home Assistant to extract these into their own entities.

Here is the code I added to my configuration.yaml to make this happen:

template:
  - sensor:
      - name: Todays Forecast High
        state: >
          {{ states.weather.smhi_home.attributes.forecast.0.temperature }}
      - name: Todays Forecast Low
        state: >
          {{ states.weather.smhi_home.attributes.forecast.0.templow }}

These entities are then called out from the esphome yaml to fetch forecast data.

Spend some time to examine your weather entity under Developer Tools --> States. If your weather entity is formatted differently or has different attributes, make changes to your template code for the sensors and try it out under Developer Tools --> Template before inserting into your configuration.yaml.

Case

I worked with my friend Magnus Skärström to design a case for the display and D1 Mini. The case also has a hole for a 6mm push button which I plan to add soon. 20220110_204443