pdf-icon

Atom Socket Home Assistant Integration

Introduction

Atom Socket is a smart power socket compatible with the ATOM controller. It integrates the HLW8032 high-precision energy metering IC, enabling measurement of voltage, current, power, and power factor via serial communication. The socket follows Japanese standards and includes a single-channel relay (AC 100–120V, 10A) for power control. When paired with a Wi-Fi–enabled ATOM controller, it supports remote control and energy monitoring. An onboard HY2.0-4P interface allows interaction with external devices, such as relay signal input and button signal output.

Preparation

Tip
In this tutorial, the firmware is compiled and uploaded with ESPHome 2025.12.5. If you encounter compile/upload issues, consider switching ESPHome to this version.

Step 1. Create New Device

  • Click the green button in the lower right corner to create a device.

Step 2. Create Device Name

  • Click CONTINUE.

  • Click New Device Setup.

  • Enter the name of the device and click NEXT.

Step 3. Choose Device Type

  • Click ESP32.

  • Click SKIP.

Step 4. Start Edit YAML File

  • Click EDIT. We can customize device functionality through YAML files.

Device Setup

The following is the core part of the code. Relevant references and explanations are provided below.

Sensor Configuration

  • Add the Sensor components

  • The primary 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

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

Firmware Build

  • Click INSTALL again to flash and wait for it to complete.

  • After making changes, click SAVE and INSTALL in the top-right corner, then choose Manual Download in the popup.

  • After the firmware compilation is complete, click Download and select Factory format(Previously Modern)

Tip
Click Atom Socket to view the complete example configuration. The first build may take a while, depending on the performance of the Home Assistant host and network quality.

Firmware Upload

  • Connect the device to your host via a USB Type‑C cable. Open ESPHome Web and click CONNECT to connect to the device.

  • Locate the corresponding serial port number

  • Click INSTALL

  • Select the previously compiled firmware to upload.

Tip
Please note that after the download is completed, the device must be reset.

Home Assistant Integration

  • Click Settings -> Device & services to check the device.

  • We can find the corresponding device in the Discover section.

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

  • Finally, we add these entities to the Dashboard, and the following shows their display results.

Tip
Data will only be displayed for HLW8032 Apparent Power and HLW8032 Power when the relay switch is turned on.
On This Page