diff --git a/README.md b/README.md index 53f4f49..03bf572 100644 --- a/README.md +++ b/README.md @@ -475,7 +475,9 @@ MODIFIED ADAPTER SETTINGS - do not re-use settings stored in json-file! * \[E605\]: updated copyright to 2024 in README.md * \[E605\]: removed .npmignore from project directory * \[W040\]: added keyword "ioBroker" in package.json - * \[W130\]: deleted all but some recent common.news in io-packege.json + * \[W130\]: deleted all but some recent common.news in io-package.json + * \[S522\]: migrated to admin5 UI (jsonConfig.json5) + ### 1.2.6 diff --git a/admin/jsonConfig.json5 b/admin/jsonConfig.json5 new file mode 100644 index 0000000..5d5c06b --- /dev/null +++ b/admin/jsonConfig.json5 @@ -0,0 +1,151 @@ +{ + "type": "tabs", + "i18n": true, + "items": { + "Tab_Options": { + "type": "panel", + "label": "options", + "items": { + "title_connection": { + "newLine": true, + "type": "header", + "text": "title_connection", + "size": 2 + }, + "portal_user": { + "type": "text", + "label": "portal_user", + "newLine": true, + "xs": 12, "sm": 6, "md": 3, "lg": 3 + }, + "portal_password": { + "type": "password", + "label": "portal_password", + "xs": 12, "sm": 6, "md": 3, "lg": 3 + }, + "e3dc_ip": { + "type": "text", + "label": "e3dc_ip", + "newLine": true, + "xs": 12, "sm": 6, "md": 3, "lg": 3 + }, + "e3dc_port": { + "type": "port", + "label": "e3dc_port", + "xs": 12, "sm": 6, "md": 3, "lg": 3 + }, + "rscp_password": { + "type": "password", + "label": "rscp_password", + "xs": 12, "sm": 6, "md": 3, "lg": 3 + }, + "title_intervals": { + "newLine": true, + "type": "header", + "text": "title_intervals", + "size": 2 + }, + "setpower_interval": { + "type": "number", + "label": "setpower_interval", + "min": 0, + "xs": 12, "sm": 6, "md": 3, "lg": 3 + }, + "send_tuple_delay": { + "type": "number", + "label": "send_tuple_delay", + "min": 0, + "xs": 12, "sm": 6, "md": 3, "lg": 3 + }, + "title_namespaces": { + "newLine": true, + "type": "header", + "text": "title_namespaces", + "size": 2 + }, + "query_bat": { + "type": "checkbox", + "label": "query_bat", + "xs": 12, "sm": 12,"md": 6, "lg": 3 + }, + "query_ems": { + "type": "checkbox", + "label": "query_ems", + "xs": 12, "sm": 12,"md": 6, "lg": 3 + }, + "query_ep": { + "type": "checkbox", + "label": "query_ep", + "xs": 12, "sm": 12,"md": 6, "lg": 3 + }, + "query_pvi": { + "type": "checkbox", + "label": "query_pvi", + "xs": 12, "sm": 12,"md": 6, "lg": 3 + }, + "query_sys": { + "type": "checkbox", + "label": "query_sys", + "xs": 12, "sm": 12,"md": 6, "lg": 3 + }, + "query_wb": { + "type": "checkbox", + "label": "query_wb", + "xs": 12, "sm": 12,"md": 6, "lg": 3 + }, + "query_db": { + "type": "checkbox", + "label": "query_db", + "xs": 12, "sm": 12,"md": 6, "lg": 3 + }, + "query_info": { + "type": "checkbox", + "label": "query_info", + "xs": 12, "sm": 12,"md": 6, "lg": 3 + } + } + }, + "Tab_Polling_Intervals": { + "type": "panel", + "label": "polling_intervals", + "noDelete": true, + "items": { + "title_polling_intervals": { + "newLine": true, + "type": "header", + "text": "title_polling_intervals", + "size": 2 + }, + "polling_intervals": { + "type": "table", + "label": "", + "xs": 12, "sm": 12,"md": 12, "lg": 9, + "items": [ + { + "type": "text", + "attr": "tag", + "width": "80% ", + "title": "column_tag", + "filter": true, + "sort": true, + "readOnly": true, + "default": "" + }, + { + "type": "text", + "attr": "interval", + "width": "20% ", + "title": "column_interval", + "tooltip": "S/M/L/N", + "filter": false, + "sort": false, + "default": "L", + "validator": "return (data.intervall==='') || data.interval.match(/^[SMLN]$/);", + "validatorNoSaveOnError": true + } + ] + } + } + } + } +} \ No newline at end of file diff --git a/io-package.json b/io-package.json index cb19e77..bf72bd4 100644 --- a/io-package.json +++ b/io-package.json @@ -166,8 +166,9 @@ "compact": true, "connectionType": "local", "dataSource": "poll", - "materialize": true, - "materializeTab": false, + "adminUI": { + "config": "json" + }, "dependencies": [ { "js-controller": ">=5.0.19" @@ -179,6 +180,14 @@ } } }, + "protectedNative": [ + "rscp_password", + "portal_password" + ], + "encryptedNative": [ + "rscp_password", + "portal_password" + ], "native": { "e3dc_ip": "192.168.178.1", "e3dc_port": 5033, @@ -909,15 +918,15 @@ "polling_interval_long": 12, "setpower_interval": 10, "send_tuple_delay": 10, - "query_bat": "true", - "query_ems": "true", - "query_pm": "true", - "query_ep": "true", - "query_pvi": "true", - "query_sys": "true", - "query_wb": "true", - "query_info": "true", - "query_db": "true" + "query_bat": true, + "query_ems": true, + "query_pm": true, + "query_ep": true, + "query_pvi": true, + "query_sys": true, + "query_wb": true, + "query_info": true, + "query_db": true }, "objects": [], "instanceObjects": [] diff --git a/main.js b/main.js index cfc07bd..372001a 100644 --- a/main.js +++ b/main.js @@ -1726,15 +1726,6 @@ class E3dcRscp extends utils.Adapter { } } - // ioBroker best practice for password encryption, using key native.secret - decryptPassword( key="", value="" ) { - let result = ""; - for ( let i = 0; i < value.length; ++i ) { - result += String.fromCharCode( key[i % key.length].charCodeAt( 0 ) ^ value.charCodeAt( i ) ); - } - return result; - } - clearAllIntervals() { if( this.dataPollingTimerS ) clearInterval( this.dataPollingTimerS ); if( this.dataPollingTimerM ) clearInterval( this.dataPollingTimerM ); @@ -2110,16 +2101,7 @@ class E3dcRscp extends utils.Adapter { // Initialize your adapter here this.log.debug( `config.*: (${this.config.e3dc_ip}, ${this.config.e3dc_port}, ${this.config.portal_user}, ${this.config.polling_interval_short}, ${this.config.polling_interval_medium}, ${this.config.polling_interval_long}, ${this.config.setpower_interval})` ); - // @ts-ignore - this.getForeignObject( "system.config", ( err, obj ) => { - if ( obj && obj.native && obj.native.secret ) { - this.config.rscp_password = this.decryptPassword( obj.native.secret,this.config.rscp_password ); - this.config.portal_password = this.decryptPassword( obj.native.secret,this.config.portal_password ); - this.initChannel(); - } else { - this.log.error( "Cannot initialize adapter because obj.native.secret is null." ); - } - } ); + this.initChannel(); // In order to get state updates, you need to subscribe to them. The following line adds a subscription for our variable we have created above. this.subscribeStates( "RSCP.AUTHENTICATION" );