How to calculate daily usage from 2 phases of the electricity meter?

Moderator: leecollings

Post Reply
Ysbrand
Posts: 1
Joined: Tuesday 20 December 2016 10:17
Target OS: NAS (Synology & others)
Domoticz version: 3.6169
Contact:

How to calculate daily usage from 2 phases of the electricity meter?

Post by Ysbrand »

Hi,

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
This produces the following result:
domoticz.JPG
domoticz.JPG (51.48 KiB) Viewed 1164 times
While it does display the total value of the 2 counters, it doesn't show the total usage for today (11.887).

Where are these values stored and how can I get the total assigned to the virtual sensor.

Thanks,
Ysbrand
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: How to calculate daily usage from 2 phases of the electricity meter?

Post by EdwinK »

Something like this is what I was looking for. But couldn't quite figure it out.

How did you do the 2 counters for the two phases?
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
asjmcguire
Posts: 71
Joined: Saturday 13 July 2013 2:45
Target OS: Linux
Domoticz version: 3.5877
Location: Scotland
Contact:

Re: How to calculate daily usage from 2 phases of the electricity meter?

Post by asjmcguire »

EdKo66 wrote:Something like this is what I was looking for. But couldn't quite figure it out.

How did you do the 2 counters for the two phases?
Just in case you haven't figured this out yet - (this is my understanding - someone else might need to clarify if it is correct).
The daily reading is kWh (kilowatt-hours).

If a kettle says on the label it consumes 2.8kW (or 2800W) that means it uses 2800W in 60 minutes (per hour).
This means that it uses 2800/60 = 46.6W per minute.

So now let's assume we have a cumulative reading of 6.123kWh (which will be 6123 in svalue domoticz) and we are consuming 1.25kW at the time of the reading.

cumulative = 6123 + (1250/60) = 6143.833
svalue=1250;6143.833

You don't calculate the daily reading - Domoticz does that for you when you start feeding it with the increasing cumulative total.
AEOTEC ZStick, 11 ZWave Nodes, RFXCOMM, 50ish Byron Sockets.. HE851 (PIR), 2x HE852 (DoorContact)
WS2300, CM180, CC128, 2xTHGR122NX, 2xPiZeroW w/DS18B20, 8Ch 1W Relay Board.
8 Panasonic IP Cams, 1 16ch CCTV DVR + 15 CCTV Cams
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest