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