Power consumption - Subtract different update interval

Hi, I’ve the following scenario:

  • Shelly PM2-pro (shelly integration):
    • Channel 1 = Total grid consumption
    • Channel 2 = Total outlets consumption
  • Tuya based Smart Plugs (for appliances) - ( make-all/tuya-local custom integration):
    • Forno (aka oven)
    • Lavatrice (aka washing-machine)
    • Lavastoviglie (aka dishwasher)
    • Frigorifeo (aka refrigerator)

I’ve created a template (Outlets Net Power) that subtract from Channel 2 the consumption of the applliances. Everything is working, but I’ve a weird behaviour. After many adjustment on update interval on tuya devices, i’ve reached the stable configuration on about 5 seconds update.
As you can see from the screens the Net consumption goes to a negative value. Unfortunately this beahviour seem to be generated by an asyncronous update of the plugs compared to the shelly devices.

Polling shift Detail

(In the second image the orange line is the smart plug)

Has someone encountered a similar issue?
Have someone an idea on how to solve it?

It’s not a great problem but i’d like to use the net consumption to calculate the energy, and this behaviour can mak the calculation not correct.

Thank you

Just a push up.
No one have a clue?

That is a classic data collect synchronization (or lack of) problem.

Let’s start at the end result you are trying to get to and see if there is an approach that can be used without having to try to sync the data. For example, if you are trying to calculate hourly or daily usage and creating charts to show where the power is being used?

Basically I’d like to have a daily usage, but I was hoping to have a real-time measurements. Maybe an hourly rate will be good enough.

Really no clue?

Last +1
I’m struggling with this issue