Skip to content

Commit

Permalink
add setting for more log output
Browse files Browse the repository at this point in the history
  • Loading branch information
adcrafter27 committed Nov 12, 2021
1 parent 17e658f commit 4628469
Show file tree
Hide file tree
Showing 6 changed files with 150 additions and 26 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

## ioBroker.envertech-pv

You can read Data from Envertech.com Web
You can read PV Data from www.envertecportal.com Web

## Manual find Station ID

Expand All @@ -28,6 +28,9 @@ Diese zahlen und Buchstaben Kombination müsst ihr unter den Einstellungen im Ad


## Changelog
## 0.0.8
* (adcrafter27) add setting for more log output

## 0.0.7
* (adcrafter27) add more functions

Expand Down
94 changes: 94 additions & 0 deletions admin/index_m.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
<html>

<head>

<!-- Load ioBroker scripts and styles-->
<link rel="stylesheet" type="text/css" href="../../css/adapter.css" />
<link rel="stylesheet" type="text/css" href="../../lib/css/materialize.css">

<script type="text/javascript" src="../../lib/js/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="../../socket.io/socket.io.js"></script>

<script type="text/javascript" src="../../js/translate.js"></script>
<script type="text/javascript" src="../../lib/js/materialize.js"></script>
<script type="text/javascript" src="../../js/adapter-settings.js"></script>

<!-- Load our own files -->
<link rel="stylesheet" type="text/css" href="style.css" />
<script type="text/javascript" src="words.js"></script>

<script type="text/javascript">
// This will be called by the admin adapter when the settings page loads
function load(settings, onChange) {
// example: select elements with id=key and class=value and insert value
if (!settings) return;<html>

<head>

<!-- Load ioBroker scripts and styles-->
Expand Down Expand Up @@ -61,6 +84,77 @@

</head>

<body>

<div class="m adapter-container">

<div class="row">
<div class="col s12 m4 l2">
<img src="envertech.png" class="logo">
</div>
</div>

<!-- Put your content here -->

<!-- For example columns with settings: -->

<div class="col s6 input-field">
<input type="text" class="value" id="station_id" />
<label for="station_id" class="translate">station id</label>
</div>

<div class="row">
<div class="col s6 input-field">
<input type="checkbox" class="value" id="morelogoutput" />
<label for="morelogoutput" class="translate">erweiterte log ausgaben</label>
</div>

</div>

</div>

</body>

</html>
$('.value').each(function () {
var $key = $(this);
var id = $key.attr('id');
if ($key.attr('type') === 'checkbox') {
// do not call onChange direct, because onChange could expect some arguments
$key.prop('checked', settings[id])
.on('change', () => onChange())
;
} else {
// do not call onChange direct, because onChange could expect some arguments
$key.val(settings[id])
.on('change', () => onChange())
.on('keyup', () => onChange())
;
}
});
onChange(false);
// reinitialize all the Materialize labels on the page if you are dynamically adding inputs:
if (M) M.updateTextFields();
}

// This will be called by the admin adapter when the user presses the save button
function save(callback) {
// example: select elements with class=value and build settings object
var obj = {};
$('.value').each(function () {
var $this = $(this);
if ($this.attr('type') === 'checkbox') {
obj[$this.attr('id')] = $this.prop('checked');
} else {
obj[$this.attr('id')] = $this.val();
}
});
callback(obj);
}
</script>

</head>

<body>

<div class="m adapter-container">
Expand Down
5 changes: 5 additions & 0 deletions admin/words.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,10 @@ systemDictionary = {
'en': 'station id',
'ru': 'station id',
'de': 'station id'
},
'morelogoutput': {
'en': 'more log output',
'ru': 'more log output',
'de': 'erweiterte log ausgaben'
}
};
33 changes: 19 additions & 14 deletions io-package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"common": {
"name": "envertech-pv",
"connectionType" : "cloud",
"version": "0.0.7",
"connectionType": "cloud",
"version": "0.0.8",
"news": {
"0.0.7": {
"en": "add more functions",
"de": "Weitere Funktionen hinzufügen"
"0.0.8": {
"en": "add setting for more log output",
"de": "einstellung für erweiterte log ausgaben hinzugefügt"
}
},
"title": "envertech-pv",
Expand All @@ -15,22 +15,29 @@
"de": "envertech-pv"
},
"desc": {
"en": "adapter to read Data from Envertech.com",
"de": "Adapter um Werte von Envertech.com zu laden"
"en": "adapter to read Data from www.envertecportal.com",
"de": "Adapter um Werte von www.envertecportal.com zu laden"
},
"authors": [
"adcrafter27 <[email protected]>"
],
"keywords": [
"ioBroker",
"Envertech",
"Envertech.com",
"Envertec",
"envertecportal.com",
"envertecportal",
"Envertec.com",
"Smart Home",
"home automation",
"mikroinverter",
"evt360",
"EVB202",
"EVB201",
"evt560",
"evt300"
"evt300",
"evt720",
"evt300",
"evt360"
],
"license": "MIT",
"platform": "Javascript/Node.js",
Expand All @@ -47,15 +54,13 @@
"dataSource": "poll",
"compact": true,
"materialize": true,

"dependencies": [
{
"js-controller": ">=1.4.2"
}
],
"installedFrom": "https://github.com/adcrafter27/ioBroker.envertech-pv/tarball/9d7aaba7cf545dc2b5f9f4815d6a808c88530a95"
},
"native": {
"installedFrom": "adcrafter27/ioBroker.envertech-pv#17e658f9aed59c663da796229b2783f1aaf93c7a"
},
"native": {},
"objects": []
}
20 changes: 15 additions & 5 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ class envertech_pv extends utils.Adapter {
var mppt_online = 0;
var mppt_offline = 0;

this.log.info('Loading envertech-pv');
if (this.config.morelogoutput) {
this.log.info('Loading envertech-pv');
}
if (this.config.station_id){

self.setObjectNotExists("data.info.last-data-received", {
Expand Down Expand Up @@ -116,11 +118,15 @@ class envertech_pv extends utils.Adapter {
},

(error, response, content) => {
self.log.info('request station done');
if (this.config.morelogoutput) {
self.log.info('request station done');
}

if (response) {
if (!error && response.statusCode == 200) {
self.log.info('station data ok');
if (this.config.morelogoutput) {
self.log.info('station data ok');
}
for (var key in content.Data){
const obj = content.Data[key];
//self.log.info(key);
Expand Down Expand Up @@ -168,12 +174,16 @@ class envertech_pv extends utils.Adapter {
timeout: 4500
},
(error, response, content) => {
self.log.info('request data done');
if (this.config.morelogoutput) {
self.log.info('request data done');
}

if (response) {
//self.log.info('received data (' + response.statusCode + '): ' + JSON.stringify(content));
if (!error && response.statusCode == 200) {
self.log.info('data ok');
if (this.config.morelogoutput) {
self.log.info('data ok');
}
const unitList = {
DCVOLTAGE: 'V',
ACVOLTAGE: 'V',
Expand Down
19 changes: 13 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"_from": "https://github.com/adcrafter27/ioBroker.envertech-pv/tarball/9d7aaba7cf545dc2b5f9f4815d6a808c88530a95",
"_id": "[email protected].7",
"_id": "[email protected].8",
"_inBundle": false,
"_integrity": "sha512-HUe+UuR5o198mMbesJG3aCySgXrwOQvaYm2TV0ax5HOo4CSPGncaaceUi/J+XM0YQ34PmsOSan3PJh++tviXEg==",
"_location": "/iobroker.envertech-pv",
Expand Down Expand Up @@ -33,7 +33,7 @@
"@iobroker/adapter-core": "^2.3.1",
"request": "^2.88.2"
},
"description": "Read Envertech.com Web data",
"description": "Read www.envertecportal.com Web data",
"devDependencies": {
"@iobroker/testing": "^2.2.0",
"@types/chai": "^4.2.11",
Expand All @@ -58,13 +58,20 @@
"keywords": [
"ioBroker",
"Envertech",
"Envertech.com",
"Envertec",
"envertecportal.com",
"envertecportal",
"Envertec.com",
"Smart Home",
"home automation",
"mikroinverter",
"evt360",
"EVB202",
"EVB201",
"evt560",
"evt300"
"evt300",
"evt720",
"evt300",
"evt360"
],
"license": "MIT",
"main": "main.js",
Expand All @@ -82,5 +89,5 @@
"test:unit": "mocha test/unit --exit",
"test": "node node_modules/mocha/bin/mocha --exit"
},
"version": "0.0.7"
"version": "0.0.8"
}

0 comments on commit 4628469

Please sign in to comment.