diff --git a/CHANGELOG.md b/CHANGELOG.md index 5bf66e6..4519d65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [9.4.2] - (11.11.2024) + +## Changes + +- fix reconnect if error ocurred during start +- correct some logs wording +- config.schema updated +- cleanup + ## [9.4.1] - (30.10.2024) ## Changes diff --git a/config.schema.json b/config.schema.json index 124b55d..91c1b8d 100644 --- a/config.schema.json +++ b/config.schema.json @@ -59,7 +59,7 @@ "condition": { "functionBody": "return model.devices[arrayIndices].envoyFirmware7xx === true;" }, - "required": true + "required": false }, "envoyPasswd": { "title": "Envoy Password", @@ -1081,7 +1081,6 @@ "profile": { "title": "Profile", "type": "string", - "default": "backup", "oneOf": [ { "title": "Savings", @@ -1121,7 +1120,7 @@ } ], "description": "Here select the profile.", - "required": true + "required": false }, "displayType": { "title": "Type", @@ -1237,7 +1236,6 @@ "gridMode": { "title": "Mode", "type": "string", - "default": "on-grid", "oneOf": [ { "title": "Grid On", @@ -1277,7 +1275,7 @@ } ], "description": "Here select the grid mode.", - "required": true + "required": false }, "displayType": { "title": "Type", @@ -1342,7 +1340,6 @@ "compareMode": { "title": "Compare Mode", "type": "integer", - "default": 2, "oneOf": [ { "title": ">", @@ -1376,7 +1373,7 @@ } ], "description": "Here select the compare mode.", - "required": true + "required": false }, "backupLevel": { "title": "Level", @@ -1558,7 +1555,6 @@ "gridMode": { "title": "Mode", "type": "string", - "default": "on-grid", "oneOf": [ { "title": "Grid On", @@ -1598,7 +1594,7 @@ } ], "description": "Here select the grid mode.", - "required": true + "required": false }, "displayType": { "title": "Type", @@ -1674,7 +1670,6 @@ "gridMode": { "title": "Mode", "type": "string", - "default": "on-grid", "oneOf": [ { "title": "Grid On", @@ -1714,7 +1709,7 @@ } ], "description": "Here select the grid mode.", - "required": true + "required": false }, "displayType": { "title": "Type", @@ -1971,7 +1966,6 @@ "mode": { "title": "Mode", "type": "string", - "default": "off", "oneOf": [ { "title": "Off", @@ -1993,7 +1987,7 @@ } ], "description": "Here select the mode.", - "required": true + "required": false }, "displayType": { "title": "Type", diff --git a/package.json b/package.json index f140abd..2dbd599 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "private": false, "displayName": "Enphase Envoy", "name": "homebridge-enphase-envoy", - "version": "9.4.1", + "version": "9.4.2", "description": "Homebridge plugin for Photovoltaic Energy System manufactured by Enphase.", "license": "MIT", "author": "grzegorz914", diff --git a/src/envoydevice.js b/src/envoydevice.js index 7728d11..3d7aca3 100644 --- a/src/envoydevice.js +++ b/src/envoydevice.js @@ -1045,7 +1045,7 @@ class EnvoyDevice extends EventEmitter { return true; } catch (error) { - this.emit('error', `Start error: ${error}`); + throw new Error(`Start error: ${error}`); }; }; @@ -1098,7 +1098,7 @@ class EnvoyDevice extends EventEmitter { return true; } catch (error) { this.getJwtTokenRunning = this.getJwtTokenRunning ? false : this.getJwtTokenRunning; - throw new Error(`Requesting JWT token error: ${error.message || error}`); + throw new Error(`Get JWT token error: ${error.message || error}`); }; }; @@ -1144,7 +1144,7 @@ class EnvoyDevice extends EventEmitter { return true; } catch (error) { - throw new Error(`Requeating validate JWT token error: ${error.message || error}`); + throw new Error(`Validate JWT token error: ${error.message || error}`); }; }; @@ -1299,7 +1299,7 @@ class EnvoyDevice extends EventEmitter { const mqtt = this.mqttConnected ? this.mqtt.emit('publish', 'Info', parseInfoData) : false; return true; } catch (error) { - throw new Error(`Requesting info error: ${error.message || error}`); + throw new Error(`Update info error: ${error.message || error}`); }; }; @@ -1322,7 +1322,7 @@ class EnvoyDevice extends EventEmitter { return true; } catch (error) { - this.emit('warn', `Caalculaate envoy password error: ${error.message || error}, dont worry all working correct, only the power and power max of microinverters will not be displayed.`); + this.emit('warn', `Calculaate envoy password error: ${error.message || error}, dont worry all working correct, only the power and power max of microinverters will not be displayed.`); return false; }; }; @@ -1375,7 +1375,7 @@ class EnvoyDevice extends EventEmitter { return true; } catch (error) { - this.emit('warn', `Installer password error: ${error.message || error}, dont worry all working correct, only the power production state/control and plc level will not be displayed.`); + this.emit('warn', `Calculate installer password error: ${error.message || error}, dont worry all working correct, only the power production state/control and plc level will not be displayed.`); return false; }; }; @@ -1546,7 +1546,7 @@ class EnvoyDevice extends EventEmitter { const mqtt = this.mqttConnected ? this.mqtt.emit('publish', 'Home', envoy) : false; return true; } catch (error) { - throw new Error(`Requesting home error: ${error.message || error}`); + throw new Error(`Update home error: ${error.message || error}`); }; }; @@ -1812,7 +1812,7 @@ class EnvoyDevice extends EventEmitter { const mqtt = this.mqttConnected ? this.mqtt.emit('publish', 'Inventory', inventory) : false; return true; } catch (error) { - throw new Error(`Requesting inventory error: ${error.message || error}`); + throw new Error(`Update inventory error: ${error.message || error}`); }; }; @@ -1893,7 +1893,7 @@ class EnvoyDevice extends EventEmitter { const mqtt = this.mqttConnected ? this.mqtt.emit('publish', 'Meters', meters) : false; return metersEnabled; } catch (error) { - throw new Error(`Requesting meters error: ${error.message || error}`); + throw new Error(`Update meters error: ${error.message || error}`); }; }; @@ -1960,7 +1960,7 @@ class EnvoyDevice extends EventEmitter { const mqtt = this.mqttConnected ? this.mqtt.emit('publish', 'Meters Reading', metersReading) : false; return true; } catch (error) { - throw new Error(`Requesting meters reading error: ${error.message || error}`); + throw new Error(`Update meters reading error: ${error.message || error}`); }; }; @@ -2017,7 +2017,7 @@ class EnvoyDevice extends EventEmitter { const mqtt = this.mqttConnected ? this.mqtt.emit('publish', 'Microinverters', microinverters) : false; return true; } catch (error) { - throw new Error(`Requesting microinverters status error: ${error.message || error}`); + throw new Error(`Update microinverters status error: ${error.message || error}`); }; }; @@ -2057,7 +2057,7 @@ class EnvoyDevice extends EventEmitter { const mqtt = this.mqttConnected ? this.mqtt.emit('publish', 'Production', production) : false; return true; } catch (error) { - throw new Error(`Requesting production error: ${error.message || error}`); + throw new Error(`Update production error: ${error.message || error}`); }; }; @@ -2481,7 +2481,7 @@ class EnvoyDevice extends EventEmitter { const mqtt = this.mqttConnected ? this.mqtt.emit('publish', 'Production CT', productionCtData) : false; return true; } catch (error) { - throw new Error(`Requesting production ct error: ${error.message || error}`); + throw new Error(`Update production ct error: ${error.message || error}`); }; }; @@ -2539,7 +2539,7 @@ class EnvoyDevice extends EventEmitter { const mqtt = this.mqttConnected ? this.mqtt.emit('publish', 'Power Mode', powerProductionState) : false; return true; } catch (error) { - throw new Error(`Requesting power production state error: ${error.message || error}`); + throw new Error(`Update power production state error: ${error.message || error}`); }; }; @@ -2774,7 +2774,7 @@ class EnvoyDevice extends EventEmitter { const mqtt = this.mqttConnected ? this.mqtt.emit('publish', 'Ensemble Inventory', ensembleInventory) : false; return true; } catch (error) { - throw new Error(`Requesting ensemble inventory error: ${error.message || error}`); + throw new Error(`Update ensemble inventory error: ${error.message || error}`); }; }; @@ -3098,7 +3098,7 @@ class EnvoyDevice extends EventEmitter { const mqtt = this.mqttConnected ? this.mqtt.emit('publish', 'Ensemble Status', ensembleStatus) : false; return true; } catch (error) { - throw new Error(`Requesting ensemble status error: ${error.message || error}`); + throw new Error(`Update ensemble status error: ${error.message || error}`); }; }; @@ -3150,7 +3150,7 @@ class EnvoyDevice extends EventEmitter { const mqtt = this.mqttConnected ? this.mqtt.emit('publish', 'Encharge Settings', enchargeSettings) : false; return true; } catch (error) { - throw new Error(`Requesting encharge settings. error: ${error.message || error}`); + throw new Error(`Update encharge settings. error: ${error.message || error}`); }; }; @@ -3347,7 +3347,7 @@ class EnvoyDevice extends EventEmitter { const mqtt = this.mqttConnected ? this.mqtt.emit('publish', 'Tariff', tariffSettings) : false; return true; } catch (error) { - throw new Error(`Requesting tariff. error: ${error.message || error}`); + throw new Error(`Update tariff. error: ${error.message || error}`); }; }; @@ -3405,7 +3405,7 @@ class EnvoyDevice extends EventEmitter { const mqtt = this.mqttConnected ? this.mqtt.emit('publish', 'Dry Contacts', ensembleDryContacts) : false; return true; } catch (error) { - throw new Error(`Requesting dry contacts error: ${error.message || error}`); + throw new Error(`Update dry contacts error: ${error.message || error}`); }; }; @@ -3470,7 +3470,7 @@ class EnvoyDevice extends EventEmitter { const mqtt = this.mqttConnected ? this.mqtt.emit('publish', 'Dry Contacts Settings', ensembleDryContactsSettings) : false; return true; } catch (error) { - throw new Error(`Requesting dry contacts settings error: ${error.message || error}`); + throw new Error(`Update dry contacts settings error: ${error.message || error}`); }; }; @@ -3599,7 +3599,7 @@ class EnvoyDevice extends EventEmitter { const mqtt = this.mqttConnected ? this.mqtt.emit('publish', 'Generator', ensembleGenerator) : false; return true; } catch (error) { - throw new Error(`Requesting generator error: ${error.message || error}`); + throw new Error(`Update generator error: ${error.message || error}`); }; }; @@ -3647,7 +3647,7 @@ class EnvoyDevice extends EventEmitter { const mqtt = this.mqttConnected ? this.mqtt.emit('publish', 'Generator Settings', generatorSettings) : false; return true; } catch (error) { - throw new Error(`Requesting generator settings error: ${error.message || error}`); + throw new Error(`Update generator settings error: ${error.message || error}`); }; }; @@ -3756,7 +3756,7 @@ class EnvoyDevice extends EventEmitter { const mqtt = this.mqttConnected ? this.mqtt.emit('publish', 'PLC Level', plcLevel) : false; return true; } catch (error) { - throw new Error(`Requesting plc level error: ${error.message || error}`); + throw new Error(`Update plc level error: ${error.message || error}`); }; }; @@ -3942,7 +3942,7 @@ class EnvoyDevice extends EventEmitter { const mqtt = this.mqttConnected ? this.mqtt.emit('publish', 'Live Data', live) : false; return true; } catch (error) { - throw new Error(`Requesting live data error: ${error.message || error}`); + throw new Error(`Update live data error: ${error.message || error}`); }; }; @@ -4145,7 +4145,7 @@ class EnvoyDevice extends EventEmitter { const debug = this.enableDebugMode ? this.emit('debug', `Live data stream enable:`, response.data) : false; return; } catch (error) { - throw new Error(`Requesting live data stream enable error: ${error.message || error}`); + throw new Error(`Set live data stream enable error: ${error.message || error}`); }; }; @@ -4276,7 +4276,8 @@ class EnvoyDevice extends EventEmitter { .setCharacteristic(Characteristic.Manufacturer, 'Enphase') .setCharacteristic(Characteristic.Model, this.pv.envoy.modelName ?? 'Model Name') .setCharacteristic(Characteristic.SerialNumber, this.pv.envoy.serialNumber ?? 'Serial Number') - .setCharacteristic(Characteristic.FirmwareRevision, this.pv.envoy.software.replace(/[a-zA-Z]/g, '') ?? '0'); + .setCharacteristic(Characteristic.FirmwareRevision, this.pv.envoy.software.replace(/[a-zA-Z]/g, '') ?? '0') + .setCharacteristic(Characteristic.ConfiguredName, accessoryName); //system and envoy if (envoyInstalled) {