Smart Plugs like GNCC SP12 do have full energy consumption monitoring even though they don’t have a “total_forward_electricty” data point like the smartmeters have. The only datapoint they have is “add_ele” (add_electricity), which in fact provides the information how many Wh have been consumed since the arrival of the previous add_ele data point data packet. Usually such a packet arrives every 30 minutes.
In the Tuya Cloud the device log records every single arriving data packet in the last week, and this permits to filter the device log for all add_ele packets having arrived at the Tuya Cloud, sum all these values up and that way get your “total_forward_electricity” energy consumption, and this is very accurate even with fluctuating amperage and power.
So the formula is:
total_forward_electricity=sum of all transmitted add_ele packets
Now, Home Assistant does appear to NOT support this behaviour. It only depends on “change of the value” to trigger events, I can not find any trigger upon arrival of a packet for a specific device, specific data point within that device irrespective of its value. Yes, if the value changes, then it triggers indeed, but not, if add_ele instructs to add say 17Wh (0.017kWh) four times in a row or so, meaning in two hours it adds 0,068kWh (or if you like, add_ele reads 1000 four times in a row, meaning it adds 4kWh within 2 hours).
Requests therefore for both Home Assistand and Local-Tuya:
Permit energy monitoring to be fully supported (also see below).
Permit add_ele to be fully supported, so that whenever an add_ele packet arrives from whatever device, trigger (in general: upon arrival of a datapacket activate a trigger if so requested, regardless of whether the value has changed or not).
Permit a construct similiar to Tuya’s original device log logging every single data backet with its data points, and actually, make this default behaviour and accessible via REST API etc. of Home Assistant for every single device and datapoint just like the Tuya cloud. I am sure, that the value of add_ele, being a mystery for so many years and not being understood for years, would have been discovered very quickly with such a tool.
With the phase_a field in the smart meters, base64 encoded voltage, current and power fields, we have a similiar issue that Home Assistant and local-tuya don’t support this natively despite the generic nature of this field. It took me a whole day to finally find out how to implement this decoding and implement this (with the same problem as above, not all arriving packets trigger the update and decoding!)
Energy Monitoring by taking the power fields and multiple by time also don’t work reliably because repeated same values do get lost.
So overall, Home Assistant, other than the Tuya Cloud which does permit tracking of each single data packet arriving, does NOT support energy consumption monitoring unless a total_forward_electricity (or similiar) field is being provided by the device and its sensors.
And this is the reason for this urgent request so that the tracking (and summation) of each single packet, even if seemingly transmitting the same value over and over, becomes possible.
Thank you!