I use is for 3 years now.
Code: Select all
----------------------------------------------------------------------------------------------------------
-- /home/pi/domoticz/scripts/lua/script_device_calculate_Pac.lua
----------------------------------------------------------------------------------------------------------
-- This script collects the values below from a modified sbfspot
-- * A single line csv with the latest SMA data
-- It then calculates the efficiency and Pac for both MPP's from the values above with the formula's
-- This is almost always slightly wrong as the efficiency is for the total system and not per MPP
-- * Efficiency = PacTot/PdcTot*100%
-- * PacX = PdcX * Efficiency
-- It then updates a series of virtual devices in Domoticz
-- * Pdc1 -> Power at MPP1
-- * Pdc2 -> Power at MPP2
-- * Pac1 -> AC Power calculated for Pdc1
-- * Pac2 -> AC Power calculated for Pdc2
-- * Efficiency -> Efficiency based on PacTot deviced by PdcTot
-- To send the value to Domoticz enter the *IDX and *Name
----------------------------------------------------------------------------------------------------------
-- Written by Christ Neeskens (Format5) 2017
----------------------------------------------------------------------------------------------------------
-- V0.4A Replaced comma with dot for SMA variables
-- V0.4 Added all values and only send to Domoticz if wanted (for Brutuss)
-- V0.3 Efficiency max 100% and debug info
-- V0.2 Addedd test PdcTot > 0 to check if system running
-- V0.1 Initial versions
----------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------
-- Domoticz IDX and names of the needed devices
----------------------------------------------------------------------------------------------------------
-- System settings
local SBFSpotSystemName = "Brutus Energy Plant" -- System Name of the SBFspot system
local SBFSpotSMAData = "" -- Location of SMAData in SBFSpot
--local GenerationDeviceName = "Zonnepanelen" -- Device name of the Generated energy
----------------------------------------------------------------------------------------------------------
-- Domoticz IDX
local Pdc1IDX = 378 -- IDX of the energy device that shows Pdc1 power (watt)
local Pdc2IDX = 379 -- IDX of the energy device that shows Pdc2 power (watt)
local Idc1IDX = 386 -- IDX of the energy device that shows Idc1 current (ampere)
local Idc2IDX = 387 -- IDX of the energy device that shows Idc2 current (ampere)
local Udc1IDX = 382 -- IDX of the energy device that shows Udc1 voltage (volt)
local Udc2IDX = 383 -- IDX of the energy device that shows Udc2 voltage (volt)
local Pac1IDX = 0 -- IDX of the energy device that shows Pac1 power (watt)
local Pac2IDX = 0 -- IDX of the energy device that shows Pac2 power (watt)
local Pac3IDX = 0 -- IDX of the energy device that shows Pac3 power (watt)
local CalculatedPac1IDX = 0 -- IDX of the energy device that shows calculated Pac1 power (watt)
local CalculatedPac2IDX = 0 -- IDX of the energy device that shows calculated Pac2 power (watt)
local Iac1IDX = 388 -- IDX of the energy device that shows Iac1 current (ampere)
local Iac2IDX = 0 -- IDX of the energy device that shows Iac2 current (ampere)
local Iac3IDX = 0 -- IDX of the energy device that shows Iac3 current (ampere)
local Uac1IDX = 389 -- IDX of the energy device that shows Uac1 voltage (volt)
local Uac2IDX = 0 -- IDX of the energy device that shows Uac2 voltage (volt)
local Uac3IDX = 0 -- IDX of the energy device that shows Uce3 voltage (volt)
local PdcTotIDX = 0 -- IDX of the energy device that shows PdcTot power (watt)
local PacTotIDX = 0 -- IDX of the energy device that shows PacTot power (watt)
local EfficiencyIDX = 380 -- IDX of the energy device that shows the efficiency (%)
local ETodayIDX = 0 -- IDX of the energy device that shows today's generated electricity (kWh)
local ETotalIDX = 390 -- IDX of the energy device that shows total generated electricity (kWh)
local FrequencyIDX = 0 -- IDX of the energy device that shows frequency (Hz)
local OperatingTimeIDX = 0 -- IDX of the energy device that shows the operating time
local FeedInTimeIDX = 0 -- IDX of the energy device that shows the feed in time
local BT_SignalIDX = 0 -- IDX of the energy device that shows bluetooth signal stringth
local ConditionIDX = 385 -- IDX of the energy device that shows current condition
local GridRelayIDX = 0 -- IDX of the energy device that shows grid relay status
local TemperatureIDX = 0 -- IDX of the energy device that shows temperature
----------------------------------------------------------------------------------------------------------
-- Domoticz device names
local Pdc1DeviceName = "Zonnepanelen String 1" -- Name of the energy device that shows Pdc1 power
local Pdc2DeviceName = "Zonnepanelen String 2" -- Name of the energy device that shows Pdc2 power
local Idc1DeviceName = "Zonnepanelen String 1 Ampere" -- DeviceName of the energy device that shows Idc1 current
local Idc2DeviceName = "Zonnepanelen String 2 Ampere" -- DeviceName of the energy device that shows Idc2 current
local Udc1DeviceName = "Zonnepanelen String 1 Volt" -- DeviceName of the energy device that shows Udc1 voltage
local Udc2DeviceName = "Zonnepanelen String 2 Volt" -- DeviceName of the energy device that shows Udc2 voltage
local Pac1DeviceName = "" -- DeviceName of the energy device that shows Pac1 power
local Pac2DeviceName = "" -- DeviceName of the energy device that shows Pac2 power
local Pac3DeviceName = "" -- DeviceName of the energy device that shows Pac3 power
local CalculatedPac1DeviceName = "" -- Name of the energy device that shows calculated Pac1 power
local CalculatedPac2DeviceName = "" -- Name of the energy device that shows calculated Pac2 power
local Iac1DeviceName = "Omvormer Levering Ampere" -- DeviceName of the energy device that shows Iac1 current
local Iac2DeviceName = "" -- DeviceName of the energy device that shows Iac2 current
local Iac3DeviceName = "" -- DeviceName of the energy device that shows Iac3 current
local Uac1DeviceName = "Omvormer Levering Volt" -- DeviceName of the energy device that shows Uac1 voltage
local Uac2DeviceName = "" -- DeviceName of the energy device that shows Uac2 voltage
local Uac3DeviceName = "" -- DeviceName of the energy device that shows Uce3 voltage
local PdcTotDeviceName = "" -- DeviceName of the energy device that shows PdcTot current
local PacTotDeviceName = "" -- DeviceName of the energy device that shows PacTot current
local EfficiencyDeviceName = "Efficiëntie" -- Name of the energy device that shows the efficiency
local ETodayDeviceName = "" -- DeviceName of the energy device that shows today's generated electricity
local ETotalDeviceName = "Zonnepanelen" -- DeviceName of the energy device that shows total generated electricity
local FrequencyDeviceName = "Frequency" -- DeviceName of the energy device that shows frequency Hz
local OperatingTimeDeviceName = "" -- DeviceName of the energy device that shows the operating time
local FeedInTimeDeviceName = "" -- DeviceName of the energy device that shows the feed in time
local BT_SignalDeviceName = "" -- DeviceName of the energy device that shows bluetooth signal stringth
local ConditionDeviceName = "Omvormer Status" -- DeviceName of the energy device that shows current condition
local GridRelayDeviceName = "" -- DeviceName of the energy device that shows grid relay status
local TemperatureDeviceName = "" -- DeviceName of the energy device that shows temperature
----------------------------------------------------------------------------------------------------------
-- Script parameters including all parameters in sbfspot single line csv
local CSVfile = SBFSpotSMAData .. os.date("%Y") .. '/' .. SBFSpotSystemName .. '-Spot-SingleLine.csv'
UpdateDateTime = 0
DeviceName = 0
DeviceType = 0
Serial = 0
Pdc1 = 0
Pdc2 = 0
Idc1 = 0
Idc2 = 0
Udc1 = 0
Udc2 = 0
Pac1 = 0
Pac2 = 0
Pac3 = 0
Iac1 = 0
Iac2 = 0
Iac3 = 0
Uac1 = 0
Uac2 = 0
Uac3 = 0
PdcTot = 0
PacTot = 0
Efficiency = 0
EToday = 0
ETotal = 0
Frequency = 0
OperatingTime = 0
FeedInTime = 0
BT_Signal = 0
Condition = 0
GridRelay = 0
Temperature = 0
CalculatedPac1 = 0
CalculatedPac2 = 0
Debug = "NO" -- Turn debugging on ("YES") or off ("NO")
----------------------------------------------------------------------------------------------------------
-- Lua Functions
----------------------------------------------------------------------------------------------------------
-- Update to domoticz
function update(device, id, value, index)
if Debug=="YES" then print("Lua Calculate PacX: commandArray[" .. index .. "] = {['" ..device .. "'] = " .. id .. "|0|" .. value .."}") end
commandArray[index] = {['UpdateDevice'] = id .. "|0|" .. value}
end
----------------------------------------------------------------------------------------------------------
-- Round up number
function round(num, numDecimalPlaces)
local mult = 10^(numDecimalPlaces or 0)
return math.floor(num * mult + 0.5) / mult
end
----------------------------------------------------------------------------------------------------------
-- CommandArray
commandArray = {}
--if devicechanged[GenerationDeviceName] then
-- Read sbfspot single line csv file
if Debug=="YES" then
print("Lua Calculate PacX: Using file: " .. CSVfile)
end
file = io.open(CSVfile, "r")
UpdateDateTime,DeviceName,DeviceType,Serial,Pdc1,Pdc2,Idc1,Idc2,Udc1,Udc2,Pac1,Pac2,Pac3,Iac1,Iac2,Iac3,Uac1,Uac2,Uac3,PdcTot,PacTot,Efficiency,EToday,ETotal,Frequency,OperatingTime,FeedInTime,BT_Signal,Condition,GridRelay,Temperature=file:read():match("([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+)")
----------------------------------------------------------------------------------------------------------
-- remove comma's
if Debug=="YES" then
print("Lua Calculate PacX: Replacing comma's with dots and rounding up/down")
end
Pdc1=round(string.gsub(Pdc1,"%,","."))
Pdc2=round(string.gsub(Pdc2,"%,","."))
Idc1=string.gsub(Idc1,"%,",".")
Idc2=string.gsub(Idc2,"%,",".")
Udc1=string.gsub(Udc1,"%,",".")
Udc2=string.gsub(Udc2,"%,",".")
Pac1=round(string.gsub(Pac1,"%,","."))
Pac2=round(string.gsub(Pac2,"%,","."))
Pac3=round(string.gsub(Pac3,"%,","."))
Iac1=string.gsub(Iac1,"%,",".")
Iac2=string.gsub(Iac2,"%,",".")
Iac3=string.gsub(Iac3,"%,",".")
Uac1=string.gsub(Uac1,"%,",".")
Uac2=string.gsub(Uac2,"%,",".")
Uac3=string.gsub(Uac3,"%,",".")
PdcTot=round(string.gsub(PdcTot,"%,","."))
PacTot=round(string.gsub(PacTot,"%,","."))
Efficiency=string.gsub(Efficiency,"%,",".")
EToday=string.gsub(EToday,"%,",".")
ETotal=string.gsub(ETotal,"%,",".")
--ETotal=round(string.gsub(ETotal,"%,","."))
Frequency=string.gsub(Frequency,"%,",".")
OperatingTime=string.gsub(OperatingTime,"%,",".")
FeedInTime=string.gsub(FeedInTime,"%,",".")
BT_Signal=string.gsub(BT_Signal,"%,",".")
Condition=string.gsub(Condition,"%,",".")
GridRelay=string.gsub(GridRelay,"%,",".")
Temperature=string.gsub(Temperature,"%,",".")
if tonumber(PdcTot) >0 and tonumber(PacTot) >0 then
----------------------------------------------------------------------------------------------------------
-- Calculate efficiency
Efficiency=PacTot/PdcTot
if Efficiency >1 then
if Debug=="YES" then
print("Lua Calculate PacX: Efficiency= " .. Efficiency .. " So higher than 100% therefor decreasing to 100%")
end
Efficiency=1
else
if Debug=="YES" then
print("Lua Calculate PacX: Efficiency= " .. Efficiency .. " So lower than 100% therefor not modifying it")
end
end
----------------------------------------------------------------------------------------------------------
-- Calculate Pac values using efficiency and round to whole number
CalculatedPac1=round(Pdc1*Efficiency)
CalculatedPac2=round(Pdc2*Efficiency)
if Debug=="YES" then
print("Lua Calculate PacX: PacTot= " .. PacTot .. " so normal running")
print("Lua Calculate PacX: UpdateDateTime= " .. UpdateDateTime)
print("Lua Calculate PacX: DeviceName= " .. DeviceName)
print("Lua Calculate PacX: DeviceType= " .. DeviceType)
print("Lua Calculate PacX: Serial= " .. Serial)
print("Lua Calculate PacX: Pdc1= " .. Pdc1 .. "Watt")
print("Lua Calculate PacX: Pdc2= " .. Pdc2 .. "Watt")
print("Lua Calculate PacX: PdcTot= " .. PdcTot .. "Watt")
print("Lua Calculate PacX: PacTot= " .. PacTot .. "Watt")
print("Lua Calculate PacX: Efficiency= " .. PacTot .. "/" .. PdcTot .. "=" .. Efficiency*100 .. "%")
print("Lua Calculate PacX: CalculatedPac1=" .. CalculatedPac1 .. "Watt")
print("Lua Calculate PacX: CalculatedPac2=" .. CalculatedPac2 .. "Watt")
end
else
Efficiency=0
CalculatedPac1=0
CalculatedPac2=0
if Debug=="YES" then
print("Lua Calculate PacX: PacTot =" .. PacTot .. " and PdcTot =" .. PdcTot .. "so offline running")
print("Lua Calculate PacX: CalculatedPac1=" .. CalculatedPac1 .. "Watt")
print("Lua Calculate PacX: CalculatedPac2=" .. CalculatedPac2 .. "Watt")
end
end
----------------------------------------------------------------------------------------------------------
-- Create array with values to update
if PdcTot > 0 then
print ('Omvormer gegevens worden verwerkt')
else
print ('Geen zon, Geen gegevens')
end
local count = 0
if Pdc1IDX ~=0 then
count= count +1
if Debug=="YES" then print("Lua Calculate PacX: update(Pdc1DeviceName, Pdc1IDX, Pdc1, count) " .. Pdc1DeviceName .. "," .. Pdc1IDX .. "," .. Pdc1 .. "," .. count) end
update(Pdc1DeviceName, Pdc1IDX, Pdc1, count)
end
if Pdc2IDX ~=0 then
count= count +1
if Debug=="YES" then print("Lua Calculate PacX: update(Pdc2DeviceName, Pdc2IDX, Pdc2, count) " .. Pdc2DeviceName .. "," .. Pdc2IDX .. "," .. Pdc2 .. "," .. count) end
update(Pdc2DeviceName, Pdc2IDX, Pdc2, count)
end
if Idc1IDX ~=0 then
count= count +1
if Debug=="YES" then print("Lua Calculate PacX: update(Idc1DeviceName, Idc1IDX, Idc1, count) " .. Idc1DeviceName .. "," .. Idc1IDX .. "," .. Idc1 .. "," .. count) end
update(Idc1DeviceName, Idc1IDX, Idc1, count)
end
if Idc2IDX ~=0 then
count= count +1
if Debug=="YES" then print("Lua Calculate PacX: update(Idc2DeviceName, Idc2IDX, Idc2, count) " .. Idc2DeviceName .. "," .. Idc2IDX .. "," .. Idc2 .. "," .. count) end
update(Idc2DeviceName, Idc2IDX, Idc2, count)
end
if Udc1IDX ~=0 then
count= count +1
if Debug=="YES" then print("Lua Calculate PacX: update(Udc1DeviceName, Udc1IDX, Udc1, count) " .. Udc1DeviceName .. "," .. Udc1IDX .. "," .. Udc1 .. "," .. count) end
update(Udc1DeviceName, Udc1IDX, Udc1, count)
end
if Udc2IDX ~=0 then
count= count +1
if Debug=="YES" then print("Lua Calculate PacX: update(Udc2DeviceName, Udc2IDX, Udc2, count) " .. Udc2DeviceName .. "," .. Udc2IDX .. "," .. Udc2 .. "," .. count) end
update(Udc2DeviceName, Udc2IDX, Udc2, count)
end
if Pac1IDX ~=0 then
count= count +1
if Debug=="YES" then print("Lua Calculate PacX: update(Pac1DeviceName, Pac1IDX, Pac1, count) " .. Pac1DeviceName .. "," .. Pac1IDX .. "," .. Pac1 .. "," .. count) end
update(Pac1DeviceName, Pac1IDX, Pac1, count)
end
if Pac2IDX ~=0 then
count= count +1
if Debug=="YES" then print("Lua Calculate PacX: update(Pac2DeviceName, Pac2IDX, Pac2, count) " .. Pac2DeviceName .. "," .. Pac2IDX .. "," .. Pac2 .. "," .. count) end
update(Pac2DeviceName, Pac2IDX, Pac2, count)
end
if Pac3IDX ~=0 then
count= count +1
if Debug=="YES" then print("Lua Calculate PacX: update(Pac3DeviceName, Pac3IDX, Pac3, count) " .. Pac3DeviceName .. "," .. Pac3IDX .. "," .. Pac3 .. "," .. count) end
update(Pac3DeviceName, Pac3IDX, Pac3, count)
end
if CalculatedPac1IDX ~=0 then
count= count +1
if Debug=="YES" then print("Lua Calculate PacX: update(CalculatedPac1DeviceName, CalculatedPac2IDX, CalculatedPac1, count) " .. CalculatedPac1DeviceName .. "," .. CalculatedPac1IDX .. "," .. CalculatedPac1 .. "," .. count) end
update(CalculatedPac1DeviceName, CalculatedPac1IDX, CalculatedPac1, count)
end
if CalculatedPac2IDX ~=0 then
count= count +1
if Debug=="YES" then print("Lua Calculate PacX: update(CalculatedPac2DeviceName, CalculatedPac2IDX, CalculatedPac2, count) " .. CalculatedPac2DeviceName .. "," .. CalculatedPac2IDX .. "," .. CalculatedPac2 .. "," .. count) end
update(CalculatedPac2DeviceName, CalculatedPac2IDX, CalculatedPac2, count)
end
if Iac1IDX ~=0 then
count= count +1
if Debug=="YES" then print("Lua Calculate IacX: update(Iac1DeviceName, Iac1IDX, Iac1, count) " .. Iac1DeviceName .. "," .. Iac1IDX .. "," .. Iac1 .. "," .. count) end
update(Iac1DeviceName, Iac1IDX, Iac1, count)
end
if Iac2IDX ~=0 then
count= count +1
if Debug=="YES" then print("Lua Calculate IacX: update(Iac2DeviceName, Iac2IDX, Iac2, count) " .. Iac2DeviceName .. "," .. Iac2IDX .. "," .. Iac2 .. "," .. count) end
update(Iac2DeviceName, Iac2IDX, Iac2, count)
end
if Iac3IDX ~=0 then
count= count +1
if Debug=="YES" then print("Lua Calculate IacX: update(Iac3DeviceName, Iac3IDX, Iac3, count) " .. Iac3DeviceName .. "," .. Iac3IDX .. "," .. Iac3 .. "," .. count) end
update(Iac3DeviceName, Iac3IDX, Iac3, count)
end
if Uac1IDX ~=0 then
count= count +1
if Debug=="YES" then print("Lua Calculate PacX: update(Uac1DeviceName, Uac1IDX, Uac1, count) " .. Uac1DeviceName .. "," .. Uac1IDX .. "," .. Uac1 .. "," .. count) end
update(Uac1DeviceName, Uac1IDX, Uac1, count)
end
if Uac2IDX ~=0 then
count= count +1
if Debug=="YES" then print("Lua Calculate PacX: update(Uac2DeviceName, Uac2IDX, Uac2, count) " .. Uac2DeviceName .. "," .. Uac2IDX .. "," .. Uac2 .. "," .. count) end
update(Uac2DeviceName, Uac2IDX, Uac2, count)
end
if Uac3IDX ~=0 then
count= count +1
if Debug=="YES" then print("Lua Calculate PacX: update(Uac3DeviceName, Uac3IDX, Uac3, count) " .. Uac3DeviceName .. "," .. Uac3IDX .. "," .. Uac3 .. "," .. count) end
update(Uac3DeviceName, Uac3IDX, Uac3, count)
end
if PdcTotIDX ~=0 then
count= count +1
if Debug=="YES" then print("Lua Calculate PacX: update(PdcTotDeviceName, PdcTotIDX, PdcTot, count) " .. PdcTotDeviceName .. "," .. PdcTotIDX .. "," .. PdcTot .. "," .. count) end
update(PdcTotDeviceName, PdcTotIDX, PdcTot, count)
end
if PacTotIDX ~=0 then
count= count +1
if Debug=="YES" then print("Lua Calculate PacX: update(PacTotDeviceName, PacTotIDX, PacTot, count) " .. PacTotDeviceName .. "," .. PacTotIDX .. "," .. PacTot .. "," .. count) end
update(PacTotDeviceName, PacTotIDX, PacTot, count)
end
if EfficiencyIDX ~=0 then
count= count +1
if Debug=="YES" then print("Lua Calculate PacX: update(EfficiencyDeviceName, EfficiencyIDX, Efficiency*100, count) " .. EfficiencyDeviceName .. "," .. EfficiencyIDX .. "," .. Efficiency*100 .. "," .. count) end
update(EfficiencyDeviceName, EfficiencyIDX, Efficiency*100, count)
end
if ETodayIDX ~=0 then
count= count +1
if Debug=="YES" then print("Lua Calculate PacX: update(ETodayDeviceName, ETodayIDX, EToday, count) " .. ETodayDeviceName .. "," .. ETodayIDX .. "," .. EToday .. "," .. count) end
update(ETodayDeviceName, ETodayIDX, EToday, count)
end
if ETotalIDX ~=0 then
count= count +1
if Debug=="YES" then print("Lua Calculate PacX: update(ETotalDeviceName, ETotalIDX, ETotal, count) " .. ETotalDeviceName .. "," .. ETotalIDX .. "," .. ETotal .. "," .. count) end
--update(ETotalDeviceName, ETotalIDX, ETotal, count)
update(ETotalDeviceName, ETotalIDX, PacTot .. ";" .. ETotal*1000, count)
end
if FrequencyIDX ~=0 then
count= count +1
if Debug=="YES" then print("Lua Calculate PacX: update(FrequencyDeviceName, FrequencyIDX, Frequency, count) " .. FrequencyDeviceName .. "," .. FrequencyIDX .. "," .. Frequency .. "," .. count) end
update(FrequencyDeviceName, FrequencyIDX, Frequency, count)
end
if OperatingTimeIDX ~=0 then
count= count +1
if Debug=="YES" then print("Lua Calculate PacX: update(OperatingTimeDeviceName, OperatingTimeIDX, OperatingTime, count) " .. OperatingTimeDeviceName .. "," .. OperatingTimeIDX .. "," .. OperatingTime .. "," .. count) end
update(OperatingTimeDeviceName, OperatingTimeIDX, OperatingTime, count)
end
if FeedInTimeIDX ~=0 then
count= count +1
if Debug=="YES" then print("Lua Calculate PacX: update(FeedInTimeDeviceName, FeedInTimeIDX, FeedInTime, count) " .. FeedInTimeDeviceName .. "," .. FeedInTimeIDX .. "," .. FeedInTime .. "," .. count) end
update(FeedInTimeDeviceName, FeedInTimeIDX, FeedInTime, count)
end
if BT_SignalIDX ~=0 then
count= count +1
if Debug=="YES" then print("Lua Calculate PacX: update(BT_SignalDeviceName, BT_SignalIDX, BT_Signal, count) " .. BT_SignalDeviceName .. "," .. BT_SignalIDX .. "," .. BT_Signal .. "," .. count) end
update(BT_SignalDeviceName, BT_SignalIDX, BT_Signal, count)
end
if ConditionIDX ~=0 then
count= count +1
if Debug=="YES" then print("Lua Calculate PacX: update(ConditionDeviceName, ConditionIDX, Condition, count) " .. ConditionDeviceName .. "," .. ConditionIDX .. "," .. Condition .. "," .. count) end
update(ConditionDeviceName, ConditionIDX, Condition, count)
end
if GridRelayIDX ~=0 then
count= count +1
if Debug=="YES" then print("Lua Calculate PacX: update(GridRelayDeviceName, GridRelayIDX, GridRelay, count) " .. GridRelayDeviceName .. "," .. GridRelayIDX .. "," .. GridRelay .. "," .. count) end
update(GridRelayDeviceName, GridRelayIDX, GridRelay, count)
end
if TemperatureIDX ~=0 then
count= count +1
if Debug=="YES" then print("Lua Calculate PacX: update(temperatureDeviceName, temperatureIDX, temperature, count) " .. temperatureDeviceName .. "," .. temperatureIDX .. "," .. temperature .. "," .. count) end
update(temperatureDeviceName, temperatureIDX, temperature, count)
end
return commandArray