I've just started with Domoticz and trying to get a feel for it. As I do not complete understand the entire structure (yes I did read quite a bit of documentation) I might overlook something basic.
I'm using rfxcom to read the value of my electricity meters. As there are 2 distinct phases, I want to obtain the total usage. For this I've created a dummy device and used the following script:
Code: Select all
local fase1_dv = 'Electra Fase 1'
local fase2_dv = 'Electra Fase 2'
local electra_idx = 14
commandArray = {}
if devicechanged["Electra Fase 1"] then
fase1 = otherdevices_svalues[fase1_dv]
fase2 = otherdevices_svalues[fase2_dv]
fase1_val = tonumber(fase1)
fase2_val = tonumber(fase2)
commandArray['UpdateDevice'] = electra_idx .. '|0|' .. string.format("%.0f" .. 1 .. " kWh", fase1_val + fase2_val)
print(commandArray['UpdateDevice'])
end
return commandArray
Where are these values stored and how can I get the total assigned to the virtual sensor.
Thanks,
Ysbrand