|
35 | 35 | ENDPOINT_URL_STREAM = "https://{}/stream/meter" |
36 | 36 | ENDPOINT_URL_PDM_ENERGY = "https://{}/ivp/pdm/energy" |
37 | 37 |
|
38 | | -ENVOY_MODEL_S = "PC" |
39 | | -ENVOY_MODEL_C = "P" |
| 38 | +ENVOY_MODEL_M = "Metered" |
| 39 | +ENVOY_MODEL_S = "Standard" |
40 | 40 |
|
41 | 41 | # paths for the enlighten installer token |
42 | 42 | ENLIGHTEN_AUTH_URL = "https://enlighten.enphaseenergy.com/login/login.json" |
@@ -374,6 +374,7 @@ def envoy_info(self): |
374 | 374 | "software": self.get("envoy_software"), |
375 | 375 | "software_build_epoch": self.get("envoy_software_build_epoch"), |
376 | 376 | "update_status": self.get("envoy_update_status_value"), |
| 377 | + "model": self.reader.endpoint_type, |
377 | 378 | } |
378 | 379 |
|
379 | 380 | production_value = path_by_token( |
@@ -568,7 +569,7 @@ def __new__(cls, *a, **kw): |
568 | 569 |
|
569 | 570 |
|
570 | 571 | def getEnvoyDataClass(envoy_type, production_json): |
571 | | - if envoy_type == ENVOY_MODEL_C: |
| 572 | + if envoy_type == ENVOY_MODEL_S: |
572 | 573 | return EnvoyStandard |
573 | 574 |
|
574 | 575 | # It is a metered Envoy, check the production json if the eim entry has activeCount > 0 |
@@ -986,7 +987,7 @@ async def stream_reader(self, meter_callback=None, loop=None): |
986 | 987 | # First, login, etc, make sure we have a token. |
987 | 988 | await self.init_authentication() |
988 | 989 |
|
989 | | - if not self.isMeteringEnabled or self.endpoint_type != ENVOY_MODEL_S: |
| 990 | + if not self.isMeteringEnabled or self.endpoint_type != ENVOY_MODEL_M: |
990 | 991 | _LOGGER.debug( |
991 | 992 | "Metering is not enabled or endpoint type '%s' not supported", |
992 | 993 | self.endpoint_type, |
@@ -1171,15 +1172,15 @@ async def detect_model(self): |
1171 | 1172 | self.endpoint_production_json_results.json() |
1172 | 1173 | ) |
1173 | 1174 | ): |
1174 | | - self.endpoint_type = ENVOY_MODEL_S |
| 1175 | + self.endpoint_type = ENVOY_MODEL_M |
1175 | 1176 |
|
1176 | 1177 | else: |
1177 | 1178 | await self.update_endpoints(["endpoint_production_v1_results"]) |
1178 | 1179 | if ( |
1179 | 1180 | self.endpoint_production_v1_results |
1180 | 1181 | and self.endpoint_production_v1_results.status_code == 200 |
1181 | 1182 | ): |
1182 | | - self.endpoint_type = ENVOY_MODEL_C # Envoy-C, standard envoy |
| 1183 | + self.endpoint_type = ENVOY_MODEL_S |
1183 | 1184 |
|
1184 | 1185 | if not self.endpoint_type: |
1185 | 1186 | raise RuntimeError( |
@@ -1293,7 +1294,7 @@ def run_stream(self): |
1293 | 1294 | print("Reading stream...") |
1294 | 1295 | loop = asyncio.get_event_loop() |
1295 | 1296 | self.data = EnvoyMeteredWithCT(self) |
1296 | | - self.endpoint_type = ENVOY_MODEL_S |
| 1297 | + self.endpoint_type = ENVOY_MODEL_M |
1297 | 1298 | data_results = loop.run_until_complete( |
1298 | 1299 | asyncio.gather(self.stream_reader(), return_exceptions=False) |
1299 | 1300 | ) |
|
0 commit comments