homebridge-enphase-envoy 9.6.0 → 9.6.2

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.
@@ -34,7 +34,7 @@
34
34
  "title": "Firmware 7.x.x",
35
35
  "type": "boolean",
36
36
  "default": false,
37
- "description": "This enable support for Envoy with firmware v7.x.x and newer.",
37
+ "description": "This enable support for Envoy with firmware v7.x.x / v8.x.x and newer.",
38
38
  "required": true
39
39
  },
40
40
  "envoyFirmware7xxTokenGenerationMode": {
package/index.js CHANGED
@@ -1,7 +1,5 @@
1
- 'use strict';
2
- import fs from 'fs';
3
1
  import { join } from 'path';
4
- import { mkdirSync } from 'fs';
2
+ import { mkdirSync, existsSync, writeFileSync } from 'fs';
5
3
  import EnvoyDevice from './src/envoydevice.js';
6
4
  import ImpulseGenerator from './src/impulsegenerator.js';
7
5
  import { PluginName, PlatformName } from './src/constants.js';
@@ -84,8 +82,8 @@ class EnvoyPlatform {
84
82
  ];
85
83
 
86
84
  files.forEach((file) => {
87
- if (!fs.existsSync(file)) {
88
- fs.writeFileSync(file, '0');
85
+ if (!existsSync(file)) {
86
+ writeFileSync(file, '0');
89
87
  }
90
88
  });
91
89
  } catch (error) {
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": "9.6.0",
5
+ "version": "9.6.2",
6
6
  "description": "Homebridge plugin for Photovoltaic Energy System manufactured by Enphase.",
7
7
  "license": "MIT",
8
8
  "author": "grzegorz914",
@@ -18,7 +18,9 @@
18
18
  "url": "https://github.com/grzegorz914/homebridge-enphase-envoy/issues"
19
19
  },
20
20
  "type": "module",
21
- "main": "index.js",
21
+ "exports": {
22
+ ".": "./index.js"
23
+ },
22
24
  "files": [
23
25
  "src",
24
26
  "index.js",
package/src/digestauth.js CHANGED
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  import crypto from 'crypto';
3
2
  import axios from 'axios';
4
3
  import EventEmitter from 'events';
@@ -1,6 +1,4 @@
1
- "use strict";
2
- import { promises } from 'fs';
3
- const fsPromises = promises;
1
+ import { promises as fsPromises } from 'fs';
4
2
  import axios from 'axios';
5
3
  import { Agent } from 'https';
6
4
  import { XMLParser, XMLBuilder, XMLValidator } from 'fast-xml-parser';
@@ -1393,12 +1391,13 @@ class EnvoyDevice extends EventEmitter {
1393
1391
  // Check if the envoy installer password is stored
1394
1392
  const response = await this.readData(this.envoyInstallerPasswordFile);
1395
1393
  let installerPasswd = response.toString() ?? '0';
1396
- const debug3 = this.enableDebugMode ? this.emit('debug', `Installer password from file:`, installerPasswd.length > 0 ? 'Correct' : 'Missing') : false;
1394
+ const debug3 = this.enableDebugMode ? this.emit('debug', `Installer password from file:`, installerPasswd.length > 1 ? 'Correct' : 'Missing') : false;
1397
1395
 
1398
1396
  //check if the envoy installer password is correct
1399
1397
  if (installerPasswd === '0') {
1400
1398
  try {
1401
1399
  //calculate installer password
1400
+ const deviceSn = this.pv.envoy.serialNumber;
1402
1401
  const passwdCalc = new PasswdCalc({
1403
1402
  user: Authorization.InstallerUser,
1404
1403
  realm: Authorization.Realm,
package/src/envoytoken.js CHANGED
@@ -1,6 +1,4 @@
1
- "use strict";
2
- import { promises } from 'fs';
3
- const fsPromises = promises;
1
+ import { promises as fsPromises } from 'fs';
4
2
  import axios from 'axios';
5
3
  import EventEmitter from 'events';
6
4
  import { EnphaseUrls } from './constants.js';
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  import EventEmitter from 'events';
3
2
 
4
3
  class ImpulseGenerator extends EventEmitter {
package/src/mqtt.js CHANGED
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  import asyncMqtt from 'async-mqtt';
3
2
  const { connectAsync } = asyncMqtt;
4
3
  import EventEmitter from 'events';
package/src/passwdcalc.js CHANGED
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  import crypto from 'crypto';
3
2
  import EventEmitter from 'events';
4
3
 
package/src/restful.js CHANGED
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  import express, { json } from 'express';
3
2
  import EventEmitter from 'events';
4
3