Page 1 of 1

Graaddagen with kWh

Posted: Wednesday 12 December 2018 20:45
by Derik
Dear all [ perhaps more Dutchies ]
I use a Heatpump
Now i did use a CV unit, and i did monitor my gas with www.mindergas.nl so i can use Graaddagen https://www.mindergas.nl/degree_days_ca ... xplanation The only good way to monitor your gas usage...

Only now i have a problem.
All my Old data i cannot use any more ..
Because my heatpump use 220 volts in stead of gas.

So i found a DZ vents script that is using a formula for gas to see how many gas i use per graaddag.

Code: Select all

         return {
              on   = { timer    = { "every minute"}},--at 23:55
              
      execute = function(domoticz)
            local Date = domoticz.time.year..domoticz.time.month..domoticz.time.day
            local meantempOutside = domoticz.devices('D.M.: Gemiddeld Buiten D').temperature
            local baseTemp = 18
            local factor = 1
            local degreesdays = baseTemp - meantempOutside
            if (domoticz.time.month >= 4 and domoticz.time.month <= 9) then factor = 0.8 end
            if (domoticz.time.month >= 11 or domoticz.time.month <= 2) then factor = 1.1 end
            degreesdays = degreesday * factor
            local GasUsage = domoticz.devices('Z: WP Tot').counterToday
            local GasUsageperDegreesday = domoticz.round((GasUsage * 2 / degreesdays ),3)
            if (degreesday <= 0) then 
                degreesdays = 0 
                GasUsageperDegreesday = 0
            end
            domoticz.log('Gemiddelde temperatuur buiten (laatste 24u): '..meantempOutside)
            domoticz.log('Stroom verbuik WP vandaag: '..GasUsage..' m3')
            domoticz.log('Aantal graaddagen: '..degreesdays)
            domoticz.log('WP verbruik: '..GasUsageperDegreesday..' Kwh per graaddag')
            
            domoticz.devices('D.M.: kWh/Graaddag').updateCustomSensor(GasUsageperDegreesday)
      end
}

Where i use in the GAS counter my Zwave kWh counter [ my heatpump usage ]

Code: Select all

            local GasUsage = domoticz.devices('Z: WP Tot').counterToday
And i need 2 kWh power for 1M³ Gas.. so i give in this part a * 2

Code: Select all

            local GasUsageperDegreesday = domoticz.round((GasUsage * 2 / degreesdays ),3)
For testing i use this option evry 5 minute, only when it is working i run this script once a day 23.55


I am looking for some other options..
What i hope some can script is a dummy where i can see the "graaddagen " and they are counting for days months and years..

Other option should be very great...
The "gas" [ calculatie with my powerusage ] usage uploading to mindergas.nl so i can compare my Old gas usage with the new "Dummy Gas" :-)

I did use with my gas meter this script for uploding to mindergas.

Code: Select all

#!/bin/bash
 
 #Token to authenicate with mindergas.nl
 TOKEN=6yxgQygWUZ4jWL3hZr [ changed token ]
 
 #fetch meterstand (use jq to parse JSON object correctly)
 METERSTAND=`curl -s "http://192.168.5.70:8080/json.htm?type=devices&rid=3186"  | jq '.result[0].Counter'| tr -d '"'`
 
 #Get OS date, and format it corectly.
 NOW=$(date +"%Y-%m-%d")
 
 #Build JSON by hand ;-)
 JSON='{ "date":"'$NOW'", "reading":"'$METERSTAND'"  }'
 
 #post using curl to API
 curl -v -H "Content-Type:application/json" -H "AUTH-TOKEN:$TOKEN" -d "$JSON"  https://www.mindergas.nl/api/gas_meter_readings
So i hope some will help me with this script...
I cannot script..unfortunately
So my your help will be great for my!!!

Re: Graaddagen with kWh

Posted: Thursday 13 December 2018 0:03
by HFman
Let's not start if this is the "only" good way.. (let's say i disagree :) , and it is strongly depending on what you need).

And.. where is the 2 * comming from ? (2 x kwh = 1 m3 gas) ?
Sounds like COP * 2 kwh = 1 m3 gas ?

Reading all you would like :

1) to upload to mindergas.nl with : kwh x 2 = m3 gas
2) have a sensor in domoticz showing graaddagen


I didn't run it yet but this (dzvent script) should give you what you need for your gas sensor:

Code: Select all

return {
 
   --on   = { timer    = { "at 23:58"}},
  
    execute = function(dz)
	
        local WarmtepompKWH  = dz.devices('Stroom').counterToday   
         dz.log(WarmtepompKWH)
		local WP_gas = dz.devices('WP_Gas')
		local usage = WarmtepompKWH * 2000
		dz.log(usage)
        WP_gas.updateGas(usage)
        
    end
}
I called your power meter for the HeatPump : WP_stroom and the "new" gas meter WP_Gas.
In this way you can use your old script again to upload the mindergas.nl

But.. it is a not so 'eerlijke' way of comparing.
The COP of the heatpump is only 5 at 7°C...

Re: Graaddagen with kWh

Posted: Thursday 13 December 2018 6:25
by Derik
Dear Hfman
Thanks for your help..
Only i get an error when i runn the script:

Code: Select all

return {
 
   on   = { timer    = { "at 06:20"}},

                                                               
    execute = function(dz)
     
        local WarmtepompKWH  = dz.devices('Z: WP Tot').counterToday        
        local WP_Gas  = WarmtepompKWH * 2
        WP_Gas.updateGas(usage)
        
    end
}
2018-12-13 06:20:00.432 Status: dzVents: Error (2.4.9): ...pts/dzVents/generated_scripts/DZ: WP Stroom naar Gas.lua:10: attempt to index local 'WP_Gas' (a number value)

And is it possible to make a Graaddagen dummy device.
From the first script.

The reason why in use 2kwh for 1M³ is because this a formula in the tweakers forum that is calculate with a year COP.
And 2Kwh to 1 is a calculation that is used by everyone on the forum.. So you can be sure this is realistic value

https://gathering.tweakers.net/forum/li ... /1850059/0

Re: Graaddagen with kWh

Posted: Thursday 13 December 2018 21:03
by HFman
Yes you are right.. it was to late yesterday evening... i copied my first edit version...

I updated the code and tested it.. it works.
They year COP (sCOP) of 5.. ok.
I know the tweakers post, also wrote serveral times there.

I hope you can manage a sCOP of 5.. this is quite high.
Unless you have LTV (everything below 35°C) than it would be maybe achievable.

Re: Graaddagen with kWh

Posted: Thursday 13 December 2018 23:08
by Derik
Dear..
Some { etc are strange in your new script..
I edit some thing..
This one is working ...:-)

Thanks

Code: Select all

 return {
    on   = { timer    = { "every 3 minutes"}}, --at 21:52  every minute
  
    execute = function(dz)
	
        local WarmtepompKWH  = dz.devices('Z: WP Tot').counterToday   
         dz.log(WarmtepompKWH)
		local WP_gas = dz.devices('WP_Gas')
		local usage = WarmtepompKWH * 500
		dz.log(usage)
        WP_gas.updateGas(usage)
        
    end
}

Other question...
Is it possible to use a simple lua script into DZ vents?
I hope i can use the upload script also in dzevents.. Because this realy simple to use.
Now i need to set a crontab and a extern script
look better to me when i can use the intern editor from domoticz..
So is there a conversion tool or something?


Could you please take a look @ the graaddagen code.
Is there perhaps for you a option to "get" the calculated graaddagen out of the code to a dummy sensor..?
So i can see everyday how many graaddagen there where @ that day..


xxxx