esphome / feature-requests

ESPHome Feature Request Tracker
https://esphome.io/
417 stars 26 forks source link

AC Voltage with ESP32 and ZMPT101B #1389

Open Pro-Control opened 3 years ago

Pro-Control commented 3 years ago

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

Additional context

Stybyk commented 1 year ago

I found developed a solution Here good to add this into supported integration.

alwwwex commented 8 months ago

That's will be nice to have! Trying to get it work via custom component, and it's not simple. Almost everyone using just CT clamp for current and hardcoded value of grid voltage to calculate Watt's. CT current clamps working fine, but to integrate ZMPT101B - no solution "from box".

gaitolini commented 7 months ago

Interessante ler os comentários, bastante informação.... Estou tentando criar um componente externo para o ZMPT101B, não é tão simples, não domino o python então declarar sensor.py está tanto difícil para mim. estou me baseando em um projeto do https://github.com/sourabhjaiswal/zmpt101b