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

New CT Reversal endpoint? #6

Open plsmith451 opened 11 months ago

plsmith451 commented 11 months ago

I get a 404 - Not found when hitting the /ivp/meters/ctreversal/{EID} endpoint. Has this changed / is there an alternate?

Matthew1471 commented 11 months ago

The endpoint is definitely correct.. interestingly it's the {EID} part which I had incorrect (thus the Not Found), it is of the format /ivp/meters/ctreversal/(?:[pc](?:L[1-3])?/?)?$

For instance a HTTP GET to one of the following:

https://envoy.local/ivp/meters/ctreversal/

https://envoy.local/ivp/meters/ctreversal/p https://envoy.local/ivp/meters/ctreversal/pL1 https://envoy.local/ivp/meters/ctreversal/pL2 https://envoy.local/ivp/meters/ctreversal/pL3

https://envoy.local/ivp/meters/ctreversal/c https://envoy.local/ivp/meters/ctreversal/cL1 https://envoy.local/ivp/meters/ctreversal/cL2 https://envoy.local/ivp/meters/ctreversal/cL3

Should all succeed.

This is where the p is Production and the c is Consumption.

..and to change any of these then one has to do a HTTP PUT to one of the above URLs:

{
    "polarityReversal": "reverse",
}

Not specifying a line (aka "phase") number applies it across all lines/phases of that meter type (e.g. c instead of cL1 will apply to all Consumption lines/phases).

I believe an empty PUT (or {} which is what the GET currently returns or maybe "normal" instead of "reverse") should be sent to unset it (haven't tested).

GET requests require any valid token (anybody) but all other HTTP methods (currently just PUT) will require a prov or above token.