This my script with decimals
commandArray = {}
if devicechanged['Panna_V'] or devicechanged['Huset_V'] then
local panna_v = otherdevices_svalues["Panna_V"]
local huset_v = otherdevices_svalues["Huset_V"]
local hushall_kwh = uservariables['Hushåll_kWh']
local huset_kwh = uservariables['Huset_kWh']
local panna_kwh = uservariables['Panna_kWh']
local panna, energy, huset, energy2
--print(pan)
--print(hus)
_,_,panna, energy = string.find(panna_v, "(.+);(.+)")
_,_,huset, energy2 = string.find(huset_v, "(.+);(.+)")
--print(panna)
--print(huset)
--print(energy)
--print ("energy2="..energy2)
--print ("huset_kwh="..huset_kwh)
husetdiff_kwh = energy2 - huset_kwh
--print ("husetdiff kwh")
--print (husetdiff_kwh)
--print ("energy="..energy)
--print ("panna_kwh="..panna_kwh)
pannadiff_kwh = energy - panna_kwh
--print ("pannadiff kwh")
--print (pannadiff_kwh)
hushal_kwh = husetdiff_kwh - pannadiff_kwh
hushall_kwh = hushall_kwh + hushal_kwh
--print ("hushåll_kwh")
--print (hushall_kwh)
panna = tonumber(panna)
huset = tonumber(huset)
hush = huset - panna
ener = energy2 - energy
--print(hush)
--print(ener)
if hush > 0 then
--print(el)
commandArray['Variable:Hushåll_kWh']= tostring(hushall_kwh)
commandArray['Variable:Huset_kWh']= tostring(energy2)
commandArray['Variable:Panna_kWh']= tostring(energy)
abc = tostring(hush)
def = tostring(hushall_kwh)
commandArray['UpdateDevice'] = '272|0|'..abc..';'..def..''
else
end
end
return commandArray
I am using Dummy, Electric(Instant&Counter) version 3.5721 of DZ
Panna_V(heating system) and Huset_V(whole house) is electric usage meters that report every 5 minute. I use my Dummy to show my electric consumption without(minus) my heating system