Skip to content

Weather Station for Home Assistant/ ESPHome

1. Install Home Assistant operating system

At first, we need a device equipped with Home Assistant system, and which we choose is DIY with Raspberry Pi.

1.1 Tools required

  • Raspberry Pi 4 or Raspberry Pi 3 Model B(Model A does not have enough RAM)with power supply
  • MicroSD card(32 GB or bigger card is recommended)
  • Ethernet connection

1.2 Preparation of Raspberry Pi Imager

  • Download and install the Raspberry Pi Imager on your computer
  • Open the Raspberry Pi Imager and select your Raspberry Pi device rpi_imager_start.png

  • Choose the operating system rpiha.gif

1.3 Write the image to SD card

  • Insert the SD card into the computer. Note: the contents of the card will be overwritten.
  • Select your SD card. image.png

  • select Next, and wait for the Home Assistant OS to be written to the SD card. image.png

1.4 Start up Raspberry Pi

  • Insert the SD card into your Raspberry Pi.
  • Plug in an Ethernet cable and make sure the Raspberry Pi is connected to the same network as your computer.
  • Connect the power supply to start up the device.

2. Access Home Assistant and add ESPHome to your Add_on

Within a few minutes after connecting the Raspberry Pi, you will be able to reach your new Home Assistant.

  • you can access Home Assistant at homeassistant:8123 or http://X.X.X.X:8123 (replace X.X.X.X with your Raspberry Pi’s IP address). image.png

  • select Create my smart home, and enter your name, username, and password. image.png

  • Follow the instructions to complete the setup and finally select Finish. image.png

  • Installing ESPHome Dashboard image.png

2.1 Creat a new Weather Station device

  • Sign in your Home Assistant and go to ESPHome page, select NEW DEVICE. image.png

  • Click CONTINUE, enter your new device name and click NEXT. image.png

  • Select ESP32 and click SKIP, you will return to the ESPHome page, now ,you have created a new ESP32 device. image.png

  • Select EDIT and copy the code weather_station.yaml to the end of the file. image.png

  • At the beginning of the file, friendly_name next to the line, copy:

includes:
- my_custom_sensor.h

Note: Pay attention to indentation, there are excess indentation will report errors image.png

  • Click SAVE

  • Go to the File editor page, click the folder icon in the upper left corner, enter “config/esphome/”, and create a new file named "my_custom_sensor.h". image.png image.png

  • Copy the code my_custom_sensor.h provided by Makerfabs and save it. image.png

2.2 Install code to Weather Station

  • Go to ESPHome page, find your Weather Station device, click Install, select Manual Download and select Modern format, wait for the compilation to complete, then wait for the bin file download to finish image.png image.png

  • Connect the weather-station-for-home-assistant-esphome and PC, open download page, select CONNECT, in the displayed page, select COM port.

image.png image.png

  • After the connection is successful, click INSTALL, choose the bin file you just downloaded and click INSTALL.

image.png image.png

  • Wait for the installation to complete. when download success, click LOGS, find IP information.

image.png

Note if the connection is not successful, hold down the Flash key, then press the Reset key, and then click INSTALL again.

2.3 Configuration weather station

  • Go back to the ESPHome page, select EDIT for your device, and go to the YAML edit page, copy API: encryption: key, such as “jUqgQfRiHpESrBY0AW8lZWxYgv8C9nX/nqeoU8eim2E=” image.png

  • Return to the HA page, select Configuration, and select devices and services image.png

  • If HA automatically identifies the local device, click Configure to add the device automatically. If no, continue to add the device. This is related to the configuration of the HA router. image.png

  • Search for ESPHome, and select it, enter the IP address you just obtained.

image.png

  • Enter the API key and then submit. OK, now, the device has been added successfully!

2.4 HA UI Setup

Normally, HA recognizes this automatically, but if the home page has been manually modified, HA will never add any device display again.

  • Go to the HA home page, click the three dots in the upper right corner, select Edit dashboard.You can see the color of the interface changes. image.png

  • Now, select the add card in the lower right corner, click on the "Entity" card, and find the relevant content of Relay8, add them and click SAVE. image.png image.png

  • The way to add cards is the same as the use of HA, you can arrange the page by yourself.Click Finish to exit editing The reference interface is as follows: image.png

3. Result

video_20240208_162917_edit 1.gif

4. FAQ

You can list your question here or contact techsupport@makerfabs.com for technology support. Detailed descriptions of your question will be helped to solve your question.

5. Resource