Compare gas/electricity usage with certain limits per day/week

Dashticz, alternative dashboard based on HTML, CSS, jQuery

Moderators: leecollings, htilburgs, robgeerts

Post Reply
Chris12
Posts: 238
Joined: Tuesday 18 August 2020 8:41
Target OS: NAS (Synology & others)
Domoticz version: 2021.1
Location: NL
Contact:

Compare gas/electricity usage with certain limits per day/week

Post by Chris12 »

Hi,

I have in dashticz both my gas and electricity usage monitored and displayed in some nice graphs.
But I want to compare the daily/weekly/montly usage with some certain determined values set by the government to get price discounts on those.
So the other members of my household can actually see how much is used (or spilled) per day/week.

I need to get these values (from page 22 and onwards) to get compared with the actual usage:
Image

https://www.rijksoverheid.nl/binaries/r ... uikers.pdf

How can I get these values in dashticz to be used in a graph? Can I read a text/excel file or something?
I did not find another source with the info of above which can be read using a script to get the data.
Domoticz beta | Dashticz beta | Synology DS415+ | Wall tablet Teclast 11.6inch (Android) | TADO v3 controlled heating
mlinzner2
Posts: 4
Joined: Thursday 05 January 2023 8:59
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Compare gas/electricity usage with certain limits per day/week

Post by mlinzner2 »

You could solve that with one or more custom functions, similar to what I was asking for here: viewtopic.php?t=39690

The list you can either read from disk (just save it as csv or json next to your custom.js file). Since the data will not change for the entire year, I would probably just keep it as a hardcoded list inside the custom function and not read it from disk every time.
Chris12
Posts: 238
Joined: Tuesday 18 August 2020 8:41
Target OS: NAS (Synology & others)
Domoticz version: 2021.1
Location: NL
Contact:

Re: Compare gas/electricity usage with certain limits per day/week

Post by Chris12 »

Looks like that's way beyond my level of skill to create such custom.js code
I have zero programming knowledge.
Domoticz beta | Dashticz beta | Synology DS415+ | Wall tablet Teclast 11.6inch (Android) | TADO v3 controlled heating
willemd
Posts: 642
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: Compare gas/electricity usage with certain limits per day/week

Post by willemd »

Aside from the technical aspects, I would not hold my family members accountable for energy usage within these limits on a daily basis. These are purely theoretical limits derived from average usage for an average family with an average temperature.

For most families, gas usage is mainly determined by heating requirements. Cooking and hot water is just a small part of the gas usage. So, as an example, on a cold day, when temperatures are below long term averages, you daily usage will most certainly be higher than the theoretical table value, no matter how long the shower time is.

If you want to create a more realistic value out if it, you should take the actual measured average temperature and use that as a correction factor to the table value, similar to the concept of degreedays. You probably could indeed use degreedays directly as a correction factor (have a look at mindergas.nl or calculate it in domoticz). Even then I would work with averages (running averages) before being to harsh on the family members ;-)

Below is my code for degreeday calculation in domoticz. Note it takes as input some values from other scripts: it takes the gas used for heating from a gas classification usage script, and it takes sum of temperatures and number of temperature measurements to calculate an average temperature from a temperature tracking script.

Code: Select all

return {
	on = {
		timer = { 'at 23:53' }
	},
	logging = {
		level = domoticz.LOG_INFO,
		marker = 'degree day calc',
	},
	execute = function(domoticz)
		-- idx numbers need to be adjusted for new installation
		-- idx of devices	    
		
		local idxSumDayTemp=37
		local idxNumDayTemp=38
		local idxAvgDayTemp=40
	
		local idxGasP1=2
		local idxDegreesBelow18Counter=96
		local idxDegreeDaysCounter=97
		
		local idxRealHeatingGas=87 -- from gas classification script
		local idxRealGasPerDegreeDay=90
		
		local sumTemp= domoticz.devices(idxSumDayTemp).sensorValue
		local numTemp= domoticz.devices(idxNumDayTemp).sensorValue
		
		local avgTemp=domoticz.utils.round(sumTemp/numTemp,1)
		local DegreesBelow18=0 
		local DegreeDay=0
		local GasPerDegreeDay=0
		
		if avgTemp < 18 then
		    print ('below 18')
		    DegreesBelow18 = 18 - avgTemp
    		month = os.date("%m")
            local degreeday_weight = 0
            if month == "01" then degreeday_weight = 1.1 end
            if month == "02" then degreeday_weight = 1.1 end
            if month == "03" then degreeday_weight = 1.0 end
            if month == "04" then degreeday_weight = 0.8 end
            if month == "05" then degreeday_weight = 0.8 end
            if month == "06" then degreeday_weight = 0.8 end
            if month == "07" then degreeday_weight = 0.8 end
            if month == "08" then degreeday_weight = 0.8 end
            if month == "09" then degreeday_weight = 0.8 end
            if month == "10" then degreeday_weight = 1.0 end
            if month == "11" then degreeday_weight = 1.1 end
            if month == "12" then degreeday_weight = 1.1 end
            DegreeDay = domoticz.utils.round(DegreesBelow18 * degreeday_weight,1)
    
        end  
        
     	domoticz.devices(idxAvgDayTemp).updateTemperature(avgTemp)
		domoticz.devices(idxSumDayTemp).updateCustomSensor(0)
		domoticz.devices(idxNumDayTemp).updateCustomSensor(0)
		
		-- degreeday with heating gas from gas classification script
		local previousCounter=0 
		local divider=10
		previousCounter=domoticz.devices(idxDegreesBelow18Counter).counter
		domoticz.devices(idxDegreesBelow18Counter).updateCounter(DegreesBelow18*divider + previousCounter*divider)
		
		previousCounter=domoticz.devices(idxDegreeDaysCounter).counter
		domoticz.devices(idxDegreeDaysCounter).updateCounter(DegreeDay*divider + previousCounter*divider)
		domoticz.log('DegreesBelow18 = ' .. DegreesBelow18 .. ' ', domoticz.LOG_INFO)
		domoticz.log('DegreeDays = ' .. DegreeDay .. ' ', domoticz.LOG_INFO)
		domoticz.log('DegreesBelow18Counter = ' .. DegreesBelow18*divider + previousCounter*divider .. ' ', domoticz.LOG_INFO)
		domoticz.log('DegreeDaysCounter = ' .. DegreeDay*divider + previousCounter*divider .. ' ', domoticz.LOG_INFO)
		
		local RealHeatingGas=domoticz.devices(idxRealHeatingGas).counterToday
		local RealGasPerDegreeDay=domoticz.utils.round(RealHeatingGas/DegreeDay,3)
		previousGCounter=domoticz.devices(idxRealGasPerDegreeDay).counter
		domoticz.log('RealHeatingGas = ' .. RealHeatingGas .. ' ', domoticz.LOG_INFO)
		domoticz.log('RealGasPerDegreeDay = ' .. RealGasPerDegreeDay .. ' ', domoticz.LOG_INFO)
		domoticz.log('previousGCounter = ' .. previousGCounter .. ' ', domoticz.LOG_INFO)
		domoticz.devices(idxRealGasPerDegreeDay).updateCounter(RealGasPerDegreeDay*1000+previousGCounter*1000)
		
	
	end
}
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest