Skip to content

How to use AC Dimmer for Home Assistant

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. 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

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

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

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.

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

Creat a new AC Dimmer 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 dimmer.yaml to the end of the file. image.png

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

    - custom_at.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 "custom_at.h". image.png image.png

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

Install code to AC Dimmer

  • Go to ESPHome page, find your AC Dimmer 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

  • Use Type-C USB cable to connect the ac-dimmer-for-home-assistant 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.


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

Configuration AC Dimmer

  • 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.


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

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


IMG_20240207_151335(1).jpg Note, the HA AC Dimmer does not work with LEDs, we recommend using incandescent lamps or devices that use AC power and do not have an internal voltage regulator.




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