Hello @ruegerth,
Thanks for this detailed feedback, it will help us understand the situation better 
I think the calculation isn’t wrong, but the data sent is not what Gladys expects. There are two concepts to clearly distinguish:
- kW = an instantaneous power (what you’re consuming at time T)
- kWh = an energy (a power over a duration)
Your meter displays 0.345 kW: this is a power, not a consumption.
How Gladys calculates consumption
Gladys’ energy monitoring is based solely on « Index » type features (the cumulative index of your meter, in kWh, which only increases). Every 30 minutes, Gladys calculates the difference between successive index readings to determine the consumption for the period, then applies your rate.
« Power » type features are never used for this calculation; they are only used to display a curve.
Therefore, if the instantaneous power is sent in an « Index » or « Energy » type feature, Gladys calculates the difference between two powers and adds all positive variations. Example over a day:
0.3 → 1.2 → 0.4 → 2.1 → 0.5 …
Gladys counts +0.9, +1.7, etc. (drops are ignored, they are interpreted as a meter reset). You quickly get a total 3 to 5 times too large — which matches your 15.69 instead of 3.75.
Second detail: the unit kW is not an energy unit for Gladys (only Wh, kWh, and MWh are converted). A feature declared in kW is therefore taken as is as kWh at the time of cost calculation, which also distorts the rate.
Can you confirm?
In your device, what is the exact type of the feature fed by Node-RED (« Index », « Energy » or « Power ») and what unit is selected? A screenshot of the device in Gladys would help validate my hypothesis.
How to fix it
Ideal solution: send Gladys the cumulative index of your meter in kWh (the total that only increases, not the power), in an « Index » type feature with the unit kWh. There, a transmission every 15 minutes is perfectly sufficient, and the calculation will be accurate.
If your reading only gives you the instantaneous power: you need to build the index yourself in Node-RED by integrating the power over time. A function node before sending to Gladys:
const now = Date.now();
const powerKw = Number(msg.payload); // instantaneous power in kW
const last = context.get('last');
if (!last) {
context.set('last', { t: now, power: powerKw, index: 0 });
return null; // waiting for the 2nd reading
}
const deltaHours = (now - last.t) / 3600000;
const index = last.index + last.power * deltaHours; // cumulative kWh
context.set('last', { t: now, power: powerKw, index });
msg.payload = Number(index.toFixed(4));
return msg;
Two precautions:
- use a persistent context (file storage in Node-RED), otherwise the index resets to zero on each restart;
- with a reading every 15 minutes, we assume that the power remained constant throughout the interval: this is very approximate. If you go through this method, sample rather every minute (or 10-30 s), the precision will be much better. That’s also why the meter index remains the best source.
Once the correction is made
- Delete the erroneous history of the concerned feature (or create a clean feature);
- Go to Energy Tracking → Settings and launch « Recalculate Consumption », then « Calculate Cost from the Beginning ». You can follow the progress in the background tasks.
Let me know what the type and unit of your feature are, we’ll refine if needed!