Skip to content

Commit

Permalink
(simatec) X1-Min G4 added
Browse files Browse the repository at this point in the history
  • Loading branch information
simatec committed Jun 27, 2024
1 parent d20d73a commit 7406a09
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 41 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ When the adapter crashes or an other Code error happens, this error message that

## Changelog
<!-- ### __WORK IN PROGRESS__ -->
### __WORK IN PROGRESS__
* (simatec) Dependencies updated
* (simatec) X1-Mini G4 added

### 0.9.7 (2024-06-19)
* (simatec) Cloud-URL updated
* (simatec) Dependencies updated
Expand Down
2 changes: 1 addition & 1 deletion lib/createObjects.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ const specialObjects = {
'type': 'state',
'common': {
'name': 'json data',
'type': 'json',
'type': 'string',
'role': 'state',
'read': true,
'write': false
Expand Down
24 changes: 23 additions & 1 deletion lib/inverterData.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 22 additions & 4 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ const _inverterType = {
15: 'X1-Hybrid-G4',
16: 'X3-MIC/PRO-G2',
17: 'X1-SPT',
18: 'X1-Boost/Mini-G4',
18: 'X1-Boost',
19: 'A1-HYB-G2',
20: 'A1-AC-G2',
21: 'A1-SMT-G2',
22: 'X3-FTH',
22: 'X1-Mini-G4',
23: 'X3-MGA-G2'
};

Expand Down Expand Up @@ -544,6 +544,10 @@ async function requestLocalAPI(root_dataPoints, information_dataPoints, data_dat
case 15:
type = 6;
break;
case 18:
case 22:
type = 8;
break;
default:
type = 1;
break;
Expand Down Expand Up @@ -573,7 +577,13 @@ async function requestLocalAPI(root_dataPoints, information_dataPoints, data_dat
data = data * dataPoint.multiplier;
}

if ((type == 1 && key == '68') || (type == 3 && key == '18') || (type == 4 && key == '19') || (type == 2 && key == '10') || (type == 5 && key == '21') || (type == 6 && key == '10')) {
if ((type == 1 && key == '68') ||
(type == 3 && key == '18') ||
(type == 4 && key == '19') ||
(type == 2 && key == '10') ||
(type == 5 && key == '21') ||
(type == 6 && key == '10') ||
(type == 8 && key == '10')) {
data = data !== undefined ? _inverterStateLocal[data] : 'Offline';
}

Expand Down Expand Up @@ -658,12 +668,20 @@ async function resetValues(data_dataPoints) {
5: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 72, 74, 76, 78,],
6: [0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 14, 15, 16, 17, 18, 32, 34, 36],
7: [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 26, 80],
8: [0, 1, 2, 3, 4, 5, 8, 9, 10, 13, 14, 21, 73, 74, 76],
};

for (const value of valuesOfReset[type]) {
const dataPoint = data_dataPoints[type][value];

if ((type == 1 && value == '68') || (type == 3 && value == '18') || (type == 4 && value == '19') || (type == 2 && value == '10') || (type == 5 && value == '21') || (type == 6 && value == '10') || (type == 7 && value == '0')) {
if ((type == 1 && value == '68') ||
(type == 3 && value == '18') ||
(type == 4 && value == '19') ||
(type == 2 && value == '10') ||
(type == 5 && value == '21') ||
(type == 6 && value == '10') ||
(type == 7 && value == '0') ||
(type == 8 && value == '10')) {
await setDataPoint(dataPoint, 'Offline');
} else if (value != 8) {
await setDataPoint(dataPoint, 0);
Expand Down
73 changes: 41 additions & 32 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
},
"devDependencies": {
"@alcalzone/release-script": "^3.7.0",
"@alcalzone/release-script-plugin-iobroker": "^3.7.1",
"@alcalzone/release-script-plugin-iobroker": "^3.7.2",
"@alcalzone/release-script-plugin-license": "^3.7.0",
"@iobroker/testing": "^4.1.3",
"@iobroker/adapter-dev": "^1.3.0",
"chai": "^4.3.10",
"eslint": "^9.5.0",
"mocha": "^10.4.0",
"mocha": "^10.5.2",
"sinon": "^18.0.0",
"sinon-chai": "^3.7.0",
"chai-as-promised": "^7.1.2"
Expand All @@ -52,7 +52,8 @@
"release-major": "release-script major --yes",
"translate": "translate-adapter",
"dev-server-run": "dev-server run solax",
"dev-server-watch": "dev-server watch solax"
"dev-server-watch": "dev-server watch solax",
"update": "npm update"
},
"bugs": {
"url": "https://github.com/simatec/ioBroker.solax/issues"
Expand Down

0 comments on commit 7406a09

Please sign in to comment.