esphome / esphome/feature-requests

AC Voltage with ESP32 and ZMPT101B

Open
#1,389 3 comments 11 reactions 0 assignees View on GitHub
Type: Power Meter
Dominant language
No language data
Stars
450
Forks
29
PR merge metrics
No merged PRs in 30d

Description

**Describe the problem you have/What new integration you would like**
Please add new integration for ZMPT101B to reading AC Voltage with ESP32.

**Please describe your use case for this integration and alternatives you've tried:**
Reading AC Voltage with ESP32 on ADC pins.
I try to use ESP32 and ZMPT101B with [EmonLib](https://github.com/Savjee/EmonLib-esp32) on Arduino IDE it works
but after convert it to Custom Sensor under ESPHome get unstable reding
Power.h file
`
#include "esphome.h"
#include "EmonLib.h"

class Volt : public PollingComponent, public Sensor {

public:

EnergyMonitor main;
EnergyMonitor g_one;
EnergyMonitor g_two;
Sensor *main_v = new Sensor();
Sensor *g1_v = new Sensor();
Sensor *g2_v = new Sensor();
Volt() : PollingComponent(1500) {}

void setup() override {
main.voltage(36, 45, 1.7);
g_one.voltage(39, 45, 1.7);
g_two.voltage(34, 45, 1.7);
}

void update() override {

main.calcVI(20,2000);
float main_f = main.Vrms;
main_v->publish_state(main_f);


g_one.calcVI(20,2000);
float g_one_f = g_one.Vrms;
g1_v->publish_state(g_one_f);


g_two.calcVI(20,2000);
float g_two_f = g_two.Vrms;
g2_v->publish_state(g_two_f);

}

};
`

power.yaml

`
sensor:
- platform: custom
lambda: |-
auto voltage = new Volt();
App.register_component(voltage);
return {voltage->main_v, voltage->g1_v, voltage->g2_v};

sensors:
- name: "Main Volt"
id: main_volt
unit_of_measurement: V
accuracy_decimals: 2

- name: "G1 Volt"
id: g1_volt
unit_of_measurement: V
accuracy_decimals: 2

- name: "G2 Volt"
id: g2_volt
unit_of_measurement: V
accuracy_decimals: 2
`

**Additional context**

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the provided Power.h and power.yaml snippets and the linked EmonLib-esp32 project, then determine how this feature request fits ESPHome's custom sensor approach for ESP32 ADC readings. Done means a documented ZMPT101B integration that provides stable AC-voltage readings for the described use case.

Written by the indexing model from the issue text.

Assessment

Tech stack
arduino
Domain
embedded-iot
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.