Page 1 of 1
Efficiency Temp of Ventilation - HELP
Posted: Monday 17 December 2018 20:23
by piterbo
Hi, I need help with somebody who write for me this simple scrip:
I have a 4 dummy device "temperature"
local idx = 52 -- TN2
local idx = 53 -- TW2
local idx = 54 -- TN1
local idx = 55 -- TW1
local idx = 60 -- ETV ( Efficiency Temp of Ventilation)
And I have simple equation:
ETV = (TN2 -TN1) / (TW1 - TW2) *100%
And the result I need post in the IDX 60.
Can someone write this script for mee, I try faw days but no results.
Re: Efficiency Temp of Ventilation - HELP
Posted: Monday 17 December 2018 22:46
by waaren
piterbo wrote: ↑Monday 17 December 2018 20:23
Hi, I need help with somebody who write for me this simple scrip:
I have a 4 dummy device "temperature"
local idx = 52 -- TN2
local idx = 53 -- TW2
local idx = 54 -- TN1
local idx = 55 -- TW1
local idx = 60 -- ETV ( Efficiency Temp of Ventilation)
And I have simple equation:
ETV = (TN2 -TN1) / (TW1 - TW2) *100%
And the result I need post in the IDX 60.
Assuming device 60 is of type percentage this dzVents script could be a solution.
Code: Select all
return {
on = { devices = { 52,53,54,55 }},
logging = {
level = domoticz.LOG_DEBUG,
marker = "Ventilator efficiency"
},
execute = function(dz,item)
local function logWrite(str,level)
dz.log(tostring(str),level or dz.LOG_DEBUG)
end
local TN2 = dz.devices(52).temperature -- TN2
local TW2 = dz.devices(53).temperature -- TW2
local TN1 = dz.devices(54).temperature -- TN1
local TW1 = dz.devices(55).temperature -- TW1
local ETV = dz.devices(60) -- ETV ( Efficiency Temp of Ventilation)
-- And I have simple equation:
local result = dz.utils.round(((TN2 -TN1) / (TW1 - TW2) * 100),2)
-- And the result I need post in the IDX 60.
ETV.updatePercentage(result)
logWrite ("Calculated ETV: " .. result)
end
}
Re: Efficiency Temp of Ventilation - HELP
Posted: Tuesday 18 December 2018 21:50
by piterbo
waaren wrote: ↑Monday 17 December 2018 22:46
piterbo wrote: ↑Monday 17 December 2018 20:23
Hi, I need help with somebody who write for me this simple scrip:
I have a 4 dummy device "temperature"
local idx = 52 -- TN2
local idx = 53 -- TW2
local idx = 54 -- TN1
local idx = 55 -- TW1
local idx = 60 -- ETV ( Efficiency Temp of Ventilation)
And I have simple equation:
ETV = (TN2 -TN1) / (TW1 - TW2) *100%
And the result I need post in the IDX 60.
Assuming device 60 is of type percentage this dzVents script could be a solution.
Code: Select all
return {
on = { devices = { 52,53,54,55 }},
logging = {
level = domoticz.LOG_DEBUG,
marker = "Ventilator efficiency"
},
execute = function(dz,item)
local function logWrite(str,level)
dz.log(tostring(str),level or dz.LOG_DEBUG)
end
local TN2 = dz.devices(52).temperature -- TN2
local TW2 = dz.devices(53).temperature -- TW2
local TN1 = dz.devices(54).temperature -- TN1
local TW1 = dz.devices(55).temperature -- TW1
local ETV = dz.devices(60) -- ETV ( Efficiency Temp of Ventilation)
-- And I have simple equation:
local result = dz.utils.round(((TN2 -TN1) / (TW1 - TW2) * 100),2)
-- And the result I need post in the IDX 60.
ETV.updatePercentage(result)
logWrite ("Calculated ETV: " .. result)
end
}
Thank you sooo much its working.