pdf-icon

Unit AC Measure Home Assistant Integration

This tutorial shows how to use the Unit AC Measure AC measurement unit with an AtomS3R controller and integrate it into Home Assistant to monitor AC voltage, current, power and energy in real time.

1. Preparation

  1. Hardware
  • 1 x Unit AC Measure
  • 1 x AtomS3R
  • 1 x HY2.0-4P Grove Cable (20cm)
  • 1 x Home Assistant host (server, mini PC, NAS, etc.)
  1. Software & versions

2. Create Device

  1. Open ESPHome Dashboard. If the initial wizard appears, click CONTINUE.

  1. Click the green + button in the bottom right to create a new device.

  1. Click New Device Setup to enter the device creation wizard.

  1. Enter a device name and click NEXT.

  1. Select the device type and click ESP32S3.

  1. Click SKIP to skip the encryption key setup.

  1. Click EDIT to open the YAML editor and customize the device configuration.

3. Device Configuration

3.1 External components

Add an External Components block in the YAML file to load the unit_acmeasure sensor driver.

external_components:
  - source: github://m5stack/esphome-yaml/components
    components: unit_acmeasure
    refresh: 0s

3.2 I2C bus configuration

Add the I2C component to configure the communication pins between Unit AC Measure and AtomS3R.

i2c:
  sda: GPIO2
  scl: GPIO1
  scan: true
Info
PORT.A on AtomS3R corresponds to SDA: GPIO2 and SCL: GPIO1. If you use a different port, please adjust the pins accordingly.

3.3 Sensor configuration

Add the Sensor component to enable AC measurement sensors.

sensor:
  - platform: unit_acmeasure
    id: acmeasure1
    address: 0x42
    update_interval: 2s
    voltage:
      name: AC Voltage
    current:
      name: AC Current
    power:
      name: Active Power
    apparent_power:
      name: Apparent Power
    power_factor:
      name: Power Factor
    energy:
      name: Energy

Main parameter description:

Parameter Value Description
address 0x42 I2C address of the Unit AC Measure.
update_interval 2s How often the AC measurement values are updated in Home Assistant.
voltage AC Voltage Reports the RMS AC voltage of the measured circuit.
current AC Current Reports the RMS AC current.
power Active Power Reports the active (real) power in watts.
apparent_power Apparent Power Reports the apparent power in volt‑amperes (VA).
power_factor Power Factor Reports the power factor (ratio of active to apparent power).
energy Energy Reports accumulated energy consumption.

4. Build and Flash Firmware

4.1 Build firmware

  1. After editing the YAML configuration, click SAVE in the top right, then click INSTALL.

  1. In the popup dialog, select Manual Download.

  1. Wait for the firmware to compile, then click Download and choose Factory format (Previously Modern) to save the firmware file locally.

Info
For a complete example configuration, see Unit AC Measure. The first build may take some time depending on the performance of your Home Assistant host and network conditions.

4.2 Flash firmware

  1. Connect AtomS3R to your computer using a USB Type-C cable. Open ESPHome Web and click CONNECT.

  1. In the serial port selection dialog, select the correct port.

  1. Click INSTALL.

  1. Select the firmware file downloaded in step 3 and start flashing.

Warning
After flashing is complete, you must reset the device; otherwise the firmware may not start correctly.

5. Start Using in Home Assistant

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

  1. In the Discovered section, find the Unit AC Measure device, click CONFIGURE, and follow the wizard to complete the setup.

  1. After the device is added, you will see multiple sensor entities on the device page such as AC Voltage, AC Current, Active Power, Apparent Power, Power Factor and Energy, along with their real-time values.

  1. Finally, add these sensor entities to a dashboard so you can monitor AC power parameters in real time.

On This Page