How can I see my smart plugs' standby consumption as daily Wh?
Translated from Türkçe by AI ·
Hello, for my graduation project I set up an experiment in my room in the dorm. I may be posting in the wrong subforum, sorry about that. The topic: I want to measure how much cheap smart plugs draw by themselves even when the relay is off. My advisor said “measure it and bring me the graph”, and that’s all.Setup: ESP32 + PZEM-004T v3.0 (UART, 9600 baud), with 3 different plugs that I connected one after another behind the PZEM and measured. The ESP32 sends this to Hermetry over MQTT every 10 seconds:
{"power_w": 0.9, "voltage_v": 228.4, "current_a": 0.012, "energy_wh": 1532}
I can see the watt value on the graph, no problem. But I need daily energy (Wh/day). In the Chart card I used sum as the aggregate, and for power_w it gave a crazy number like 7700 for one day. A 0.9 W plug can’t use 7700 Wh a day, surely 🙂 With avg I get 0.9. If I multiply that by 24, is that correct, or is there a neater way?Also, the midnight measurements seem to split oddly, but I think that’s a separate topic.
Merhaba, bitirme ödevim için yurttaki odamda bir deney kurdum, belki yanlış alt foruma yazıyorum kusura bakmayın. Konu şu: ucuz akıllı prizler röle kapalıyken bile kendileri ne kadar çekiyor, onu ölçmek istiyorum. Hocam “ölçüp grafiğini getir” dedi, o kadar.
Düzenek: ESP32 + PZEM-004T v3.0 (UART, 9600 baud), PZEM’in arkasında sırayla takıp ölçtüğüm 3 farklı priz. ESP32 her 10 saniyede bir Hermetry’ye MQTT ile şunu gönderiyor:
{"power_w": 0.9, "voltage_v": 228.4, "current_a": 0.012, "energy_wh": 1532}
Grafikte watt değerini görüyorum, sorun yok. Ama bana günlük enerji lazım (Wh/gün). Chart kartında aggregate’i sum yaptım, power_w için bir günde 7700 gibi saçma bir sayı çıktı. 0.9 W bir priz günde 7700 Wh harcayamaz herhalde 🙂 avg ile 0.9 çıkıyor, onu 24 ile çarparsam doğru mu olur, yoksa daha düzgün bir yol var mı?
Bir de gece yarısı ölçümler bir garip bölünüyor gibi, ama o ayrı konu sanırım.
Translated from Türkçe by AI ·
Summing watts with sum doesn’t give energy, you’re adding up each 10-second reading. 8640 readings per day × 0.9 W ≈ 7776, that’s where the number comes from.
sum ile watt toplamak enerji vermez, her 10 saniyelik okumayı topluyorsun. Günde 8640 okuma × 0.9 W ≈ 7776, sayı oradan geliyor.
Translated from Türkçe by AI ·
Oh right, so I’m multiplying by 8640. Then should I do avg × 24? I need to explain the formula in the report, my supervisor will ask “why”.
Haa doğru, 8640 ile çarpmış oluyorum. O zaman avg × 24 mü yapayım? Raporda formülü açıklamam lazım, hocam “neden” diye soracak.
Translated from Türkçe by AI ·
avg × 24 is a rough estimate, but with one condition: the readings must arrive regularly. Hermetry’s avg is not time-weighted. It is the plain mean of the readings within a bucket. If the ESP32 drops off Wi-Fi for half an hour, that half hour is not counted at all, and if readings arrive in a rush after it reconnects, those minutes get too much weight.By the way, I work on the energy side. With the relay off, seeing 0.4 to 1.2 W on these plugs is normal. The Wi-Fi module stays on all the time. So a reading of 0.9 on yours is reasonable.
avg × 24 kabaca tutar ama bir koşulla: okumalar düzenli gelmeli. Hermetry’nin avg’si zamana göre ağırlıklı değil, kova içindeki okumaların düz ortalaması. ESP32 yarım saat Wi-Fi’den düşerse o yarım saat hesaba hiç girmez, bir de yeniden bağlanınca peş peşe gelirse o dakikalar fazla ağırlık alır.
Bu arada ben enerji tarafında çalışıyorum, bu prizlerde röle kapalıyken 0.4 ile 1.2 W arası görmek normal. Wi-Fi modülü sürekli açık duruyor. Sende 0.9 çıkması makul.
Translated from Türkçe by AI ·
You already have PZEM’s own counter, energy_wh. Use it, don’t bother deriving energy from watts. I went through the same thing when I measured my fridge at home with the same module.In the Chart card, select the energy_wh key, bucket 1 day (1d), aggregate increase. increase is meant for counter-type values: it subtracts the last value of the previous bucket from the last value of each bucket. If the counter goes down (if you reset the PZEM or it rolls over at 9999 kWh), it counts that bucket as if it started from zero, so you won’t see a negative value.The advantage is this: even if the ESP32 drops off for a while, the counter keeps counting on the PZEM, and when it reconnects the energy difference in between isn’t lost. avg × 24 loses that gap.I think the midnight split you mentioned is this: day buckets are cut according to UTC, midnight to midnight UTC. Since Turkey is UTC+3, your “day” appears to start at 03:00 local time. If you write one line about this in the report, it won’t be a problem.If you also want a derived key in the stream (for example the difference at each reading), there is a Delta block, but it isn’t needed for a daily total. Both are explained here: Derived values.
Elinde zaten PZEM’in kendi sayacı var, energy_wh. Onu kullan, watt’tan enerji türetmekle uğraşma. Ben aynı modülle evdeki buzdolabını ölçerken aynı şeyi yaşadım.
Chart kartında energy_wh anahtarını seç, kova olarak 1 gün (1d), aggregate olarak increase. increase sayaç tipi değerler için var: her kovanın son değerinden bir önceki kovanın son değerini çıkarıyor. Sayaç geri düşerse (PZEM’i resetlersen ya da 9999 kWh’de dönerse) o kovada sıfırdan başlamış gibi sayıyor, yani eksi değer görmezsin.
Avantajı şu: ESP32 bir süre koparsa bile sayaç PZEM’de saymaya devam ediyor, tekrar bağlandığında aradaki enerji farkı kaybolmuyor. avg × 24’te o boşluk kayıp.
Gece yarısı bölünme dediğin şey de bence şu: gün kovaları UTC’ye göre kesiliyor, gece yarısından gece yarısına UTC. Türkiye UTC+3 olduğu için senin “gün”ün sabah 03:00’te başlıyor gibi görünür. Rapora bunu bir satırla yazarsan sorun olmaz.
Akış içinde ayrıca bir türetilmiş anahtar istersen (mesela her okumadaki fark) Delta bloğu da var, ama günlük toplam için gerek yok. Burada ikisi de anlatılıyor: Türetilmiş değerler.
Translated from Türkçe by AI ·
It worked! With increase, plug 1 gave 21.4 Wh/day, plug 2 gave 11.8, and plug 3 gave 27.3. I had computed 21.6 with avg × 24, which was close, but plug 2 had an hour-long disconnection in between, and there the difference was up to 2 Wh. I also noted the UTC issue in the report. Many thanks 🙏
Oldu! increase ile 1. priz 21.4 Wh/gün, 2. priz 11.8, 3. priz 27.3 çıktı. avg × 24 ile 21.6 bulmuştum, yakınmış ama ikinci prizde arada bir saat kopma olmuş, orada fark 2 Wh’ye çıkıyordu. UTC olayını da rapora not düştüm. Çok teşekkürler 🙏
- You must be logged in to reply to this topic.
Join the conversation
Sign in to ask and answer, like helpful posts and mark the reply that solved your problem. Every contribution earns points and levels.

