Sida 1 av 1

Elanvändning med WPC och Domoticz

Postat: 10 nov 2015, 11:00
av andgla
Hej

Har införskaffat en WPC från foogadgets (http://foogadgets.tictail.com/product/w ... -counter-2)
Jag tänker nu läsa av min elmätare (ADDAX)
Har följ guiden (http://foogadgets.blogspot.se/2015/05/h ... oticz.html)
Men jag får det inte att fungera.
Någon som har fått denna setup att fungera som kan komma med tips?
/A

///// Domoticz konfig /////
Device i Domoticz
Device i Domoticz
Variabler
Variabler
////// lua scriptet /////

--Domoticz Script to get medium actual energy between energy counter readings and puts it on a dummy device

--First create a dummy energy meter and two user variables as numbers.
--Then enter the details below

--Name of the real energy counter
energyCounter = 'Central-1'
--ID of the created dummy energy meter with the new actual value
dummyEnergyMeterid = 30

--The names of two user variables to keep track of previous value due to wrong values from dummy in otherdevices_lastupdate and otherdevices_svalues
userVariableTimestamp = 'LastEnergyTimestamp'
userVariableLastCount = 'LastEnergyCount'

commandArray = {}
if devicechanged[energyCounter] then
--calculate new actual value
actual = ((tonumber(otherdevices_svalues[energyCounter]) - tonumber(uservariables[userVariableLastCount])))/((os.time()-uservariables[userVariableTimestamp])/36
00)

--update dummy energy meter
commandArray[1] = {['UpdateDevice'] = dummyEnergyMeterid .. "|0|" .. actual .. ";" .. otherdevices_svalues[energyCounter]}

--update user variables
commandArray[2] = {['Variable:'..userVariableTimestamp] = tostring(os.time())}
commandArray[3] = {['Variable:'..userVariableLastCount] = otherdevices_svalues[energyCounter]}

print("DummyEnergy: " .. actual .. " W, " .. otherdevices_svalues[energyCounter] .. " kWh")
end

return commandArray

//////
Elmätare med WPC
Elmätare med WPC