Matthew1471 / Enphase-API

Enphase-API is an unofficial project providing an API wrapper (including local/LAN Gateway API) and the documentation for Enphase®'s products and services.
GNU General Public License v3.0
76 stars 10 forks source link

Add Phasemode to ivp/meters #4

Closed catsmanac closed 11 months ago

catsmanac commented 11 months ago

ivp/meters field phaseMode is currently described as 'The number of phases the meter can monitor' which is for phaseCount.

I know of at least:

values showing in phaseMode.

Matthew1471 commented 11 months ago

Thanks, since making this I've come across the source code for the endpoints and am in the process of adding the details to this project (including auth levels).

I've checked and the value can be single, split or three.

I have the Enphase Gateway IQ Metered which is capable of monitoring triple phase (and mine reports three) but I am in a single phase setup, which is why I put the comment that it's what it can monitor (rather than what it is set to monitor).

It looks like it's set in the firmware as an environment variable /etc/enphase.conf and is more a property of the device than something user configurable:

export EMU_PART_NUMBER=800-00654-r08
export EMU_SERIAL_NUMBER=12224xxxxxxx
export EMU_REGION=EU
export EMU_METERING_MODE=three
export EMU_FREQ_PLAN=103_110_116kHz

..and if I were to guess I would say that as America sometimes uses split/dual phase (source); split almost certainly means 2 phases.

/ivp/meters/* is actually serviced internally by the eim process rather than the emu endpoint that most of the other API is serviced by.

I'll update the docs to include single, split or three.

Matthew1471 commented 11 months ago

Commit 1253ebe53f8a0520236772b8bfc8b3d22b526e7c resolves this issue, please see updated documentation for /IVP/Meters/{EID} and /IVP/Meters/All

catsmanac commented 11 months ago

Thanks for the update and explanation @Matthew1471.

/ivp/meters/* is actually serviced internally by the eim process rather than the emu endpoint that most of the other API is serviced by.

These are reportedly faster too. The /production page sometimes takes multiple seconds and some have reported is not responding an a daily base at 23:00 for 1 minute.

We were mapping fields/values between /production and ivp/meters/readings and see the same numbers with different names as well as some different fields reported by each.

Matthew1471 commented 11 months ago

You're welcome. Yes having looked at the source code for /production it makes a LOT of other API calls. I also was surprised to find that /stream/meter internally was just calling /ivp/meters/reports on a 0.99 timer.

Also the IQ Gateway has quite a few web servers which various calls jump through, so when it makes an internal call it ends up amplifying the load rather than if you call directly and take the load hit once.

catsmanac commented 11 months ago

I also was surprised to find that /stream/meter internally was just calling /ivp/meters/reports on a 0.99 timer.

Ah interesting. so both ivp/meters/readings and ivp/meters/reports are served by that same process? These 2 pages use different names for what seems to be the same data.

EDIT: I see you marked ivp/meters/reports as legacy, should I use ivp/meters/readings instead? /EDIT

Historically many data collectors used /production page and that provides the current and last 7 days energy numbers. The meters page offer alternatives for lifetime and current power, but not for these daily and last seven days energy numbers, so can't replace the production page without breaking these. Do yo know alternatives for these?