dz calculate time heating devices are on

For heating/cooling related questions in Domoticz

Moderator: leecollings

Post Reply
WimNL
Posts: 2
Joined: Tuesday 25 December 2018 12:12
Target OS: Linux
Domoticz version:
Contact:

dz calculate time heating devices are on

Post by WimNL »

Hello all,

I have 1 central heating and 4 rooms with there own floorheating and thermostat. I use a lua script per room to control the temperature. That is working perfect. Now I want to calculate how long the heating was per.room was on per month and what it was costing. I have also P1 for gas monitoring. In the log file i.can see how long a device was on, but I really don't know how to extract the time out of it. Spend already hours on reading and testing.... I know I have to create dummy devices, but that is not the problem...

The devices I'm using are:
P1 gas idx 306
vloerpomp voorhuis relais-2 204 idx 238
vloerpomp achterhuis relais-3 204 idx 239
vloerpomp zijschuur relais-4 204 idx 240
radiator app boven idx 312

I hope someone can help on the way💪
Last edited by WimNL on Thursday 03 December 2020 9:33, edited 1 time in total.
Debian buster on Intel NUC, Z-Wave, RFXtrx433e, P1, Marmitek, Yeelight, Xiaomi, EspEasy on several WemosD1 & Linknode & NodeMCU
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: dz calculate time heating devices are on

Post by waaren »

WimNL wrote: Thursday 03 December 2020 8:47 I have 1 central heating and 4 rooms with there own floorheating and thermostat. I use a lua script per room to control the temperature. That is working perfect. Now I want to calculate how long the heating was per.room was on per month and what it was costing. I have also P1 for gas monitoring. In the log file i.can see how long a device was on, but I really don't know how to extract the time out of it. Spend already hours on reading and testing....
Do you mean the cost per room (you would need to know how much gas is used per room) or the total cost of the gas usage from the P1 meter?
Can you share the Lua script you use now? Maybe your new requirement can be integrated if you code this functionality in a dzVents script.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
WimNL
Posts: 2
Joined: Tuesday 25 December 2018 12:12
Target OS: Linux
Domoticz version:
Contact:

Re: dz calculate time heating devices are on

Post by WimNL »

waaren wrote: Thursday 03 December 2020 8:59 Do you mean the cost per room (you would need to know how much gas is used per room) or the total cost of the gas usage from the P1 meter?
Can you share the Lua script you use now? Maybe your new requirement can be integrated if you code this functionality in a dzVents script.
I want to know the cost per room. It would be possible to install water meters, but that would cost a lot and than I have to change a lot of heating pipes. I thought: extract the gas usage from the P1 and split it by the time the rooms were using heat.
So that means something like this (I think): Gas / (vloerpomp voorhuis relais-2 204 idx 238 +
vloerpomp achterhuis relais-3 204 idx 239 + vloerpomp zijschuur relais-4 204 idx 240 + radiator app boven idx 312) = dummy 1
Dummy 2 = dummy 1 * vloerpomp voorhuis relais-2 204 idx 238 * gas cost > cost per month for room 'voorhuis'
Dummy 3 = dummy 1 * vloerpomp achterhuis relais-3 204 idx 239 * gas cost > cost per month for room 'achterhuis'
etc...
Or I do I make a mistake in the way I approach it??

Lua script voorhuis (the other rooms have the same scripts, but with there own names (idx) and files:

Code: Select all

-- Domoticz passes information to scripts through a number of global tables
--
-- https://www.iot4.eu/wiki

local heating_probe = 'voorhuis 203' 
local thermostat_setpoint = 'thermo voorhuis virtueel'
local heating_unit1 = 'vloerpomp voorhuis relais-2 204'
local heating_unit2 = 'CV brander relais-1 204'

-- Use when a combined sensor (e.g. temperature and humidity) is used
-- Replace in "otherdevices[heating_probe]" to "otherdevices[heating_probe]" by "temp_only" (in the 2nd "if" and in the "elseif".
-- Remove the -- in the next two lines: 

local naartekst = (tostring (otherdevices[heating_probe]))
local temp_only = (string.sub(naartekst,1,4)) -- the digits (1,4) do point out what characters of the string are needed.


local hysteresis = 0.1

commandArray = {}


-- loop through all the devices
for deviceName,deviceValue in pairs(otherdevices) do
    if (deviceName== thermostat_setpoint ) then

        if tonumber(deviceValue) < tonumber(temp_only-hysteresis) then
        
            if (otherdevices[heating_unit1] == "On") then
            --    commandArray['SendNotification']='verwarming voorhuis is uit'
                commandArray[heating_unit1]='Off'
                print("verwarming voorhuis is uit")
            end
            
        elseif tonumber(deviceValue) > tonumber(temp_only+hysteresis) then
            if (otherdevices[heating_unit1] == "Off") then
                commandArray[heating_unit1]='On'
            --    commandArray['SendNotification']='verwarming voorhuis is aan'
                print("verwarming voorhuis is aan")
            end
        end
    end
end

-- loop through all the variables
for variableName,variableValue in pairs(uservariables) do

end

return commandArray
Sorry: it took some time: had to start the laptop; was not possible to do it on the phone ;)

Domoticz is now on Version: 2020.2 (build 12716)
Debian buster on Intel NUC, Z-Wave, RFXtrx433e, P1, Marmitek, Yeelight, Xiaomi, EspEasy on several WemosD1 & Linknode & NodeMCU
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: dz calculate time heating devices are on

Post by waaren »

WimNL wrote: Thursday 03 December 2020 9:27 I want to know the cost per room.
Nice project. Send you a PM.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
DeVille70
Posts: 32
Joined: Friday 04 December 2015 21:45
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Sandnes, Norway
Contact:

Re: dz calculate time heating devices are on

Post by DeVille70 »

WimNL wrote: Thursday 03 December 2020 8:47 I have 1 central heating and 4 rooms with there own floorheating and thermostat. I use a lua script per room to control the temperature.
Would you mind sharing the script, please?
Waterman052
Posts: 1
Joined: Tuesday 20 April 2021 10:11
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: dz calculate time heating devices are on

Post by Waterman052 »

I need to know if exist an practical formula to calculate the heating time of a steel part put on the specific heat exchange between detail and heating equipment.mygiftcardsite conductivity of the plate, dT =temperature gradient, dx =thickness of the plate.

mygiftcardsite
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest