ebaauw / homebridge-p1

Homebridge plugin for DSMR end-consumer (P1) interface
Apache License 2.0
54 stars 11 forks source link

Wrong totals in Eve Home app #42

Closed muratcorlu closed 3 years ago

muratcorlu commented 3 years ago

Firstly thanks for this great effort. I use this plugin and meter readings are correct in Eve Home app but somehow daily totals are way less than actual values. I spend 10kwh per day in average but in Eve home app I see around 2-3 at most. What can be the cause?

image

ebaauw commented 3 years ago

I have no clue how this can be happening. Homebridge P1 writes a history entry every 10 minutes, computing the consumption from the difference in Total Consumption. Even if Homebridge P1 doesn’t run for a while, the next entry should make up the difference.

Do you see 144 measurements per day?

muratcorlu commented 3 years ago

Yes, mostly I see 144 records per day. image image

I thought maybe difference also being sent from plug-in. But if this plugin only sends latest reading then issue should be on the application(Eve app) side, I think.

thomas-svrts commented 3 years ago

Hi Erik,

I notice the same, history is not correct in Eve. Maybe an issue in hex/base64 encoding?

see next example:

app is showing :

23/3/2021 13:13:43] [P1] Electricity Delivered History: add entry 298: {"time":1616501623,"power":401}
[23/3/2021 13:13:43] [P1] Electricity Delivered History: set history status to: f9ab0200 00000000 fe660726 [01 0702] 2b01 c00f 00000000 000000000101
[23/3/2021 13:13:43] [P1] Electricity Delivered History: set History Status from "oakCAAAAAAD+ZgcmAQcCKgHADwAAAAAAAAAAAQE=" to "+asCAAAAAAD+ZgcmAQcCKwHADwAAAAAAAAAAAQE="
[23/3/2021 13:13:43] [P1] Electricity Delivered History: set consumption from 2643.643 to 2644.044
[23/3/2021 13:13:43] [P1] Electricity Delivered: set Total Consumption from 2644.044 kWh to 2644.045 kWh
[23/3/2021 13:13:50] [P1] Electricity Delivered: set Total Consumption from 2644.048 kWh to 2644.049 kWh
[23/3/2021 13:23:38] [P1] Electricity Delivered: set Total Consumption from 2644.294 kWh to 2644.295 kWh
[23/3/2021 13:23:42] [P1] Electricity Delivered: set Total Consumption from 2644.295 kWh to 2644.296 kWh
[23/3/2021 13:23:43] [P1] Electricity Delivered History: add entry 299: {"time":1616502223,"power":252}
[23/3/2021 13:23:43] [P1] Electricity Delivered History: set history status to: 51ae0200 00000000 fe660726 [01 0702] 2c01 c00f 00000000 000000000101
[23/3/2021 13:23:43] [P1] Electricity Delivered History: set History Status from "+asCAAAAAAD+ZgcmAQcCKwHADwAAAAAAAAAAAQE=" to "Ua4CAAAAAAD+ZgcmAQcCLAHADwAAAAAAAAAAAQE="
[23/3/2021 13:23:43] [P1] Electricity Delivered History: set consumption from 2644.044 to 2644.296
...
[23/3/2021 13:33:43] [P1] Electricity Delivered History: add entry 300: {"time":1616502823,"power":238}
[23/3/2021 13:43:43] [P1] Electricity Delivered History: add entry 301: {"time":1616503423,"power":258}
thomas-svrts commented 3 years ago

According to https://github.com/simont77/fakegato-history

Add entries to history of accessory emulating Eve Energy (Outlet service) using something like this:

this.loggingService.addEntry({time: Math.round(new Date().valueOf() / 1000), power: this.power}); Power is in Watt. Entries are internally averaged and sent every 10 minutes using the global fakegato timer. To have > good accuracy, your entries should be in any case periodic, in order to avoid error with the average

==> so if you supply each 10 minutes a history you should multiply your Wh by 6 (6 times 10 minutes in 1 hour) Eve will internally average it again. So you should provide the power in Watt instead of WattHour

==> more info on the calculation can be found here: https://convert-formula.com/wh-w

ebaauw commented 3 years ago

Bloody hell, I'm computing the power alright, but listing the consumption in the history entry. Indeed that's off by a factor 6.

thomas-svrts commented 3 years ago

Just a small remark: sometime the delta is not 10 minutes. So in those cases it will still be wrong, but not with a factor 6 ;-).

E7503B18-81F5-4C43-AE29-0C6E36E387A3

ebaauw commented 3 years ago

Just a small remark: sometime the delta is not 10 minutes

That should only happen when you restart Homebridge.

So in those cases it will still be wrong, but not with a factor 6

I think I can persist the time of the previous log entry and compute the average power by dividing the consumption difference by the time difference. Not sure how well Eve would handle that. On a real Eve Energy, entries would only be missing when the plug is not connected to mains. In that case, consumption stops. However, when Homebridge is down, consumption continues.

ebaauw commented 3 years ago

Could you try beta v1.2.1-1?

thomas-svrts commented 3 years ago

Hmm tried it quickly… but not receiving history the 1st time after reboot. But after 20 minutes it comes.

I will do more checks tomorrow

ebaauw commented 3 years ago

but not receiving history the 1st time after reboot.

Because the time of the previous entry is not yet available. Should be OK on subsequent reboots. Not sure why it only comes after 20 minutes; I would expect 10 minutes...

thomas-svrts commented 3 years ago

Yeah, you’re right. It only happened the first time. Sounds fixed for me.

ebaauw commented 3 years ago

Release v1.2.1.