Same outcome of monthly and yearly energy usage scripts  [Solved]

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
User avatar
MadMedic
Posts: 31
Joined: Wednesday 26 October 2016 14:06
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Huizen, the Netherlands
Contact:

Same outcome of monthly and yearly energy usage scripts  [Solved]

Post by MadMedic »

I have two DZ vents scripts :
monthly energy usage and yearly energy usage
Both give me the same outcomes
Device IDX's are correct

Who has a minute or two to look these over with me ?

the monthly script:

Code: Select all

local httpResponses = "energyMonthTotal"

return {
    on      =   {   
                    timer           =   { "every 15 minutes" },
                    httpResponses   =   { httpResponses .. "*" } 
                },

    logging =   {   
                    level           =   domoticz.LOG_DEBUG, -- set to LOG_ERROR when script works as expected
                    marker          =   httpResponses   
                },
                
    execute = function(dz, item)
        -- ****************************** Your settings below this line ***************************************************
        usageDevice = dz.devices(69)          -- Replace xxxx with ID of energyDevice you want to track
        monthTotal = dz.devices(133)        -- Create as virtual managed counter (energy) and change yyyy to the ID of the new device
        -- ****************************** No changes required below this line *********************************************
        
        local function logWrite(str,level)
            dz.log(tostring(str),level or dz.LOG_DEBUG)
        end
        
        local function triggerJSON(id, period, delay)
            local delay = delay or 0
            local  URLString   =    dz.settings['Domoticz url'] .. "/json.htm?type=graph&sensor=counter&range=" .. 
                                    period .. "&idx=" .. id 
            dz.openURL({    url = URLString,
                            method = "GET",
                            callback = httpResponses .. "_" .. period}).afterSec(delay)                      
        end
        
        local function calculateMonthTotal(rt)
            local monthTotal = 0
            local currentMonth = dz.time.rawDate:sub(1,7)
            for id, result in  ipairs(rt) do 
                if rt[id].d:sub(1,7) == currentMonth then
                    logWrite(rt[id].d .. " ==>> " .. rt[id].v)
                    monthTotal = monthTotal + rt[id].v
                end
            end
            return monthTotal * 1000
        end    
        
        if not item.isHTTPResponse then
            triggerJSON(usageDevice.id, "month")
        elseif item.ok then                                      -- statusCode == 2xx
            monthTotal.update(0,calculateMonthTotal(item.json.result))
        else
            logWrite("Could not get (good) data from domoticz. Error (" .. (item.statusCode or 999) .. ")"  ,dz.LOG_ERROR)
            logWrite(item.data)
        end
    end
}
and the yearly script, which I altered by replacing each word month to year (perhaps the mistake lies here )

Code: Select all

local httpResponses = "energyYearTotal"

return {
    on      =   {   
                    timer           =   { "every 15 minutes" },
                    httpResponses   =   { httpResponses .. "*" } 
                },

    logging =   {   
                    level           =   domoticz.LOG_DEBUG, -- set to LOG_ERROR when script works as expected
                    marker          =   httpResponses   
                },
                
    execute = function(dz, item)
        -- ****************************** Your settings below this line ***************************************************
        usageDevice = dz.devices(69)          -- Replace xxxx with ID of energyDevice you want to track
        yearTotal = dz.devices(134)        -- Create as virtual managed counter (energy) and change yyyy to the ID of the new device
        -- ****************************** No changes required below this line *********************************************
        
        local function logWrite(str,level)
            dz.log(tostring(str),level or dz.LOG_DEBUG)
        end
        
        local function triggerJSON(id, period, delay)
            local delay = delay or 0
            local  URLString   =    dz.settings['Domoticz url'] .. "/json.htm?type=graph&sensor=counter&range=" .. 
                                    period .. "&idx=" .. id 
            dz.openURL({    url = URLString,
                            method = "GET",
                            callback = httpResponses .. "_" .. period}).afterSec(delay)                      
        end
        
        local function calculateYearTotal(rt)
            local yearTotal = 0
            local currentYear = dz.time.rawDate:sub(1,7)
            for id, result in  ipairs(rt) do 
                if rt[id].d:sub(1,7) == currentYear then
                    logWrite(rt[id].d .. " ==>> " .. rt[id].v)
                    yearTotal = yearTotal + rt[id].v
                end
            end
            return yearTotal * 1000
        end    
        
        if not item.isHTTPResponse then
            triggerJSON(usageDevice.id, "year")
        elseif item.ok then                                      -- statusCode == 2xx
            yearTotal.update(0,calculateYearTotal(item.json.result))
        else
            logWrite("Could not get (good) data from domoticz. Error (" .. (item.statusCode or 999) .. ")"  ,dz.LOG_ERROR)
            logWrite(item.data)
        end
    end
}
And these are the debuglogs of both scripts:
Spoiler: show
2020-06-20 16:00:00.412 Status: dzVents: Info: energyYearTotal: ------ Start internal script: Electra jaarverbruik totaal:, trigger: "every 15 minutes"
2020-06-20 16:00:00.431 Status: dzVents: Debug: energyYearTotal: Processing device-adapter for Electra: P1 smart meter energy device adapter
2020-06-20 16:00:00.433 Status: dzVents: Debug: energyYearTotal: Processing device-adapter for Electra jaarverbruik: Counter device adapter
2020-06-20 16:00:00.433 Status: dzVents: Debug: energyYearTotal: OpenURL: url = http://127.0.0.1:8080/json.htm?type=gra ... ear&idx=69
2020-06-20 16:00:00.433 Status: dzVents: Debug: energyYearTotal: OpenURL: method = GET
2020-06-20 16:00:00.433 Status: dzVents: Debug: energyYearTotal: OpenURL: post data = nil
2020-06-20 16:00:00.433 Status: dzVents: Debug: energyYearTotal: OpenURL: headers = nil
2020-06-20 16:00:00.433 Status: dzVents: Debug: energyYearTotal: OpenURL: callback = energyYearTotal_year
2020-06-20 16:00:00.433 Status: dzVents: Info: energyYearTotal: ------ Finished Electra jaarverbruik totaal

2020-06-20 16:00:02.736 Status: dzVents: Info: Handling httpResponse-events for: "energyYearTotal_year"
2020-06-20 16:00:02.737 Status: dzVents: Info: energyYearTotal: ------ Start internal script: Electra jaarverbruik totaal: HTTPResponse: "energyYearTotal_year"
2020-06-20 16:00:02.758 Status: dzVents: Debug: energyYearTotal: Processing device-adapter for Electra: P1 smart meter energy device adapter
2020-06-20 16:00:02.760 Status: dzVents: Debug: energyYearTotal: Processing device-adapter for Electra jaarverbruik: Counter device adapter
2020-06-20 16:00:02.760 Status: dzVents: Debug: energyYearTotal: 2020-06-13 ==>> 9.881
2020-06-20 16:00:02.760 Status: dzVents: Debug: energyYearTotal: 2020-06-14 ==>> 8.330
2020-06-20 16:00:02.760 Status: dzVents: Debug: energyYearTotal: 2020-06-15 ==>> 2.175
2020-06-20 16:00:02.760 Status: dzVents: Debug: energyYearTotal: 2020-06-16 ==>> 2.577
2020-06-20 16:00:02.760 Status: dzVents: Debug: energyYearTotal: 2020-06-17 ==>> 2.613
2020-06-20 16:00:02.760 Status: dzVents: Debug: energyYearTotal: 2020-06-18 ==>> 2.150
2020-06-20 16:00:02.760 Status: dzVents: Debug: energyYearTotal: 2020-06-19 ==>> 1.697
2020-06-20 16:00:02.760 Status: dzVents: Debug: energyYearTotal: 2020-06-20 ==>> 4.205
2020-06-20 16:00:02.760 Status: dzVents: Info: energyYearTotal: ------ Finished Electra jaarverbruik totaal


2020-06-20 16:00:00.433 Status: dzVents: Info: energyMonthTotal: ------ Start internal script: Electra maandverbruik totaal:, trigger: "every 15 minutes"
2020-06-20 16:00:00.434 Status: dzVents: Debug: energyMonthTotal: Processing device-adapter for Electra maandverbruik: Counter device adapter
2020-06-20 16:00:00.434 Status: dzVents: Debug: energyMonthTotal: OpenURL: url = http://127.0.0.1:8080/json.htm?type=gra ... nth&idx=69
2020-06-20 16:00:00.435 Status: dzVents: Debug: energyMonthTotal: OpenURL: method = GET
2020-06-20 16:00:00.435 Status: dzVents: Debug: energyMonthTotal: OpenURL: post data = nil
2020-06-20 16:00:00.435 Status: dzVents: Debug: energyMonthTotal: OpenURL: headers = nil
2020-06-20 16:00:00.435 Status: dzVents: Debug: energyMonthTotal: OpenURL: callback = energyMonthTotal_month

2020-06-20 16:00:02.761 Status: dzVents: Info: Handling httpResponse-events for: "energyMonthTotal_month"
2020-06-20 16:00:02.761 Status: dzVents: Info: energyMonthTotal: ------ Start internal script: Electra maandverbruik totaal: HTTPResponse: "energyMonthTotal_month"
2020-06-20 16:00:02.765 Status: dzVents: Debug: energyMonthTotal: Processing device-adapter for Electra maandverbruik: Counter device adapter
2020-06-20 16:00:02.765 Status: dzVents: Debug: energyMonthTotal: 2020-06-13 ==>> 9.881
2020-06-20 16:00:02.765 Status: dzVents: Debug: energyMonthTotal: 2020-06-14 ==>> 8.330
2020-06-20 16:00:02.765 Status: dzVents: Debug: energyMonthTotal: 2020-06-15 ==>> 2.175
2020-06-20 16:00:02.765 Status: dzVents: Debug: energyMonthTotal: 2020-06-16 ==>> 2.577
2020-06-20 16:00:02.765 Status: dzVents: Debug: energyMonthTotal: 2020-06-17 ==>> 2.613
2020-06-20 16:00:02.765 Status: dzVents: Debug: energyMonthTotal: 2020-06-18 ==>> 2.150
2020-06-20 16:00:02.765 Status: dzVents: Debug: energyMonthTotal: 2020-06-19 ==>> 1.697
2020-06-20 16:00:02.765 Status: dzVents: Debug: energyMonthTotal: 2020-06-20 ==>> 4.205
2020-06-20 16:00:02.765 Status: dzVents: Info: energyMonthTotal: ------ Finished Electra maandverbruik totaal
As you can read from the logs: both outcomes are the same although the ranges are different ?
And they don't give me the correct monthly values too
energy.png
energy.png (13.48 KiB) Viewed 1484 times
I'm lost here.. who has the definitive answer ... Waaren ? ;-)
.
"Life is too short for bad coffee"
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Same outcome of monthly and yearly energy usage scripts

Post by waaren »

MadMedic wrote: Saturday 20 June 2020 16:28 I have two DZ vents scripts :
Your year script use the same substring to compare with

Code: Select all

 local currentyear = dz.time.rawDate:sub(1,7)
 if rt[id].d:sub(1,7) == currentyear then
 
You should ony look at the year part of the datestrings

Code: Select all

 local currentyear = dz.time.rawDate:sub(1,4)
 if rt[id].d:sub(1,4) == currentyear then
Can you also post a screenshot from device 69 ? If this device is a two tariff smartmeter you should also look at rt[id].v2 (low tariff) to get the right results.


For year

Code: Select all

        local function calculateYearTotal(rt)
            local yearTotal = 0
            local currentyear = dz.time.rawDate:sub(1,4)
            for id, result in  ipairs(rt) do
                if rt[id].d:sub(1,4) == currentyear then
                    dz.log(rt[id].d .. " ==>> " .. rt[id].v .. ' + ' .. rt[id].v2 .. ' = ' .. ( rt[id].v + rt[id].v2 ) ,dz.LOG_DEBUG)
                    yearTotal = yearTotal + rt[id].v + rt[id].v2
                end
            end
            return yearTotal * 1000
        end
for month

Code: Select all

        local function calculateMonthTotal(rt)
            local monthTotal = 0
            local currentMonth = dz.time.rawDate:sub(1,7)
            for id, result in  ipairs(rt) do
                if rt[id].d:sub(1,7) == currentMonth then
                        dz.log(rt[id].d .. " ==>> " .. rt[id].v .. ' + ' .. rt[id].v2 .. ' = ' .. ( rt[id].v + rt[id].v2 ) ,dz.LOG_DEBUG)
                    monthTotal = monthTotal + rt[id].v + rt[id].v2
                end
            end
            return monthTotal * 1000
        end
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
MadMedic
Posts: 31
Joined: Wednesday 26 October 2016 14:06
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Huizen, the Netherlands
Contact:

Re: Same outcome of monthly and yearly energy usage scripts

Post by MadMedic »

waaren wrote: Saturday 20 June 2020 17:09 Can you also post a screenshot from device 69 ? If this device is a two tariff smartmeter you should also look at rt[id].v2 (low tariff) to get the right results.
</quote>

it is, just the P1 energy sensor, both low and high tarif indeed
electra.png
electra.png (10.81 KiB) Viewed 1463 times
I'll get back to you and try to implement your suggestions.
Thanks in advance !
Last edited by MadMedic on Saturday 20 June 2020 22:04, edited 1 time in total.
.
"Life is too short for bad coffee"
User avatar
MadMedic
Posts: 31
Joined: Wednesday 26 October 2016 14:06
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Huizen, the Netherlands
Contact:

Re: Same outcome of monthly and yearly energy usage scripts

Post by MadMedic »

Edit: Never mind, got some code wrong.. back on track now ;-)
Last edited by MadMedic on Saturday 20 June 2020 22:33, edited 1 time in total.
.
"Life is too short for bad coffee"
User avatar
MadMedic
Posts: 31
Joined: Wednesday 26 October 2016 14:06
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Huizen, the Netherlands
Contact:

Re: Same outcome of monthly and yearly energy usage scripts

Post by MadMedic »

Ok code is back in order now... little mistake,
But even after I implemented your alterations correctly, the outcomes stay the same and far too high
Spoiler: show
energy2.png
energy2.png (13 KiB) Viewed 1461 times
Doing the debug feature now, see what that brings me...
Spoiler: show
2020-06-20 22:26:00.773 Status: dzVents: Info: Handling httpResponse-events for: "energyYearTotal_year"
2020-06-20 22:26:00.773 Status: dzVents: Info: energyYearTotal: ------ Start internal script: Electra jaarverbruik totaal: HTTPResponse: "energyYearTotal_year"
2020-06-20 22:26:00.793 Status: dzVents: Debug: energyYearTotal: Processing device-adapter for Electra: P1 smart meter energy device adapter
2020-06-20 22:26:00.795 Status: dzVents: Debug: energyYearTotal: Processing device-adapter for Electra jaarverbruik: Counter device adapter
2020-06-20 22:26:00.795 Status: dzVents: Debug: energyYearTotal: 2020-06-13 ==>> 9.881 + 0.000 = 9.881
2020-06-20 22:26:00.795 Status: dzVents: Debug: energyYearTotal: 2020-06-14 ==>> 8.330 + 0.000 = 8.33
2020-06-20 22:26:00.795 Status: dzVents: Debug: energyYearTotal: 2020-06-15 ==>> 2.175 + 5.836 = 8.011
2020-06-20 22:26:00.795 Status: dzVents: Debug: energyYearTotal: 2020-06-16 ==>> 2.577 + 6.070 = 8.647
2020-06-20 22:26:00.795 Status: dzVents: Debug: energyYearTotal: 2020-06-17 ==>> 2.613 + 7.843 = 10.456
2020-06-20 22:26:00.795 Status: dzVents: Debug: energyYearTotal: 2020-06-18 ==>> 2.150 + 9.293 = 11.443
2020-06-20 22:26:00.795 Status: dzVents: Debug: energyYearTotal: 2020-06-19 ==>> 1.697 + 6.738 = 8.435
2020-06-20 22:26:00.795 Status: dzVents: Debug: energyYearTotal: 2020-06-20 ==>> 6.549 + 0.000 = 6.549
2020-06-20 22:26:00.795 Status: dzVents: Info: energyYearTotal: ------ Finished Electra jaarverbruik totaal

2020-06-20 22:26:00.795 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua

2020-06-20 22:26:00.882 Status: dzVents: Info: Handling httpResponse-events for: "energyMonthTotal_month"
2020-06-20 22:26:00.882 Status: dzVents: Info: energyMonthTotal: ------ Start internal script: Electra maandverbruik totaal: HTTPResponse: "energyMonthTotal_month"
2020-06-20 22:26:00.903 Status: dzVents: Debug: energyMonthTotal: Processing device-adapter for Electra: P1 smart meter energy device adapter
2020-06-20 22:26:00.904 Status: dzVents: Debug: energyMonthTotal: Processing device-adapter for Electra maandverbruik: Counter device adapter
2020-06-20 22:26:00.904 Status: dzVents: Debug: energyMonthTotal: 2020-06-13 ==>> 9.881 + 0.000 = 9.881
2020-06-20 22:26:00.904 Status: dzVents: Debug: energyMonthTotal: 2020-06-14 ==>> 8.330 + 0.000 = 8.33
2020-06-20 22:26:00.904 Status: dzVents: Debug: energyMonthTotal: 2020-06-15 ==>> 2.175 + 5.836 = 8.011
2020-06-20 22:26:00.904 Status: dzVents: Debug: energyMonthTotal: 2020-06-16 ==>> 2.577 + 6.070 = 8.647
2020-06-20 22:26:00.904 Status: dzVents: Debug: energyMonthTotal: 2020-06-17 ==>> 2.613 + 7.843 = 10.456
2020-06-20 22:26:00.904 Status: dzVents: Debug: energyMonthTotal: 2020-06-18 ==>> 2.150 + 9.293 = 11.443
2020-06-20 22:26:00.904 Status: dzVents: Debug: energyMonthTotal: 2020-06-19 ==>> 1.697 + 6.738 = 8.435
2020-06-20 22:26:00.904 Status: dzVents: Debug: energyMonthTotal: 2020-06-20 ==>> 6.549 + 0.000 = 6.549
2020-06-20 22:26:00.905 Status: dzVents: Info: energyMonthTotal: ------ Finished Electra maandverbruik totaal
Still is giving me the same results ..hmmm
But looking in the debug log, I can see that we've at least made some progress.
It now shows high and low tarifs, just both from the same source appearantly
.
"Life is too short for bad coffee"
User avatar
MadMedic
Posts: 31
Joined: Wednesday 26 October 2016 14:06
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Huizen, the Netherlands
Contact:

Re: Same outcome of monthly and yearly energy usage scripts

Post by MadMedic »

OK, I think I've got it ! (partly)

looking at the graph data I noticed that year energy is not v and v2
but C1 and C3
Spoiler: show
{
"ValueQuantity" : "",
"ValueUnits" : "",
"result" :
[
{
"c1" : "8056.809",
"c2" : "0",
"c3" : "7500.767",
"c4" : "0",
"d" : "2020-06-13",
"r1" : "0.000",
"r2" : "0.000",
"v" : "9.881",
"v2" : "0.000"
Guessing that C3 is low tariff, C1 high
Spoiler: show
energy3.png
energy3.png (14.56 KiB) Viewed 1459 times
ok, that seem to work: now I have to different counters.
Next step, get the right amounts of kWh

Debug log tells me that:
Spoiler: show
2020-06-20 22:43:00.504 Status: dzVents: Info: Handling httpResponse-events for: "energyYearTotal_year"
2020-06-20 22:43:00.504 Status: dzVents: Info: energyYearTotal: ------ Start internal script: Electra jaarverbruik totaal: HTTPResponse: "energyYearTotal_year"
2020-06-20 22:43:00.525 Status: dzVents: Debug: energyYearTotal: Processing device-adapter for Electra: P1 smart meter energy device adapter
2020-06-20 22:43:00.527 Status: dzVents: Debug: energyYearTotal: Processing device-adapter for Electra jaarverbruik: Counter device adapter
2020-06-20 22:43:00.527 Status: dzVents: Debug: energyYearTotal: 2020-06-13 ==>> 8056.809 + 7500.767 = 15557.576
2020-06-20 22:43:00.527 Status: dzVents: Debug: energyYearTotal: 2020-06-14 ==>> 8066.742 + 7500.767 = 15567.509
2020-06-20 22:43:00.527 Status: dzVents: Debug: energyYearTotal: 2020-06-15 ==>> 8075.099 + 7500.767 = 15575.866
2020-06-20 22:43:00.527 Status: dzVents: Debug: energyYearTotal: 2020-06-16 ==>> 8077.326 + 7506.603 = 15583.929
2020-06-20 22:43:00.527 Status: dzVents: Debug: energyYearTotal: 2020-06-17 ==>> 8079.948 + 7512.673 = 15592.621
2020-06-20 22:43:00.527 Status: dzVents: Debug: energyYearTotal: 2020-06-18 ==>> 8082.619 + 7520.516 = 15603.135
2020-06-20 22:43:00.527 Status: dzVents: Debug: energyYearTotal: 2020-06-19 ==>> 8084.798 + 7529.809 = 15614.607
2020-06-20 22:43:00.527 Status: dzVents: Debug: energyYearTotal: 2020-06-20 ==>> 8086.522 + 7536.547 = 15623.069
2020-06-20 22:43:00.527 Status: dzVents: Info: energyYearTotal: ------ Finished Electra jaarverbruik totaal
2020-06-20 22:43:00.528 Status: dzVents: Info: Handling httpResponse-events for: "energyMonthTotal_month"
2020-06-20 22:43:00.528 Status: dzVents: Info: energyMonthTotal: ------ Start internal script: Electra maandverbruik totaal: HTTPResponse: "energyMonthTotal_month"
2020-06-20 22:43:00.532 Status: dzVents: Debug: energyMonthTotal: Processing device-adapter for Electra maandverbruik: Counter device adapter
2020-06-20 22:43:00.532 Status: dzVents: Debug: energyMonthTotal: 2020-06-13 ==>> 9.881 + 0.000 = 9.881
2020-06-20 22:43:00.532 Status: dzVents: Debug: energyMonthTotal: 2020-06-14 ==>> 8.330 + 0.000 = 8.33
2020-06-20 22:43:00.532 Status: dzVents: Debug: energyMonthTotal: 2020-06-15 ==>> 2.175 + 5.836 = 8.011
2020-06-20 22:43:00.532 Status: dzVents: Debug: energyMonthTotal: 2020-06-16 ==>> 2.577 + 6.070 = 8.647
2020-06-20 22:43:00.532 Status: dzVents: Debug: energyMonthTotal: 2020-06-17 ==>> 2.613 + 7.843 = 10.456
2020-06-20 22:43:00.532 Status: dzVents: Debug: energyMonthTotal: 2020-06-18 ==>> 2.150 + 9.293 = 11.443
2020-06-20 22:43:00.532 Status: dzVents: Debug: energyMonthTotal: 2020-06-19 ==>> 1.697 + 6.738 = 8.435
2020-06-20 22:43:00.532 Status: dzVents: Debug: energyMonthTotal: 2020-06-20 ==>> 6.658 + 0.000 = 6.658
2020-06-20 22:43:00.533 Status: dzVents: Info: energyMonthTotal: ------ Finished Electra maandverbruik totaal
All year and month totals are getting added up. How to cope with that issue ?
Pfff, this is almost like working ;-)
.
"Life is too short for bad coffee"
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Same outcome of monthly and yearly energy usage scripts

Post by waaren »

MadMedic wrote: Saturday 20 June 2020 22:48 looking at the graph data I noticed that year energy is not v and v2
c values are total counters. You don't' want these, you really need v and v2. The devices are updated with kWh values.
All year and month totals are getting added up. How to cope with that issue ?
Because you only have history from the current month, the total for current month and current year are equal. Next month you will see a difference.
energy.png
energy.png (17.15 KiB) Viewed 1446 times
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
MadMedic
Posts: 31
Joined: Wednesday 26 October 2016 14:06
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Huizen, the Netherlands
Contact:

Re: Same outcome of monthly and yearly energy usage scripts

Post by MadMedic »

You made me smile... I got way too deep on this code. You make total sense.
Impulsiveness is my middle name, unfortunately ;-)

thnx, Waaren
.
"Life is too short for bad coffee"
User avatar
MadMedic
Posts: 31
Joined: Wednesday 26 October 2016 14:06
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Huizen, the Netherlands
Contact:

Re: Same outcome of monthly and yearly energy usage scripts

Post by MadMedic »

Ok, enough for today, altered the code back to v and v2.
Last question:

Any thoughts about the offset and divider on the managed counter button ?
Spoiler: show
energy4.png
energy4.png (19.72 KiB) Viewed 1443 times
Both 0 ?
.
"Life is too short for bad coffee"
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Same outcome of monthly and yearly energy usage scripts

Post by waaren »

MadMedic wrote: Saturday 20 June 2020 23:23 Any thoughts about the offset and divider on the managed counter button ?
Your setting is ok
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest