homebridge-enphase-envoy 10.2.5-beta.3 → 10.2.5-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/energymeter.js +3 -3
- package/src/envoydata.js +3 -3
- package/src/envoydevice.js +1 -1
- package/src/functions.js +3 -2
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"private": false,
|
|
3
3
|
"displayName": "Enphase Envoy",
|
|
4
4
|
"name": "homebridge-enphase-envoy",
|
|
5
|
-
"version": "10.2.5-beta.
|
|
5
|
+
"version": "10.2.5-beta.5",
|
|
6
6
|
"description": "Homebridge p7ugin for Photovoltaic Energy System manufactured by Enphase.",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"author": "grzegorz914",
|
package/src/energymeter.js
CHANGED
|
@@ -482,7 +482,7 @@ class EnergyMeter extends EventEmitter {
|
|
|
482
482
|
const jwt = this.feature.info.jwtToken;
|
|
483
483
|
|
|
484
484
|
// Create a token-authenticated Axios instance
|
|
485
|
-
const axiosInstance = this.functions.createAxiosInstance(`Bearer ${jwt.token}`, null);
|
|
485
|
+
const axiosInstance = this.functions.createAxiosInstance(this.url, `Bearer ${jwt.token}`, null);
|
|
486
486
|
|
|
487
487
|
// Send validation request
|
|
488
488
|
const response = await axiosInstance.get(ApiUrls.CheckJwt);
|
|
@@ -503,7 +503,7 @@ class EnergyMeter extends EventEmitter {
|
|
|
503
503
|
}
|
|
504
504
|
|
|
505
505
|
// Replace axios instance with cookie-authenticated one
|
|
506
|
-
this.axiosInstance = this.functions.createAxiosInstance(null, cookie);
|
|
506
|
+
this.axiosInstance = this.functions.createAxiosInstance(this.url, null, cookie);
|
|
507
507
|
|
|
508
508
|
// Update internal state
|
|
509
509
|
this.feature.info.tokenValid = true;
|
|
@@ -1166,7 +1166,7 @@ class EnergyMeter extends EventEmitter {
|
|
|
1166
1166
|
|
|
1167
1167
|
try {
|
|
1168
1168
|
// Create axios instance
|
|
1169
|
-
this.axiosInstance = this.functions.createAxiosInstance();
|
|
1169
|
+
this.axiosInstance = this.functions.createAxiosInstance(this.url);
|
|
1170
1170
|
|
|
1171
1171
|
// Get basic PV info
|
|
1172
1172
|
const getInfo = await this.getInfo();
|
package/src/envoydata.js
CHANGED
|
@@ -713,7 +713,7 @@ class EnvoyData extends EventEmitter {
|
|
|
713
713
|
const jwt = this.feature.info.jwtToken;
|
|
714
714
|
|
|
715
715
|
// Create a token-authenticated Axios instance
|
|
716
|
-
const axiosInstance = this.functions.createAxiosInstance(`Bearer ${jwt.token}`, null);
|
|
716
|
+
const axiosInstance = this.functions.createAxiosInstance(this.url, `Bearer ${jwt.token}`, null);
|
|
717
717
|
|
|
718
718
|
// Send validation request
|
|
719
719
|
const response = await axiosInstance.get(ApiUrls.CheckJwt);
|
|
@@ -734,7 +734,7 @@ class EnvoyData extends EventEmitter {
|
|
|
734
734
|
}
|
|
735
735
|
|
|
736
736
|
// Replace axios instance with cookie-authenticated one
|
|
737
|
-
this.axiosInstance = this.functions.createAxiosInstance(null, cookie);
|
|
737
|
+
this.axiosInstance = this.functions.createAxiosInstance(this.url, null, cookie);
|
|
738
738
|
|
|
739
739
|
// Update internal state
|
|
740
740
|
this.feature.info.tokenValid = true;
|
|
@@ -2732,7 +2732,7 @@ class EnvoyData extends EventEmitter {
|
|
|
2732
2732
|
|
|
2733
2733
|
try {
|
|
2734
2734
|
// Create axios instance
|
|
2735
|
-
this.axiosInstance = this.functions.createAxiosInstance();
|
|
2735
|
+
this.axiosInstance = this.functions.createAxiosInstance(this.url);
|
|
2736
2736
|
|
|
2737
2737
|
// Get basic PV info
|
|
2738
2738
|
const getInfo = await this.getInfo();
|
package/src/envoydevice.js
CHANGED
|
@@ -362,7 +362,7 @@ class EnvoyDevice extends EventEmitter {
|
|
|
362
362
|
this.envoyTokenFile = envoyTokenFile;
|
|
363
363
|
|
|
364
364
|
//url
|
|
365
|
-
this.url =
|
|
365
|
+
this.url = device.envoyFirmware7xxTokenGenerationMode > 0 ? `https://${this.host}` : `http://${this.host}`;
|
|
366
366
|
|
|
367
367
|
//supported functions
|
|
368
368
|
this.feature = {
|
package/src/functions.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { promises as fsPromises } from 'fs';
|
|
2
|
+
import axios from 'axios';
|
|
2
3
|
import { ApiCodes, TimezoneLocaleMap } from './constants.js';
|
|
3
4
|
|
|
4
5
|
class Functions {
|
|
@@ -112,9 +113,9 @@ class Functions {
|
|
|
112
113
|
return powerPeakStored;
|
|
113
114
|
}
|
|
114
115
|
|
|
115
|
-
createAxiosInstance(authHeader = null, cookie = null) {
|
|
116
|
+
createAxiosInstance(url, authHeader = null, cookie = null) {
|
|
116
117
|
return axios.create({
|
|
117
|
-
baseURL:
|
|
118
|
+
baseURL: url,
|
|
118
119
|
headers: {
|
|
119
120
|
Accept: 'application/json',
|
|
120
121
|
...(authHeader ? { Authorization: authHeader } : {}),
|