ashleypittman / mec

MyEnergi Client API and Management tools.
GNU General Public License v3.0
32 stars 27 forks source link

Two Harvis #11

Open Edcorteen opened 2 years ago

Edcorteen commented 2 years ago

Hi Ashley, are my two Harvis confusing your code? generation is not correct as the code does not add the two values for generation and AC battery. I have two solar arrays monitored by two Harvi.

Logs show this confusion, Harvi code below

2021-10-05 10:24:37,176 - 749 - myenergi - INFO - Extra data for zappi:{'pwm': 1000, 'zs': 1026, 'rdc': -4, 'rac': 4, 'rrac': -4, 'zsh': 4, 'zsl': 2} 2021-10-05 10:24:37,177 - 749 - myenergi - DEBUG - Data from <class 'mec.zp.Harvi'> is 1 second(s) old 2021-10-05 10:24:37,177 - 749 - myenergi - DEBUG - {'Generation': 324, 'AC Battery': 3177} 2021-10-05 10:24:37,177 - 749 - myenergi - DEBUG - Data from <class 'mec.zp.Harvi'> is 6 second(s) old 2021-10-05 10:24:37,178 - 749 - myenergi - DEBUG - {'Grid': 33, 'Generation': 439, 'AC Battery': 23} 2021-10-05 10:24:37,178 - 749 - myenergi - INFO - Discrepancy in Generation values: 766 439 2021-10-05 10:24:37,179 - 749 - myenergi - INFO - 54.32% difference

{'harvi': [{'dat': '05-10-2021', 'ect1p': 1, 'ect2p': 1, 'ect3p': 1, 'ectp1': 324, 'ectp2': 3177, 'ectt1': 'Generation', 'ectt2': 'AC Battery', 'ectt3': 'None', 'fwv': '', 'sno': 11147497, 'tim': '09:24:36'}, {'dat': '05-10-2021', 'ect1p': 1, 'ect2p': 1, 'ect3p': 1, 'ectp1': 33, 'ectp2': 439, 'ectp3': -23, 'ectt1': 'Grid', 'ectt2': 'Generation', 'ectt3': 'AC Battery', 'fwv': '', 'sno': 10327777, 'tim': '09:24:31'}]},

ashleypittman commented 2 years ago

Yes, this is probably an issue. There's a check in there that dates back to a time when the API was newer and the servers weren't as reliable, but there's a check that the CTs measuring Generation are roughly the same as the generation figure as seen by the device, what it does is if they're different it waits 5 seconds and then retries.

The issue here will not be that you've got two Harvis, but that you've got two CTs measuring Generation, what it should do in this case is add them together I assume, and but it'll be taking the most recent one.

Looking at your numbers the total generation at this point in time is 763w, and the device 'gen' figure is 766 so if these were added together the check would pass I assume. I can push a fix for this later.

Edcorteen commented 2 years ago

Hi Ashley

Thanks, that would be great if you can fix this, as you say there are two generation CTs and two battery CTs measuring my two separate systems, so adding together should fix things!

Regards

Ed.

⁣Get BlueMail for Android ​

On 5 Oct 2021, 11:52, at 11:52, Ashley Pittman @.***> wrote:

Yes, this is probably an issue. There's a check in there that dates back to a time when the API was newer and the servers weren't as reliable, but there's a check that the CTs measuring Generation are roughly the same as the generation figure as seen by the device, what it does is if they're different it waits 5 seconds and then retries.

The issue here will not be that you've got two Harvis, but that you've got two CTs measuring Generation, what it should do in this case is add them together I assume, and but it'll be taking the most recent one.

Looking at your numbers the total generation at this point in time is 763w, and the device 'gen' figure is 766 so if these were added together the check would pass I assume. I can push a fix for this later.

-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/ashleypittman/mec/issues/11#issuecomment-934295523

ashleypittman commented 2 years ago

Can you try with latest master, https://github.com/ashleypittman/mec/commit/2cb87c05d10116d28fe17e5fd6739730c0614cef should fix this.

Edcorteen commented 2 years ago

Hi Ashley

Still just shows latest reading? I Have 1.2 as Generation should be 1212 plus 1660.

2021-10-06 10:19:50,762 - 785 - myenergi - DEBUG - Data, as received [{'eddi': []}, {'zappi': [{'bsm': 0, 'bss': 0, 'bst': 0, 'che': 1.56, 'cmt': 254, 'dat': '06-10-2021', 'div': 2404, 'dst': 1, 'ectp1': 2404, 'ectp4': -1, 'ectt1': 'Internal Load', 'ectt2': 'None', 'ectt3': 'None', 'ectt4': 'None', 'ectt5': 'None', 'ectt6': 'None', 'frq': 49.91, 'fwv': '3560S3.142', 'gen': 2895, 'lck': 31, 'mgl': 100, 'pha': 1, 'pri': 1, 'pst': 'C2', 'pwm': 1591, 'rac': 37, 'rrac': -33, 'sbh': 17, 'sbk': 5, 'sno': 12037968, 'sta': 3, 'tim': '09:18:21', 'tz': 0, 'vol': 2446, 'zmo': 3, 'zs': 3078, 'zsh': 12, 'zsl': 6}]}, {'harvi': [{'dat': '06-10-2021', 'ect1p': 1, 'ect2p': 1, 'ect3p': 1, 'ectp1': 1660, 'ectp2': -17, 'ectt1': 'Generation', 'ectt2': 'AC Battery', 'ectt3': 'None', 'fwv': '', 'sno': 11147497, 'tim': '09:18:10'}, {'dat': '06-10-2021', 'ect1p': 1, 'ect2p': 1, 'ect3p': 1, 'ectp1': 32, 'ectp2': 1212, 'ectt1': 'Grid', 'ectt2': 'Generation', 'ectt3': 'AC Battery', 'fwv': '', 'sno': 10327777, 'tim': '09:19:19'}]}, {'asn': 's18.myenergi.net', 'fwv': '3401S3.077'}] 2021-10-06 10:19:50,763 - 785 - myenergi - DEBUG - Data from <class 'mec.zp.Zappi'> is 89 second(s) old 2021-10-06 10:19:50,763 - 785 - myenergi - DEBUG - {} 2021-10-06 10:19:50,764 - 785 - myenergi - DEBUG - Voltage 244.600000 frequency 49.910000 2021-10-06 10:19:50,764 - 785 - myenergi - DEBUG - Charge session allowed 2021-10-06 10:19:50,764 - 785 - myenergi - DEBUG - Charge when locked 2021-10-06 10:19:50,765 - 785 - myenergi - DEBUG - Lock when unplugged 2021-10-06 10:19:50,765 - 785 - myenergi - DEBUG - Lock when plugged in 2021-10-06 10:19:50,765 - 785 - myenergi - INFO - Locked Now 2021-10-06 10:19:50,766 - 785 - myenergi - INFO - Extra data for zappi:{'pwm': 1591, 'zs': 3078, 'rac': 37, 'rrac': -33, 'zsh': 12, 'zsl': 6} 2021-10-06 10:19:50,766 - 785 - myenergi - DEBUG - Data from <class 'mec.zp.Harvi'> is 100 second(s) old 2021-10-06 10:19:50,767 - 785 - myenergi - DEBUG - {'Generation': 1660, 'AC Battery': -17} 2021-10-06 10:19:50,767 - 785 - myenergi - DEBUG - Data from <class 'mec.zp.Harvi'> is 31 second(s) old 2021-10-06 10:19:50,767 - 785 - myenergi - DEBUG - {'Grid': 32, 'Generation': 1212, 'AC Battery': 0} 2021-10-06 10:19:50,768 - 785 - myenergi - INFO - Discrepancy in Generation values: 2895 1212 2021-10-06 10:19:50,768 - 785 - myenergi - INFO - 81.98% difference

ashleypittman commented 2 years ago

Can you try again now?

Edcorteen commented 2 years ago

Hi Ashley

Working now. Thanks a lot!

2021-10-06 14:45:44,863 - 811 - myenergi - DEBUG - House is using 437w

2021-10-06 14:45:44,864 - 811 - myenergi - DEBUG - Solar is generating 1.546kW

2021-10-06 14:45:44,864 - 811 - myenergi - DEBUG - Exporting 1.109kW

2021-10-06 14:45:44,864 - 811 - mec.power_meter - DEBUG - Adding 1546 for 0 seconds

2021-10-06 14:45:44,864 - 811 - mec.power_meter - DEBUG - Adding -21 for 0 seconds

2021-10-06 14:45:44,865 - 811 - mec.power_meter - DEBUG - Adding -1109 for 0 seconds

2021-10-06 14:45:44,865 - 811 - mec.power_meter - DEBUG - Adding 437 for 0 seconds

2021-10-06 14:45:44,865 - 811 - run_zappi - INFO - Total for Generation is 0.037kWh

2021-10-06 14:45:44,865 - 811 - run_zappi - INFO - Total for AC Battery is 0.005kWh -0.000kWh

2021-10-06 14:45:44,866 - 811 - run_zappi - INFO - Total for Grid is 0.001kWh -0.008kWh

2021-10-06 14:45:44,866 - 811 - run_zappi - INFO - Total for House is 0.006kWh

Ed.

From: Ashley Pittman @.> Sent: 06 October 2021 14:30 To: ashleypittman/mec @.> Cc: Edcorteen @.>; Author @.> Subject: Re: [ashleypittman/mec] Two Harvis (#11)

Can you try again now?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ashleypittman/mec/issues/11#issuecomment-936237656 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AQSLZQ4Q242QUWQSGQXYC7DUFRFMHANCNFSM5FLKKL4A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub . https://github.com/notifications/beacon/AQSLZQ6I3O3KCFY642NHZULUFRFMHA5CNFSM5FLKKL4KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOG7G5UWA.gif

Edcorteen commented 2 years ago

Hi Ashley

Sorry to be a pain!

I have just completely rebuilt my install of your mec as I could not get the new Leaf integration to work with the latest call to Nissan.

I run the program but it immediately fails

Run_zappi.py

line 9

Import daemon

No module named daemon

Any idea what dependency I have missed?

Regards

Ed Corteen

From: @. @.> Sent: 06 October 2021 14:49 To: 'ashleypittman/mec' @.***> Subject: RE: [ashleypittman/mec] Two Harvis (#11)

Hi Ashley

Working now. Thanks a lot!

2021-10-06 14:45:44,863 - 811 - myenergi - DEBUG - House is using 437w

2021-10-06 14:45:44,864 - 811 - myenergi - DEBUG - Solar is generating 1.546kW

2021-10-06 14:45:44,864 - 811 - myenergi - DEBUG - Exporting 1.109kW

2021-10-06 14:45:44,864 - 811 - mec.power_meter - DEBUG - Adding 1546 for 0 seconds

2021-10-06 14:45:44,864 - 811 - mec.power_meter - DEBUG - Adding -21 for 0 seconds

2021-10-06 14:45:44,865 - 811 - mec.power_meter - DEBUG - Adding -1109 for 0 seconds

2021-10-06 14:45:44,865 - 811 - mec.power_meter - DEBUG - Adding 437 for 0 seconds

2021-10-06 14:45:44,865 - 811 - run_zappi - INFO - Total for Generation is 0.037kWh

2021-10-06 14:45:44,865 - 811 - run_zappi - INFO - Total for AC Battery is 0.005kWh -0.000kWh

2021-10-06 14:45:44,866 - 811 - run_zappi - INFO - Total for Grid is 0.001kWh -0.008kWh

2021-10-06 14:45:44,866 - 811 - run_zappi - INFO - Total for House is 0.006kWh

Ed.

From: Ashley Pittman @. @.> > Sent: 06 October 2021 14:30 To: ashleypittman/mec @. @.> > Cc: Edcorteen @. @.> >; Author @. @.> > Subject: Re: [ashleypittman/mec] Two Harvis (#11)

Can you try again now?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ashleypittman/mec/issues/11#issuecomment-936237656 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AQSLZQ4Q242QUWQSGQXYC7DUFRFMHANCNFSM5FLKKL4A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub . https://github.com/notifications/beacon/AQSLZQ6I3O3KCFY642NHZULUFRFMHA5CNFSM5FLKKL4KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOG7G5UWA.gif

ashleypittman commented 2 years ago

Probably "pip install --user python-daemon"