pdf-icon

Atom Socket Home Assistant Integration

This tutorial will introduce how to use the Atom Socket smart outlet integrated into Home Assistant to achieve switch control and energy monitoring.

Preparation

Note

This tutorial uses ESPHome 2025.12.5 to compile and upload firmware. If you encounter compilation/upload issues, please consider switching the ESPHome version.

Create Device

  1. Create a new device. Click the green button in the lower-right corner to create the device.

  2. Create device name.

    2.1 Click CONTINUE.

    2.2 Click New Device Setup.

    2.3 Enter the device name, then click NEXT.

  3. Select device type.

    3.1 Click ESP32.

    3.2 Click SKIP.

  4. Start editing the YAML file. Click EDIT. We can customize device functions through the YAML file.

Device Configuration

The following is the core part of the code, along with relevant references and instructions.

Uart Configuration

Add uart component:

uart:
  rx_pin: GPIO22
  baud_rate: 4800
  parity: EVEN

Sensor Configuration

Add Sensor component:

The main chip module is the HLW8032 energy metering chip, which is responsible for collecting and reading sensor data such as voltage, current, and power.

sensor:
  - platform: hlw8032
    voltage:
      name: HLW8032 Voltage
      id: hlw8032_voltage
    current:
      name: HLW8032 Current
      id: hlw8032_current
    power:
      name: HLW8032 Power
      id: hlw8032_power
    apparent_power:
      name: HLW8032 Apparent Power
      id: hlw8032_apparent_power
    power_factor:
      name: HLW8032 Power Factor
      id: hlw8032_power_factor

Switch Configuration

Add Switch component:

switch:
  - platform: gpio
    name: "Atom Socket"
    pin:
      number: GPIO23
      inverted: False
    restore_mode: ALWAYS_ON

Download and Flash Firmware

  1. After making changes, click SAVE and INSTALL in the upper-right corner, then select Manual Download in the pop-up window.

  2. Once the firmware compilation is complete, click download and select Factory format(Previously Modern).

    Note
    Click Atom Socket to view the complete example configuration. The first compilation may take some time, depending on the performance of the Home Assistant host and the network quality.
  3. Connect the device to your host via a USB Type-C data cable. Open ESPHome Web and click CONNECT to connect to the device.

  4. Find the corresponding serial port number.

  5. Click INSTALL.

  6. Select the previously compiled firmware to upload.

  7. After the flashing is complete, restart the device.

Quick Start

  1. In Home Assistant, click Settings > Devices & Services to enter the integration management page.

  2. Click Add to integrate the device into Home Assistant.

  3. After adding the device, the data will be displayed correctly.

  4. Finally, we add these entities to the dashboard; the following shows their display results.

    Note
    HLW8032 Apparent Power and HLW8032 Power will only display data when the relay switch is turned on.

Video

On This Page