Skip to content

e-ink weather forecast by using ESPhome with Home assistant

Notifications You must be signed in to change notification settings

xangin/eink-weather-board

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ESPHome E-ink Weather board

Buy Me A Coffee

English | 正體中文

Thanks to Madelena for inspiring this project and providing the source code for weather data.

This project is a vertical E-ink weather forecast board placed at the entrance, automatically updating and displaying content at specified intervals.

There is also a horizontal version that can display temperature and humidity information for individual rooms on the E-ink: E-ink Dashboard

The vertical weather board displays:

  • Today's date
  • Current weather forecast
  • Weather forecast for the next four hours

Below are the hardware structure, ESPHome yaml code, and Home assistant yaml code.

Hardware

Installation

  1. Place the files in the /fonts folder and e-ink-weather-board.yamlin the HA/config/esphome folder.
  2. Place eink_dashboard_sensor.yaml in the HA/config/packages folder.
  3. Place background.png from the /images folder in the HA/config/esphome/images folder.
  4. Modify e-ink-weather-board.yaml and eink_dashboard_sensor.yaml to match your HA entity IDs. Instructions are below
  5. Check for YAML code errors in HA.
    1. Developer Tools > YAML > Check Configuration, ensure no errors in the bottom left notification.
    2. YAML Configuration Reloading > Template Entities
    3. Developer Tools > States > Check sensor.eink_sensors to ensure it appears and contains the desired content.
  6. Flash e-ink-weather-board.yaml to the ESP32 module in ESPHome.
  7. Done!

ESPHome yaml Explanation

Manually update the panel in HA

button:
  - platform: template
    name: '${devicename} Refresh'
    icon: 'mdi:update'
    on_press:
      then:
        - component.update: 'my_display'
    internal: false

Pass HA time to ESPHome

time:
  - platform: homeassistant
    id: ha_time

Panel update timing

Note: Long-term power to this panel may cause increasing blurriness. It is recommended to power the ESP32 only when refreshing or enter Deep Sleep to avoid this issue.

The default screen does not automatically update update_interval: never. It is updated by HA automation based on the desired interval.

Automation process:

1. Trigger automation at intervals:

  trigger:
    - platform: time_pattern     
      # /2 means every 2 hours, use /1 for every hour
      hours: "/2" 
      # 1 means it runs at the 1st minute of the hour, like 06:01, 08:01, 10:01
      minutes: 1

2. Condition:

Set the update period in HA > Settings > Devices & Services > Helpers > Add Helper > "Daily Timer" > Set the desired update period, name it eink_refresh_time.

  condition:
    #Update only during allowed periods
    - condition: state
      entity_id: binary_sensor.eink_refresh_time
      state: 'on'

3. Action:

   action:
   #Press the update button, replace with your entity ID
     - service: button.press
       data:
         entity_id: button.eink_weather_board_screen_refresh

Remember to check the configuration in Developer Tools > YAML > Check Configuration.

Once everything is correct, reload the automation in YAML Configuration Reloading > Automation.

HA template sensor Explanation

Ensure the following code is written inconfiguration.yaml for eink_dashboard_sensor_new.yamlto take effect

Ensure the weather integration supports hourly forecasts (built-in met.no does).

The following YAML calls the "hourly" weather forecast service at 1 minute past every hour and updates sensor.eink_sensors with the content.

Update the panel after updating the weather forecast to avoid seeing the previous hour's forecast.

  - trigger:
      - platform: time_pattern     
        hours: "/1" 
        minutes: 1
    action:
      - service: weather.get_forecasts
        target:
          entity_id: weather.myhome #replace with your weather forecast entity id
        data:
          type: hourly
        response_variable: hourly  

Use the first set of the weather forecast as this hour's forecast and display the 2nd to 5th sets for the next four hours.

attributesseparates the information from the weather forecast as:

  • Temperature for this hour: today_temperature
  • Humidity for this hour: today_humidity
  • Precipitation probability for this hour: today_precipitation
  • Time for the next four hours: forecast_weekday_1, forecast_weekday_2, forecast_weekday_3, forecast_weekday_4
  • Weather icons for the next four hours: forecast_condition_1, forecast_condition_2, forecast_condition_3, forecast_condition_4
  • Temperature for the next four hours: forecast_temperature_1, forecast_temperature_2, forecast_temperature_3, forecast_temperature_4

References

About

e-ink weather forecast by using ESPhome with Home assistant

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published