Efficiency Temp of Ventilation - HELP

Moderator: leecollings

Post Reply
piterbo
Posts: 5
Joined: Friday 12 January 2018 20:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Efficiency Temp of Ventilation - HELP

Post 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.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Efficiency Temp of Ventilation - HELP

Post 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
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
piterbo
Posts: 5
Joined: Friday 12 January 2018 20:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Efficiency Temp of Ventilation - HELP

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest