Page 2 of 2

Re: Real power consumption

Posted: Monday 31 August 2020 11:50
by erikvers
olivierf wrote: Saturday 04 March 2017 21:28 I was wondering what my actual power consumption was, which was sort of hard to see when my solar panels were generating power (oke not so very difficult but it was tricky to see in the log).

I created a dummy device (measuring watts) and created this LUA script to calculate it.
I don't expect it to be very accurate especially since the power generated by the panels is only updated every 5 minutes or so (solaredge API).

Maybe its useful to someone else :geek:

Code: Select all

    if (devicechanged['Power'] ~= meter) then
        meter = devicechanged['Power']
        --P1 meter uitsplitsen
        power1, power2, power3, power4, power5, power6 = devicechanged['Power']:match("([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+)")
        --Zonnepanelen uitsplitsen
        paneelpower = otherdevices_svalues['Zonnepanelen']:match("([^;]+);([^;]+)")
        --Echte verbruik berekenen: verbruik - teruglevering + panelen opbrengst
        stroomverbruik = power5 - power6 + paneelpower
        --En in een dummy device gooien met idx 85
        commandArray[1] = {['UpdateDevice'] = '85|0|' .. stroomverbruik}
    end
 
I was wondering why power5 - power6? When i am correct is that delivery on fase 2 en fase 3?
I am not a expert in LUA scripting so i hope her to learn how to do it

Can you tell me wich part of your code i must change? I belive de idx of the dumy and the name of 'zonnepanelen'