fvilmos / power_meter_mqtt

esp32 power meter for sensors with pulse output. Implements MQTT for status reporting. Accurate and easily can be integrated with Home Automation systems.
GNU General Public License v3.0
24 stars 5 forks source link

DHT22 support #5

Open iLLiac4 opened 9 months ago

iLLiac4 commented 9 months ago

Hi. Would it be possible to add DHT22 support? And also yearly usage.

TNX

iLLiac4 commented 9 months ago

I have few other questions:

  1. What happens if wifi is lost?
  2. Is there a reset button to zero it? Similar to this one https://github.com/oh2mp/esp32_energymeter ? TNX
fvilmos commented 9 months ago

I have few other questions:

  1. What happens if wifi is lost?
  2. Is there a reset button to zero it? Similar to this one https://github.com/oh2mp/esp32_energymeter ? TNX

Hello iLLiac4,

  1. if wifi is not available on start-up , the SW will wait until can connect. /Wait for connection/ while (WiFi.status() != WL_CONNECTED) { delay(500);

    ifdef DEBUG

    Serial.print(".");

    endif

    } 1.1 on mqtt loss, the system waits 3s than tryes to reconnect on wifi + mqtt

    /reconect on Mqtt loss/ if (client.state()< 0) {

    ifdef DEBUG

    Serial.println("No MQTT Connection, reconnect");

    endif

    delay (3000); setup(); ...

  2. there is no physical reset button, if is the case I just plug out the USB cable than reconnect it. But...the mqtt commands can be used to do this automatically (in home-assistant you can link it to automation).

                          "Additionally the following mqtt commands can be used:
                          - topic: /pulseenergymonitor/cmd
                          - payload: c / r
                            c - clear kWh information
                            r - reset the device"
fvilmos commented 9 months ago

Hi. Would it be possible to add DHT22 support? And also yearly usage.

TNX

DHT22 seams to be possible trough the DHT library, unfortunately I do have such a sensor, therefore, I would not be able to test it. Would it be great if you could implement it on a fork, then merge it with this. Yearly usage was on in my plan, I need to analyze if it would be possible to add.

Regards.