├── .eslintignore ├── admin ├── ve.png ├── ve_original.png ├── buymeacoffee.png ├── i18n │ ├── zh-cn │ │ └── translations.json │ ├── en │ │ └── translations.json │ ├── de │ │ └── translations.json │ ├── nl │ │ └── translations.json │ ├── es │ │ └── translations.json │ ├── pl │ │ └── translations.json │ ├── fr │ │ └── translations.json │ ├── it │ │ └── translations.json │ ├── pt │ │ └── translations.json │ ├── uk │ │ └── translations.json │ └── ru │ │ └── translations.json └── jsonConfig.json ├── .vscode ├── extensions.json └── settings.json ├── lib ├── img │ └── 00_configuration.png └── adapter-config.d.ts ├── register ├── ve.register.victronenergy.json.TEST ├── ve.register.victronenergy.v2.js └── ve.register.victronenergy.js ├── test ├── tsconfig.json ├── package.js ├── mocharc.custom.json ├── integration.js └── mocha.setup.js ├── tsconfig.check.json ├── .gitignore ├── .github ├── dependabot.yml ├── auto-merge.yml ├── ISSUE_TEMPLATE │ └── bug_report.md └── workflows │ ├── dependabot-auto-merge.yml │ └── test-and-release.yml ├── .eslintrc.json ├── main.test.js ├── .create-adapter.json ├── tsconfig.json ├── package.json ├── LICENSE ├── io-package.json ├── README.md └── main.js /.eslintignore: -------------------------------------------------------------------------------- 1 | **/.eslintrc.js -------------------------------------------------------------------------------- /admin/ve.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/derAlff/ioBroker.ve/HEAD/admin/ve.png -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "dbaeumer.vscode-eslint" 4 | ] 5 | } -------------------------------------------------------------------------------- /admin/ve_original.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/derAlff/ioBroker.ve/HEAD/admin/ve_original.png -------------------------------------------------------------------------------- /admin/buymeacoffee.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/derAlff/ioBroker.ve/HEAD/admin/buymeacoffee.png -------------------------------------------------------------------------------- /lib/img/00_configuration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/derAlff/ioBroker.ve/HEAD/lib/img/00_configuration.png -------------------------------------------------------------------------------- /register/ve.register.victronenergy.json.TEST: -------------------------------------------------------------------------------- 1 | { 2 | "/Serial": { 3 | "Register": 3902, 4 | "Type": "", 5 | "Length": "string[7]", 6 | "Factor": "" 7 | } 8 | } -------------------------------------------------------------------------------- /test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "noImplicitAny": false 5 | }, 6 | "include": [ 7 | "./**/*.js" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /test/package.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | const { tests } = require("@iobroker/testing"); 3 | 4 | // Validate the package files 5 | tests.packageFiles(path.join(__dirname, "..")); 6 | -------------------------------------------------------------------------------- /test/mocharc.custom.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": [ 3 | "test/mocha.setup.js" 4 | ], 5 | "watch-files": [ 6 | "!(node_modules|test)/**/*.test.js", 7 | "*.test.js", 8 | "test/**/test!(PackageFiles|Startup).js" 9 | ] 10 | } -------------------------------------------------------------------------------- /tsconfig.check.json: -------------------------------------------------------------------------------- 1 | // Specialized tsconfig for type-checking js files 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": {}, 5 | "include": [ 6 | "**/*.js", 7 | "**/*.d.ts" 8 | ], 9 | "exclude": [ 10 | "**/build", 11 | "node_modules/", 12 | "widgets/" 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # No dot-directories except github/vscode 2 | .*/ 3 | !.vscode/ 4 | !.github/ 5 | 6 | *.code-workspace 7 | node_modules 8 | nbproject 9 | 10 | # npm package files 11 | iobroker.*.tgz 12 | 13 | Thumbs.db 14 | 15 | # i18n intermediate files 16 | admin/i18n/flat.txt 17 | admin/i18n/*/flat.txt -------------------------------------------------------------------------------- /test/integration.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | const { tests } = require("@iobroker/testing"); 3 | 4 | // Run integration tests - See https://github.com/ioBroker/testing for a detailed explanation and further options 5 | tests.integration(path.join(__dirname, ".."),{ 6 | //allowedExitCodes: [6] 7 | }); -------------------------------------------------------------------------------- /admin/i18n/zh-cn/translations.json: -------------------------------------------------------------------------------- 1 | { 2 | "ve adapter settings": "ve 的适配器设置", 3 | "IP-Address": "IP地址", 4 | "Port": "港口", 5 | "Interval": "间隔", 6 | "Use MQTT": "使用 MQTT", 7 | "Count of PV-Inverters": "Count of PV-Inverters", 8 | "DC system available": "可用直流系统", 9 | "Enable": "使能够", 10 | "Device": "设备", 11 | "Device-ID": "设备ID" 12 | } 13 | -------------------------------------------------------------------------------- /admin/i18n/en/translations.json: -------------------------------------------------------------------------------- 1 | { 2 | "ve adapter settings": "Adapter settings for ve", 3 | "IP-Address": "IP-Address", 4 | "Port": "Port", 5 | "Interval": "Interval", 6 | "Use MQTT": "Use MQTT", 7 | "Count of PV-Inverters": "Count of PV-Inverters", 8 | "DC system available": "DC system available", 9 | "Enable":"Enable", 10 | "Device": "Device", 11 | "Device-ID": "Device-ID" 12 | } -------------------------------------------------------------------------------- /admin/i18n/de/translations.json: -------------------------------------------------------------------------------- 1 | { 2 | "ve adapter settings": "Adaptereinstellungen für ve", 3 | "IP-Address": "IP Adresse", 4 | "Port": "Port", 5 | "Interval": "Intervall", 6 | "Use MQTT": "MQTT verwenden", 7 | "Count of PV-Inverters": "Anzahl PV-Wechselrichter", 8 | "DC system available": "DC System installiert", 9 | "Enable": "Aktivieren", 10 | "Device": "Gerät", 11 | "Device-ID": "Geräte ID" 12 | } 13 | -------------------------------------------------------------------------------- /admin/i18n/nl/translations.json: -------------------------------------------------------------------------------- 1 | { 2 | "ve adapter settings": "Adapterinstellingen voor ve", 3 | "IP-Address": "IP adres", 4 | "Port": "Haven", 5 | "Interval": "Interval", 6 | "Use MQTT": "Gebruik MQTT", 7 | "Count of PV-Inverters": "Count of PV-Inverters", 8 | "DC system available": "DC-systeem beschikbaar", 9 | "Enable": "Inschakelen", 10 | "Device": "Apparaat", 11 | "Device-ID": "Apparaat ID" 12 | } 13 | -------------------------------------------------------------------------------- /test/mocha.setup.js: -------------------------------------------------------------------------------- 1 | // Don't silently swallow unhandled rejections 2 | process.on("unhandledRejection", (e) => { 3 | throw e; 4 | }); 5 | 6 | // enable the should interface with sinon 7 | // and load chai-as-promised and sinon-chai by default 8 | const sinonChai = require("sinon-chai"); 9 | const chaiAsPromised = require("chai-as-promised"); 10 | const { should, use } = require("chai"); 11 | 12 | should(); 13 | use(sinonChai); 14 | use(chaiAsPromised); -------------------------------------------------------------------------------- /admin/i18n/es/translations.json: -------------------------------------------------------------------------------- 1 | { 2 | "ve adapter settings": "Ajustes del adaptador para ve", 3 | "IP-Address": "Dirección IP", 4 | "Port": "Puerto", 5 | "Interval": "Intervalo", 6 | "Use MQTT": "Usar MQTT", 7 | "Count of PV-Inverters": "Count of PV-Inverters", 8 | "DC system available": "Sistema de CC disponible", 9 | "Enable": "Permitir", 10 | "Device": "Dispositivo", 11 | "Device-ID": "ID del dispositivo" 12 | } 13 | -------------------------------------------------------------------------------- /admin/i18n/pl/translations.json: -------------------------------------------------------------------------------- 1 | { 2 | "ve adapter settings": "Ustawienia adaptera dla ve", 3 | "IP-Address": "Adres IP", 4 | "Port": "Port", 5 | "Interval": "Interwał", 6 | "Use MQTT": "Użyj MQTT", 7 | "Count of PV-Inverters": "Count of PV-Inverters", 8 | "DC system available": "Dostępny system prądu stałego", 9 | "Enable": "Włączać", 10 | "Device": "Urządzenie", 11 | "Device-ID": "Identyfikator urzadzenia" 12 | } 13 | -------------------------------------------------------------------------------- /admin/i18n/fr/translations.json: -------------------------------------------------------------------------------- 1 | { 2 | "ve adapter settings": "Paramètres de l'adaptateur pour ve", 3 | "IP-Address": "Adresse IP", 4 | "Port": "Port", 5 | "Interval": "Intervalle", 6 | "Use MQTT": "Utiliser MQTT", 7 | "Count of PV-Inverters": "Count of PV-Inverters", 8 | "DC system available": "Système CC disponible", 9 | "Enable": "Activer", 10 | "Device": "Appareil", 11 | "Device-ID": "Reference de l'appareil" 12 | } 13 | -------------------------------------------------------------------------------- /admin/i18n/it/translations.json: -------------------------------------------------------------------------------- 1 | { 2 | "ve adapter settings": "Impostazioni dell'adattatore per ve", 3 | "IP-Address": "Indirizzo IP", 4 | "Port": "Porta", 5 | "Interval": "Intervallo", 6 | "Use MQTT": "Usa MQTT", 7 | "Count of PV-Inverters": "Count of PV-Inverters", 8 | "DC system available": "Sistema CC disponibile", 9 | "Enable": "Abilitare", 10 | "Device": "Dispositivo", 11 | "Device-ID": "ID del dispositivo" 12 | } 13 | -------------------------------------------------------------------------------- /admin/i18n/pt/translations.json: -------------------------------------------------------------------------------- 1 | { 2 | "ve adapter settings": "Configurações do adaptador para ve", 3 | "IP-Address": "Endereço de IP", 4 | "Port": "Porta", 5 | "Interval": "Intervalo", 6 | "Use MQTT": "Usar MQTT", 7 | "Count of PV-Inverters": "Count of PV-Inverters", 8 | "DC system available": "Sistema DC disponível", 9 | "Enable": "Habilitar", 10 | "Device": "Dispositivo", 11 | "Device-ID": "ID de dispositivo" 12 | } 13 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "eslint.enable": true, 3 | "json.schemas": [ 4 | { 5 | "fileMatch": [ 6 | "io-package.json" 7 | ], 8 | "url": "https://json.schemastore.org/io-package" 9 | }, 10 | { 11 | "fileMatch": [ 12 | "admin/jsonConfig.json", 13 | "admin/jsonCustom.json", 14 | "admin/jsonTab.json" 15 | ], 16 | "url": "https://raw.githubusercontent.com/ioBroker/adapter-react-v5/main/schemas/jsonConfig.json" 17 | } 18 | ] 19 | } -------------------------------------------------------------------------------- /admin/i18n/uk/translations.json: -------------------------------------------------------------------------------- 1 | { 2 | "ve adapter settings": "Налаштування адаптера для ve", 3 | "IP-Address": "IP-адреса", 4 | "Port": "Порт", 5 | "Interval": "Інтервал", 6 | "Use MQTT": "Використовуйте MQTT", 7 | "Count of PV-Inverters": "Count of PV-Inverters", 8 | "DC system available": "Доступна система постійного струму", 9 | "Enable": "Увімкнути", 10 | "Device": "пристрій", 11 | "Device-ID": "Ідентифікатор пристрою" 12 | } 13 | -------------------------------------------------------------------------------- /admin/i18n/ru/translations.json: -------------------------------------------------------------------------------- 1 | { 2 | "ve adapter settings": "Настройки адаптера для ve", 3 | "IP-Address": "Айпи адрес", 4 | "Port": "Порт", 5 | "Interval": "Интервал", 6 | "Use MQTT": "Используйте MQTT", 7 | "Count of PV-Inverters": "Count of PV-Inverters", 8 | "DC system available": "Доступна система постоянного тока", 9 | "Enable": "Давать возможность", 10 | "Device": "Устройство", 11 | "Device-ID": "Идентификатор устройства" 12 | } 13 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: npm 4 | directory: "/" 5 | schedule: 6 | interval: monthly 7 | time: "04:00" 8 | timezone: Europe/Berlin 9 | open-pull-requests-limit: 5 10 | assignees: 11 | - derAlff 12 | versioning-strategy: increase 13 | 14 | - package-ecosystem: github-actions 15 | directory: "/" 16 | schedule: 17 | interval: monthly 18 | time: "04:00" 19 | timezone: Europe/Berlin 20 | open-pull-requests-limit: 5 21 | assignees: 22 | - derAlff 23 | -------------------------------------------------------------------------------- /lib/adapter-config.d.ts: -------------------------------------------------------------------------------- 1 | // This file extends the AdapterConfig type from "@types/iobroker" 2 | // using the actual properties present in io-package.json 3 | // in order to provide typings for adapter.config properties 4 | 5 | import { native } from "../io-package.json"; 6 | 7 | type _AdapterConfig = typeof native; 8 | 9 | // Augment the globally declared type ioBroker.AdapterConfig 10 | declare global { 11 | namespace ioBroker { 12 | interface AdapterConfig extends _AdapterConfig { 13 | // Do not enter anything here! 14 | } 15 | } 16 | } 17 | 18 | // this is required so the above AdapterConfig is found by TypeScript / type checking 19 | export {}; -------------------------------------------------------------------------------- /.github/auto-merge.yml: -------------------------------------------------------------------------------- 1 | # Configure here which dependency updates should be merged automatically. 2 | # The recommended configuration is the following: 3 | - match: 4 | # Only merge patches for production dependencies 5 | dependency_type: production 6 | update_type: "semver:patch" 7 | - match: 8 | # Except for security fixes, here we allow minor patches 9 | dependency_type: production 10 | update_type: "security:minor" 11 | - match: 12 | # and development dependencies can have a minor update, too 13 | dependency_type: development 14 | update_type: "semver:minor" 15 | 16 | # The syntax is based on the legacy dependabot v1 automerged_updates syntax, see: 17 | # https://dependabot.com/docs/config-file/#automerged_updates 18 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "env": { 4 | "es6": true, 5 | "node": true, 6 | "mocha": true 7 | }, 8 | "extends": [ 9 | "eslint:recommended" 10 | ], 11 | "plugins": [], 12 | "rules": { 13 | "indent": [ 14 | "off", 15 | "tab", 16 | { 17 | "SwitchCase": 1 18 | } 19 | ], 20 | "no-console": "off", 21 | "no-unused-vars": [ 22 | "error", 23 | { 24 | "ignoreRestSiblings": true, 25 | "argsIgnorePattern": "^_" 26 | } 27 | ], 28 | "no-var": "error", 29 | "no-trailing-spaces": "error", 30 | "prefer-const": "error", 31 | "quotes": [ 32 | "error", 33 | "double", 34 | { 35 | "avoidEscape": true, 36 | "allowTemplateLiterals": true 37 | } 38 | ], 39 | "semi": [ 40 | "error", 41 | "always" 42 | ] 43 | }, 44 | "parserOptions": { 45 | "ecmaVersion": 2020 46 | } 47 | } -------------------------------------------------------------------------------- /main.test.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | /** 4 | * This is a dummy TypeScript test file using chai and mocha 5 | * 6 | * It's automatically excluded from npm and its build output is excluded from both git and npm. 7 | * It is advised to test all your modules with accompanying *.test.js-files 8 | */ 9 | 10 | // tslint:disable:no-unused-expression 11 | 12 | const { expect } = require("chai"); 13 | // import { functionToTest } from "./moduleToTest"; 14 | 15 | describe("module to test => function to test", () => { 16 | // initializing logic 17 | const expected = 5; 18 | 19 | it(`should return ${expected}`, () => { 20 | const result = 5; 21 | // assign result a value from functionToTest 22 | expect(result).to.equal(expected); 23 | // or using the should() syntax 24 | result.should.equal(expected); 25 | }); 26 | // ... more tests => it 27 | 28 | }); 29 | 30 | // ... more test suites => describe 31 | -------------------------------------------------------------------------------- /.create-adapter.json: -------------------------------------------------------------------------------- 1 | { 2 | "cli": true, 3 | "target": "directory", 4 | "adapterName": "ve", 5 | "title": "Victron Energy", 6 | "expert": "no", 7 | "features": [ 8 | "adapter" 9 | ], 10 | "adminFeatures": [], 11 | "type": "iot-systems", 12 | "startMode": "daemon", 13 | "connectionType": "local", 14 | "dataSource": "poll", 15 | "connectionIndicator": "no", 16 | "language": "JavaScript", 17 | "nodeVersion": "14", 18 | "adminUi": "json", 19 | "tools": [ 20 | "ESLint", 21 | "type checking" 22 | ], 23 | "releaseScript": "no", 24 | "devServer": "yes", 25 | "devServerPort": 8081, 26 | "indentation": "Tab", 27 | "quotes": "double", 28 | "es6class": "yes", 29 | "authorName": "derAlff", 30 | "authorGithub": "derAlff", 31 | "authorEmail": "deralff@gmail.com", 32 | "gitRemoteProtocol": "HTTPS", 33 | "gitCommit": "no", 34 | "defaultBranch": "main", 35 | "license": "GNU GPLv3", 36 | "dependabot": "yes", 37 | "creatorVersion": "2.3.0" 38 | } -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Something is not working as it should 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | --- 8 | 9 | **Describe the bug** 10 | A clear and concise description of what the bug is. 11 | 12 | **To Reproduce** 13 | Steps to reproduce the behavior: 14 | 1. Go to '...' 15 | 2. Click on '...' 16 | 3. Scroll down to '....' 17 | 4. See error 18 | 19 | **Expected behavior** 20 | A clear and concise description of what you expected to happen. 21 | 22 | **Screenshots & Logfiles** 23 | If applicable, add screenshots and logfiles to help explain your problem. 24 | 25 | **Versions:** 26 | - Adapter version: 27 | - JS-Controller version: 28 | - Node version: 29 | - Operating system: 30 | 31 | **Additional context** 32 | Add any other context about the problem here. 33 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | // Root tsconfig to set the settings and power editor support for all TS files 2 | { 3 | // To update the compilation target, install a different version of @tsconfig/node... and reference it here 4 | // https://github.com/tsconfig/bases#node-14-tsconfigjson 5 | "extends": "@tsconfig/node14/tsconfig.json", 6 | "compilerOptions": { 7 | // do not compile anything, this file is just to configure type checking 8 | "noEmit": true, 9 | 10 | // check JS files 11 | "allowJs": true, 12 | "checkJs": true, 13 | 14 | // This is necessary for the automatic typing of the adapter config 15 | "resolveJsonModule": true, 16 | 17 | // If you want to disable the stricter type checks (not recommended), uncomment the following line 18 | // "strict": false, 19 | // And enable some of those features for more fine-grained control 20 | // "strictNullChecks": true, 21 | // "strictPropertyInitialization": true, 22 | // "strictBindCallApply": true, 23 | "noImplicitAny": false, 24 | // "noUnusedLocals": true, 25 | // "noUnusedParameters": true, 26 | "useUnknownInCatchVariables": false, 27 | "esModuleInterop": true 28 | }, 29 | "include": [ 30 | "**/*.js", 31 | "**/*.d.ts" 32 | ], 33 | "exclude": [ 34 | "node_modules/**", 35 | "widgets/**" 36 | ] 37 | } -------------------------------------------------------------------------------- /.github/workflows/dependabot-auto-merge.yml: -------------------------------------------------------------------------------- 1 | # Automatically merge Dependabot PRs when version comparison is within the range 2 | # that is configured in .github/auto-merge.yml 3 | 4 | name: Auto-Merge Dependabot PRs 5 | 6 | on: 7 | # WARNING: This needs to be run in the PR base, DO NOT build untrusted code in this action 8 | # details under https://github.blog/changelog/2021-02-19-github-actions-workflows-triggered-by-dependabot-prs-will-run-with-read-only-permissions/ 9 | pull_request_target: 10 | 11 | jobs: 12 | auto-merge: 13 | if: github.actor == 'dependabot[bot]' 14 | runs-on: ubuntu-latest 15 | steps: 16 | - name: Checkout code 17 | uses: actions/checkout@v2 18 | 19 | - name: Check if PR should be auto-merged 20 | uses: ahmadnassri/action-dependabot-auto-merge@v2 21 | with: 22 | # In order to use this, you need to go to https://github.com/settings/tokens and 23 | # create a Personal Access Token with the permission "public_repo". 24 | # Enter this token in your repository settings under "Secrets" and name it AUTO_MERGE_TOKEN 25 | github-token: ${{ secrets.AUTO_MERGE_TOKEN }} 26 | # By default, squash and merge, so Github chooses nice commit messages 27 | command: squash and merge 28 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "iobroker.ve", 3 | "version": "0.3.1", 4 | "description": "ve", 5 | "author": { 6 | "name": "derAlff", 7 | "email": "deralff@gmail.com" 8 | }, 9 | "homepage": "https://github.com/derAlff/ioBroker.ve", 10 | "license": "CC BY-NC 4.0", 11 | "keywords": [ 12 | "ioBroker", 13 | "template", 14 | "Smart Home", 15 | "home automation" 16 | ], 17 | "repository": { 18 | "type": "git", 19 | "url": "https://github.com/derAlff/ioBroker.ve.git" 20 | }, 21 | "engines": { 22 | "node": ">=18", 23 | "npm":">=10" 24 | }, 25 | "dependencies": { 26 | "@iobroker/adapter-core": "^2.6.7", 27 | "fs": "^0.0.1-security", 28 | "modbus-serial": "8.0.9" 29 | }, 30 | "devDependencies": { 31 | "@iobroker/adapter-dev": "^1.2.0", 32 | "@iobroker/testing": "^4.1.0", 33 | "@tsconfig/node14": "^1.0.3", 34 | "@types/chai": "^4.3.4", 35 | "@types/chai-as-promised": "^7.1.5", 36 | "@types/mocha": "^10.0.1", 37 | "@types/node": "^14.18.37", 38 | "@types/proxyquire": "^1.3.28", 39 | "@types/sinon": "^10.0.13", 40 | "@types/sinon-chai": "^3.2.9", 41 | "chai": "^4.3.7", 42 | "chai-as-promised": "^7.1.1", 43 | "eslint": "^8.41.0", 44 | "mocha": "^9.2.2", 45 | "proxyquire": "^2.1.3", 46 | "sinon": "^13.0.2", 47 | "sinon-chai": "^3.7.0", 48 | "typescript": "~4.6.4" 49 | }, 50 | "main": "main.js", 51 | "files": [ 52 | "admin{,/!(src)/**}/!(tsconfig|tsconfig.*|.eslintrc).json", 53 | "admin{,/!(src)/**}/*.{html,css,png,svg,jpg,js}", 54 | "lib/", 55 | "www/", 56 | "io-package.json", 57 | "LICENSE", 58 | "main.js", 59 | "register/" 60 | ], 61 | "scripts": { 62 | "test:js": "mocha --config test/mocharc.custom.json \"{!(node_modules|test)/**/*.test.js,*.test.js,test/**/test!(PackageFiles|Startup).js}\"", 63 | "test:package": "mocha test/package --exit", 64 | "test:integration": "mocha test/integration --exit", 65 | "test": "npm run test:js && npm run test:package", 66 | "check": "tsc --noEmit -p tsconfig.check.json", 67 | "lint": "eslint .", 68 | "lint:fix": "eslint . --fix", 69 | "translate": "translate-adapter" 70 | }, 71 | "bugs": { 72 | "url": "https://github.com/derAlff/ioBroker.ve/issues" 73 | }, 74 | "readmeFilename": "README.md" 75 | } 76 | -------------------------------------------------------------------------------- /.github/workflows/test-and-release.yml: -------------------------------------------------------------------------------- 1 | name: Test and Release 2 | 3 | # Run this job on all pushes and pull requests 4 | # as well as tags with a semantic version 5 | on: 6 | push: 7 | branches: 8 | - "main" 9 | tags: 10 | # normal versions 11 | - "v[0-9]+.[0-9]+.[0-9]+" 12 | # pre-releases 13 | - "v[0-9]+.[0-9]+.[0-9]+-**" 14 | pull_request: {} 15 | 16 | # Cancel previous PR/branch runs when a new commit is pushed 17 | concurrency: 18 | group: ${{ github.ref }} 19 | cancel-in-progress: true 20 | 21 | jobs: 22 | # Performs quick checks before the expensive test runs 23 | check-and-lint: 24 | if: contains(github.event.head_commit.message, '[skip ci]') == false 25 | 26 | runs-on: ubuntu-latest 27 | 28 | steps: 29 | - uses: ioBroker/testing-action-check@v1 30 | with: 31 | node-version: 18.x 32 | # Uncomment the following line if your adapter cannot be installed using 'npm ci' 33 | # install-command: 'npm install' 34 | lint: true 35 | 36 | # Runs adapter tests on all supported node versions and OSes 37 | adapter-tests: 38 | if: contains(github.event.head_commit.message, '[skip ci]') == false 39 | 40 | runs-on: ${{ matrix.os }} 41 | strategy: 42 | matrix: 43 | node-version: [18.x] 44 | os: [ubuntu-latest] 45 | 46 | steps: 47 | - uses: ioBroker/testing-action-adapter@v1 48 | with: 49 | node-version: ${{ matrix.node-version }} 50 | os: ${{ matrix.os }} 51 | # Uncomment the following line if your adapter cannot be installed using 'npm ci' 52 | # install-command: 'npm install' 53 | 54 | # TODO: To enable automatic npm releases, create a token on npmjs.org 55 | # Enter this token as a GitHub secret (with name NPM_TOKEN) in the repository options 56 | # Then uncomment the following block: 57 | 58 | # # Deploys the final package to NPM 59 | # deploy: 60 | # needs: [check-and-lint, adapter-tests] 61 | # 62 | # # Trigger this step only when a commit on any branch is tagged with a version number 63 | # if: | 64 | # contains(github.event.head_commit.message, '[skip ci]') == false && 65 | # github.event_name == 'push' && 66 | # startsWith(github.ref, 'refs/tags/v') 67 | # 68 | # runs-on: ubuntu-latest 69 | # 70 | # # Write permissions are required to create Github releases 71 | # permissions: 72 | # contents: write 73 | # 74 | # steps: 75 | # - uses: ioBroker/testing-action-deploy@v1 76 | # with: 77 | # node-version: '16.x' 78 | # # Uncomment the following line if your adapter cannot be installed using 'npm ci' 79 | # # install-command: 'npm install' 80 | # npm-token: ${{ secrets.NPM_TOKEN }} 81 | # github-token: ${{ secrets.GITHUB_TOKEN }} 82 | # 83 | # # When using Sentry for error reporting, Sentry can be informed about new releases 84 | # # To enable create a API-Token in Sentry (User settings, API keys) 85 | # # Enter this token as a GitHub secret (with name SENTRY_AUTH_TOKEN) in the repository options 86 | # # Then uncomment and customize the following block: 87 | # sentry: true 88 | # sentry-token: ${{ secrets.SENTRY_AUTH_TOKEN }} 89 | # sentry-project: "iobroker-ve" 90 | # sentry-version-prefix: "iobroker.ve" 91 | # # If your sentry project is linked to a GitHub repository, you can enable the following option 92 | # # sentry-github-integration: true 93 | -------------------------------------------------------------------------------- /admin/jsonConfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "i18n": true, 3 | "type": "tabs", 4 | "items": { 5 | "main":{ 6 | "type": "panel", 7 | "label": "Main", 8 | "items": { 9 | "victronIp": { 10 | "type": "text", 11 | "sm": 12, 12 | "md": 6, 13 | "lg": 6, 14 | "label": "IP-Address", 15 | "help": "IP-Address of VictronEnergy GX devcice" 16 | }, 17 | "victronPort": { 18 | "type": "number", 19 | "min": 1, 20 | "max": 65535, 21 | "sm": 12, 22 | "md": 6, 23 | "lg": 6, 24 | "label": "Port", 25 | "help": "Network port of VictronEnergy GX devcice (at the moment only Modbus!)" 26 | }, 27 | "numOfPvInverters":{ 28 | "type": "number", 29 | "min": 0, 30 | "max": 10, 31 | "sm": 12, 32 | "md": 6, 33 | "lg": 6, 34 | "label": "Count of PV-Inverters", 35 | "help": "Number of connected PV-Inverters (i.e. 3 SMA STP-10000TL-10 via Modbus)" 36 | }, 37 | "fetchInterval": { 38 | "type": "number", 39 | "min": 5000, 40 | "max": 3600000, 41 | "sm": 12, 42 | "md": 6, 43 | "lg": 6, 44 | "label": "Interval", 45 | "help": "Interval to receive data from Victron Energy GX device (in Milliseconds!)" 46 | }, 47 | "useMqtt": { 48 | "type": "checkbox", 49 | "label": "Use MQTT", 50 | "help": "Use MQTT as protocol instead of Modbus", 51 | "newLine": false 52 | }, 53 | "dcSystemAvailable":{ 54 | "type": "checkbox", 55 | "label": "DC system available", 56 | "help": "Check, when you have DC MPPT installed", 57 | "newLine": true 58 | }, 59 | "_buyMeACoffee": { 60 | "newLine": true, 61 | "type": "staticImage", 62 | "sm": 12, 63 | "md": 6, 64 | "lg": 3, 65 | "href": "https://www.buymeacoffee.com/deralffiot", 66 | "src": "buymeacoffee.png" 67 | } 68 | } 69 | }, 70 | "mppts": { 71 | "type": "panel", 72 | "label": "MPPT & SmartSolar", 73 | "items": { 74 | "mppts": { 75 | "type": "table", 76 | "sm": 10, 77 | "md": 10, 78 | "lg": 10, 79 | "label": "MPPT & SmartSolar", 80 | "items": [ 81 | { 82 | "type": "checkbox", 83 | "attr": "enabled", 84 | "width": "5%", 85 | "title": "Enable", 86 | "filter": false, 87 | "sort": false, 88 | "default": false 89 | }, 90 | { 91 | "type": "checkbox", 92 | "attr": "vedirect", 93 | "width": "5%", 94 | "title": "VE.Direct", 95 | "filter": false, 96 | "sort": false, 97 | "default": false 98 | }, 99 | { 100 | "type": "checkbox", 101 | "attr": "ethernet", 102 | "width": "5%", 103 | "title": "Ethernet", 104 | "filter": false, 105 | "sort": false, 106 | "default": false 107 | }, 108 | { 109 | "type": "text", 110 | "attr": "device", 111 | "width": "50%", 112 | "title": "Device", 113 | "filter": true, 114 | "sort": true, 115 | "default": "" 116 | }, 117 | { 118 | "type": "number", 119 | "min": 0, 120 | "max": 999, 121 | "step": 1, 122 | "attr": "id", 123 | "width": "15%", 124 | "title": "Device-ID", 125 | "filter": true, 126 | "sort": true, 127 | "default": 100 128 | }, 129 | { 130 | "type": "text", 131 | "attr": "ipaddress", 132 | "width": "20%", 133 | "title": "IP-Address", 134 | "filter": true, 135 | "sort": true, 136 | "default": "" 137 | } 138 | ] 139 | } 140 | } 141 | } 142 | } 143 | } -------------------------------------------------------------------------------- /register/ve.register.victronenergy.v2.js: -------------------------------------------------------------------------------- 1 | function getRegisters() { 2 | return { 3 | Version: "2.0.0", 4 | GXDevice:{ 5 | Id: "100", 6 | ActiveInputSource: { 7 | RegisterName: "ActiveInputSource", 8 | Register: 826, 9 | Id: 100, 10 | Length: 1, 11 | Unit: "", 12 | Factor: 0, 13 | Type: "uint16", 14 | writable: false 15 | }, 16 | AcConsumptionL1Power: { 17 | RegisterName: "AcConsumptionL1Power", 18 | Register: 817, 19 | Id: 100, 20 | Length: 1, 21 | Unit: "W", 22 | Factor: 1, 23 | Type: "uint16", 24 | writable: false 25 | }, 26 | AcConsumptionL2Power: { 27 | RegisterName: "AcConsumptionL2Power", 28 | Register: 818, 29 | Id: 100, 30 | Length: 1, 31 | Unit: "W", 32 | Factor: 1, 33 | Type: "uint16", 34 | writable: false 35 | }, 36 | AcConsumptionL3Power: { 37 | RegisterName: "AcConsumptionL3Power", 38 | Register: 819, 39 | Id: 100, 40 | Length: 1, 41 | Unit: "W", 42 | Factor: 1, 43 | Type: "uint16", 44 | writable: false 45 | }, 46 | DCCoupledPower: { 47 | RegisterName: "DCCoupledPower", 48 | Register: 850, 49 | Id: 100, 50 | Length: 1, 51 | Unit: "kWh", 52 | Factor: 1, 53 | Type: "uint16", 54 | writable: false 55 | }, 56 | GridL1Power: { 57 | RegisterName: "GridL1Power", 58 | Register: 820, 59 | Id: 100, 60 | Length: 1, 61 | Unit: "W", 62 | Factor: 1, 63 | Type: "int16", 64 | writable: false 65 | }, 66 | GridL2Power: { 67 | RegisterName: "GridL2Power", 68 | Register: 821, 69 | Id: 100, 70 | Length: 1, 71 | Unit: "W", 72 | Factor: 1, 73 | Type: "int16", 74 | writable: false 75 | }, 76 | GridL3Power: { 77 | RegisterName: "GridL3Power", 78 | Register: 822, 79 | Id: 100, 80 | Length: 1, 81 | Unit: "W", 82 | Factor: 1, 83 | Type: "int16", 84 | writable: false 85 | }, 86 | /* 87 | BatteryVoltage_System: { 88 | RegisterName: "BatteryVoltage_System", 89 | Register: 840, 90 | Id: 100, 91 | Length: 1, 92 | Unit: "V", 93 | Factor: 0.1, 94 | Type: "uint16", 95 | writable: false 96 | }, 97 | BatteryCurrent_System: { 98 | RegisterName: "BatteryCurrent_System", 99 | Register: 841, 100 | Id: 100, 101 | Length: 1, 102 | Unit: "A", 103 | Factor: 0.1, 104 | Type: "int16", 105 | writable: false 106 | }, 107 | BatteryPower_System: { 108 | RegisterName: "BatteryPower_System", 109 | Register: 842, 110 | Id: 100, 111 | Length: 1, 112 | Unit: "W", 113 | Factor: 1, 114 | Type: "int16", 115 | writable: false 116 | }, 117 | BatterySOC_System: { 118 | RegisterName: "BatterySOC_System", 119 | Register: 843, 120 | Id: 100, 121 | Length: 1, 122 | Unit: "%", 123 | Factor: 1, 124 | Type: "uint16", 125 | writable: false 126 | }, 127 | BatteryState_System: { 128 | RegisterName: "BatteryState_System", 129 | Register: 844, 130 | Id: 100, 131 | Length: 1, 132 | Unit: "", 133 | Factor: 1, 134 | Type: "uint16", 135 | writable: false 136 | }, 137 | /* 138 | Battery: { 139 | RegisterName: "Battery", 140 | Register: 1288, 141 | Id: 100, 142 | Length: 1, 143 | Unit: "", 144 | Factor: 1, 145 | Type: "uint16", 146 | writable: false 147 | }, 148 | */ 149 | }, 150 | 151 | Battery:{ 152 | Id: "255", 153 | BatteryVoltage: { 154 | RegisterName: "BatteryVoltage", 155 | Register: 259, 156 | Id: 225, 157 | Length: 1, 158 | Unit: "V", 159 | Factor: 0.01, 160 | Type: "uint16", 161 | writable: false 162 | }, 163 | BatteryCurrent: { 164 | RegisterName: "BatteryCurrent", 165 | Register: 261, 166 | Id: 225, 167 | Length: 1, 168 | Unit: "A", 169 | Factor: 0.1, 170 | Type: "int16", 171 | writable: false 172 | }, 173 | BatteryTemperature: { 174 | RegisterName: "BatteryTemperature", 175 | Register: 262, 176 | Id: 225, 177 | Length: 1, 178 | Unit: "°C", 179 | Factor: 0.1, 180 | Type: "int16", 181 | writable: false 182 | }, 183 | BatteryMidpointVoltageOfTheBatteryBank: { 184 | RegisterName: "BatteryMitpointVoltageOfTheBatteryBank", 185 | Register: 263, 186 | Id: 225, 187 | Length: 1, 188 | Unit: "V", 189 | Factor: 0.01, 190 | Type: "uint16", 191 | writable: false 192 | }, 193 | BatteryMidpointDevaitionOfTheBatteryBank: { 194 | RegisterName: "BatteryMidpointDevaitionOfTheBatteryBank", 195 | Register: 264, 196 | Id: 225, 197 | Length: 1, 198 | Unit: "%", 199 | Factor: 0.01, 200 | Type: "uint16", 201 | writable: false 202 | }, 203 | BatteryConsumedAmphours: { 204 | RegisterName: "BatteryConsumedAmphours", 205 | Register: 265, 206 | Id: 225, 207 | Length: 1, 208 | Unit: "Ah", 209 | Factor: -0.1, 210 | Type: "uint16", 211 | writable: false 212 | }, 213 | BatterySOC: { 214 | RegisterName: "BatterySOC", 215 | Register: 266, 216 | Id: 225, 217 | Length: 1, 218 | Unit: "%", 219 | Factor: 0.1, 220 | Type: "uint16", 221 | writable: false 222 | }, 223 | BatteryCapacity: { 224 | RegisterName: "BatteryCapacity", 225 | Register: 309, 226 | Id: 225, 227 | Length: 1, 228 | Unit: "Ah", 229 | Factor: 0.1, 230 | Type: "uint16", 231 | writable: false 232 | }, 233 | BatteryCellMinVoltage: { 234 | RegisterName: "BatteryCellMinVoltage", 235 | Register: 1290, 236 | Id: 225, 237 | Length: 1, 238 | Unit: "V", 239 | Factor: 0.01, 240 | Type: "uint16", 241 | writable: false 242 | }, 243 | BatteryCellMaxVoltage: { 244 | RegisterName: "BatteryCellMaxVoltage", 245 | Register: 1291, 246 | Id: 225, 247 | Length: 1, 248 | Unit: "V", 249 | Factor: 0.01, 250 | Type: "uint16", 251 | writable: false 252 | } 253 | // shutdowns due to error 254 | , 255 | BatteryShutdownsDueToError: { 256 | RegisterName: "BatteryShutdownsDueToError", 257 | Register: 1292, 258 | Id: 225, 259 | Length: 1, 260 | Unit: "", 261 | Factor: 0, 262 | Type: "uint16", 263 | writable: false 264 | } 265 | // 1st last error 266 | , 267 | Battery1stLastError: { 268 | RegisterName: "Battery1stLastError", 269 | Register: 1293, 270 | Id: 225, 271 | Length: 1, 272 | Unit: "", 273 | Factor: 0, 274 | Type: "uint16", 275 | writable: false 276 | } 277 | , 278 | Battery2ndLastError: { 279 | RegisterName: "Battery2ndLastError", 280 | Register: 1293, 281 | Id: 225, 282 | Length: 1, 283 | Unit: "", 284 | Factor: 0, 285 | Type: "uint16", 286 | writable: false 287 | } 288 | , 289 | Battery3rdLastError: { 290 | RegisterName: "Battery3rdLastError", 291 | Register: 1293, 292 | Id: 225, 293 | Length: 1, 294 | Unit: "", 295 | Factor: 0, 296 | Type: "uint16", 297 | writable: false 298 | } 299 | , 300 | Battery4thLastError: { 301 | RegisterName: "Battery4thLastError", 302 | Register: 1293, 303 | Id: 225, 304 | Length: 1, 305 | Unit: "", 306 | Factor: 0, 307 | Type: "uint16", 308 | writable: false 309 | }, 310 | }, 311 | 312 | Inverter:{ 313 | Id: ">= 20", 314 | Registers: { 315 | InverterL1Power: { 316 | RegisterName: "InverterL1Power", 317 | Register: 1029, 318 | Id: 20, 319 | Length: 1, 320 | Unit: "W", 321 | Factor: 1, 322 | Type: "uint16", 323 | writable: false 324 | }, 325 | InverterL2Power: { 326 | RegisterName: "InverterL2Power", 327 | Register: 1033, 328 | Id: 20, 329 | Length: 1, 330 | Unit: "W", 331 | Factor: 1, 332 | Type: "uint16", 333 | writable: false 334 | }, 335 | InverterL3Power: { 336 | RegisterName: "InverterL3Power", 337 | Register: 1037, 338 | Id: 20, 339 | Length: 1, 340 | Unit: "W", 341 | Factor: 1, 342 | Type: "uint16", 343 | writable: false 344 | }, 345 | InverterL1Current: { 346 | RegisterName: "InverterL1Current", 347 | Register: 1028, 348 | Id: 20, 349 | Length: 1, 350 | Unit: "A", 351 | Factor: 0.1, 352 | Type: "uint16", 353 | writable: false 354 | }, 355 | InverterL2Current: { 356 | RegisterName: "InverterL2Current", 357 | Register: 1032, 358 | Id: 20, 359 | Length: 1, 360 | Unit: "A", 361 | Factor: 0.1, 362 | Type: "uint16", 363 | writable: false 364 | }, 365 | InverterL3Current: { 366 | RegisterName: "InverterL3Current", 367 | Register: 1036, 368 | Id: 20, 369 | Length: 1, 370 | Unit: "A", 371 | Factor: 0.1, 372 | Type: "uint16", 373 | writable: false 374 | }, 375 | InverterTotalPower: { 376 | RegisterName: "InverterTotalPower", 377 | Register: 1052, 378 | Id: 20, 379 | Length: 1, 380 | Unit: "kW", 381 | Factor: 0.1, 382 | Type: "int32", 383 | writable: false 384 | } 385 | } 386 | }, 387 | 388 | GridMeter:{ 389 | Id: "30", 390 | GridL1Voltage: { 391 | RegisterName: "GridL1Voltage", 392 | Register: 2616, 393 | Id: 30, 394 | Length: 1, 395 | Unit: "V", 396 | Factor: 0.1, 397 | Type: "uint16", 398 | writable: false 399 | }, 400 | GridL2Voltage: { 401 | RegisterName: "GridL2Voltage", 402 | Register: 2618, 403 | Id: 30, 404 | Length: 1, 405 | Unit: "V", 406 | Factor: 0.1, 407 | Type: "uint16", 408 | writable: false 409 | }, 410 | GridL3Voltage: { 411 | RegisterName: "GridL3Voltage", 412 | Register: 2620, 413 | Id: 30, 414 | Length: 1, 415 | Unit: "V", 416 | Factor: 0.1, 417 | Type: "uint16", 418 | writable: false 419 | }, 420 | GridL1Current: { 421 | RegisterName: "GridL1Current", 422 | Register: 2617, 423 | Id: 30, 424 | Length: 1, 425 | Unit: "A", 426 | Factor: 0.1, 427 | Type: "int16", 428 | writable: false 429 | }, 430 | GridL2Current: { 431 | RegisterName: "GridL2Current", 432 | Register: 2619, 433 | Id: 30, 434 | Length: 1, 435 | Unit: "A", 436 | Factor: 0.1, 437 | Type: "int16", 438 | writable: false 439 | }, 440 | GridL3Current: { 441 | RegisterName: "GridL3Current", 442 | Register: 2621, 443 | Id: 30, 444 | Length: 1, 445 | Unit: "A", 446 | Factor: 0.1, 447 | Type: "int16", 448 | writable: false 449 | }, 450 | GridL1EnergyFromNet: { 451 | RegisterName: "GridL1EnergyFromNet", 452 | Register: 2603, 453 | Id: 30, 454 | Length: 1, 455 | Unit: "kWh", 456 | Factor: 0.01, 457 | Type: "uint16", 458 | writable: false 459 | }, 460 | GridL2EnergyFromNet: { 461 | RegisterName: "GridL2EnergyFromNet", 462 | Register: 2604, 463 | Id: 30, 464 | Length: 1, 465 | Unit: "kWh", 466 | Factor: 0.01, 467 | Type: "uint16", 468 | writable: false 469 | }, 470 | GridL3EnergyFromNet: { 471 | RegisterName: "GridL3EnergyFromNet", 472 | Register: 2605, 473 | Id: 30, 474 | Length: 1, 475 | Unit: "kWh", 476 | Factor: 0.01, 477 | Type: "uint16", 478 | writable: false 479 | }, 480 | GridL1EnergyToNet: { 481 | RegisterName: "GridL1EnergyToNet", 482 | Register: 2606, 483 | Id: 30, 484 | Length: 1, 485 | Unit: "kWh", 486 | Factor: 0.01, 487 | Type: "uint16", 488 | writable: false 489 | }, 490 | GridL2EnergyToNet: { 491 | RegisterName: "GridL2EnergyToNet", 492 | Register: 2607, 493 | Id: 30, 494 | Length: 1, 495 | Unit: "kWh", 496 | Factor: 0.01, 497 | Type: "uint16", 498 | writable: false 499 | }, 500 | GridL3EnergyToNet: { 501 | RegisterName: "GridL3EnergyToNet", 502 | Register: 2608, 503 | Id: 30, 504 | Length: 1, 505 | Unit: "kWh", 506 | Factor: 0.01, 507 | Type: "uint16", 508 | writable: false 509 | }, 510 | }, 511 | 512 | DCSystem:{ 513 | Id: "", 514 | /* 515 | DCSystemBatteryVoltage: { 516 | RegisterName: "DCSystemBatteryVoltage", 517 | Register: 4400, 518 | Id: 229, 519 | Length: 1, 520 | Unit: "V", 521 | Factor: 0.01, 522 | Type: "uint16", 523 | writable: false 524 | },*/ 525 | }, 526 | }; 527 | } 528 | 529 | module.exports = { getRegisters }; 530 | 531 | -------------------------------------------------------------------------------- /register/ve.register.victronenergy.js: -------------------------------------------------------------------------------- 1 | function getRegisters() { 2 | return { 3 | ActiveInputSource: { 4 | RegisterName: "ActiveInputSource", 5 | Register: 826, 6 | Id: 100, 7 | Length: 1, 8 | Unit: "", 9 | Factor: 0, 10 | Type: "uint16", 11 | writable: false 12 | }, 13 | AcConsumptionL1Power: { 14 | RegisterName: "AcConsumptionL1Power", 15 | Register: 817, 16 | Id: 100, 17 | Length: 1, 18 | Unit: "W", 19 | Factor: 1, 20 | Type: "uint16", 21 | writable: false 22 | }, 23 | AcConsumptionL2Power: { 24 | RegisterName: "AcConsumptionL2Power", 25 | Register: 818, 26 | Id: 100, 27 | Length: 1, 28 | Unit: "W", 29 | Factor: 1, 30 | Type: "uint16", 31 | writable: false 32 | }, 33 | AcConsumptionL3Power: { 34 | RegisterName: "AcConsumptionL3Power", 35 | Register: 819, 36 | Id: 100, 37 | Length: 1, 38 | Unit: "W", 39 | Factor: 1, 40 | Type: "uint16", 41 | writable: false 42 | }, 43 | DCCoupledPower: { 44 | RegisterName: "DCCoupledPower", 45 | Register: 850, 46 | Id: 100, 47 | Length: 1, 48 | Unit: "kWh", 49 | Factor: 1, 50 | Type: "uint16", 51 | writable: false 52 | }, 53 | GridL1Power: { 54 | RegisterName: "GridL1Power", 55 | Register: 820, 56 | Id: 100, 57 | Length: 1, 58 | Unit: "W", 59 | Factor: 1, 60 | Type: "int16", 61 | writable: false 62 | }, 63 | GridL2Power: { 64 | RegisterName: "GridL2Power", 65 | Register: 821, 66 | Id: 100, 67 | Length: 1, 68 | Unit: "W", 69 | Factor: 1, 70 | Type: "int16", 71 | writable: false 72 | }, 73 | GridL3Power: { 74 | RegisterName: "GridL3Power", 75 | Register: 822, 76 | Id: 100, 77 | Length: 1, 78 | Unit: "W", 79 | Factor: 1, 80 | Type: "int16", 81 | writable: false 82 | }, 83 | BatteryVoltage: { 84 | RegisterName: "BatteryVoltage", 85 | Register: 259, 86 | Id: 225, 87 | Length: 1, 88 | Unit: "V", 89 | Factor: 0.01, 90 | Type: "uint16", 91 | writable: false 92 | }, 93 | BatteryCurrent: { 94 | RegisterName: "BatteryCurrent", 95 | Register: 261, 96 | Id: 225, 97 | Length: 1, 98 | Unit: "A", 99 | Factor: 0.1, 100 | Type: "int16", 101 | writable: false 102 | }, 103 | BatteryTemperature: { 104 | RegisterName: "BatteryTemperature", 105 | Register: 262, 106 | Id: 225, 107 | Length: 1, 108 | Unit: "°C", 109 | Factor: 0.1, 110 | Type: "int16", 111 | writable: false 112 | }, 113 | BatteryMidpointVoltageOfTheBatteryBank: { 114 | RegisterName: "BatteryMitpointVoltageOfTheBatteryBank", 115 | Register: 263, 116 | Id: 225, 117 | Length: 1, 118 | Unit: "V", 119 | Factor: 0.01, 120 | Type: "uint16", 121 | writable: false 122 | }, 123 | BatteryMidpointDevaitionOfTheBatteryBank: { 124 | RegisterName: "BatteryMidpointDevaitionOfTheBatteryBank", 125 | Register: 264, 126 | Id: 225, 127 | Length: 1, 128 | Unit: "%", 129 | Factor: 0.01, 130 | Type: "uint16", 131 | writable: false 132 | }, 133 | BatteryConsumedAmphours: { 134 | RegisterName: "BatteryConsumedAmphours", 135 | Register: 265, 136 | Id: 225, 137 | Length: 1, 138 | Unit: "Ah", 139 | Factor: -0.1, 140 | Type: "uint16", 141 | writable: false 142 | }, 143 | BatterySOC: { 144 | RegisterName: "BatterySOC", 145 | Register: 266, 146 | Id: 225, 147 | Length: 1, 148 | Unit: "%", 149 | Factor: 0.1, 150 | Type: "uint16", 151 | writable: false 152 | }, 153 | BatteryCapacity: { 154 | RegisterName: "BatteryCapacity", 155 | Register: 309, 156 | Id: 225, 157 | Length: 1, 158 | Unit: "Ah", 159 | Factor: 0.1, 160 | Type: "uint16", 161 | writable: false 162 | }, 163 | BatteryCellMinVoltage: { 164 | RegisterName: "BatteryCellMinVoltage", 165 | Register: 1290, 166 | Id: 225, 167 | Length: 1, 168 | Unit: "V", 169 | Factor: 0.01, 170 | Type: "uint16", 171 | writable: false 172 | }, 173 | BatteryCellMaxVoltage: { 174 | RegisterName: "BatteryCellMaxVoltage", 175 | Register: 1291, 176 | Id: 225, 177 | Length: 1, 178 | Unit: "V", 179 | Factor: 0.01, 180 | Type: "uint16", 181 | writable: false 182 | } 183 | // shutdowns due to error 184 | , 185 | BatteryShutdownsDueToError: { 186 | RegisterName: "BatteryShutdownsDueToError", 187 | Register: 1292, 188 | Id: 225, 189 | Length: 1, 190 | Unit: "", 191 | Factor: 0, 192 | Type: "uint16", 193 | writable: false 194 | } 195 | // 1st last error 196 | , 197 | Battery1stLastError: { 198 | RegisterName: "Battery1stLastError", 199 | Register: 1293, 200 | Id: 225, 201 | Length: 1, 202 | Unit: "", 203 | Factor: 0, 204 | Type: "uint16", 205 | writable: false 206 | } 207 | , 208 | Battery2ndLastError: { 209 | RegisterName: "Battery2ndLastError", 210 | Register: 1293, 211 | Id: 225, 212 | Length: 1, 213 | Unit: "", 214 | Factor: 0, 215 | Type: "uint16", 216 | writable: false 217 | } 218 | , 219 | Battery3rdLastError: { 220 | RegisterName: "Battery3rdLastError", 221 | Register: 1293, 222 | Id: 225, 223 | Length: 1, 224 | Unit: "", 225 | Factor: 0, 226 | Type: "uint16", 227 | writable: false 228 | } 229 | , 230 | Battery4thLastError: { 231 | RegisterName: "Battery4thLastError", 232 | Register: 1293, 233 | Id: 225, 234 | Length: 1, 235 | Unit: "", 236 | Factor: 0, 237 | Type: "uint16", 238 | writable: false 239 | }, 240 | Inverter:{ 241 | Registers: { 242 | InverterL1Power: { 243 | RegisterName: "InverterL1Power", 244 | Register: 1029, 245 | Id: 20, 246 | Length: 1, 247 | Unit: "W", 248 | Factor: 1, 249 | Type: "uint16", 250 | writable: false 251 | }, 252 | InverterL2Power: { 253 | RegisterName: "InverterL2Power", 254 | Register: 1033, 255 | Id: 20, 256 | Length: 1, 257 | Unit: "W", 258 | Factor: 1, 259 | Type: "uint16", 260 | writable: false 261 | }, 262 | InverterL3Power: { 263 | RegisterName: "InverterL3Power", 264 | Register: 1037, 265 | Id: 20, 266 | Length: 1, 267 | Unit: "W", 268 | Factor: 1, 269 | Type: "uint16", 270 | writable: false 271 | }, 272 | InverterL1Current: { 273 | RegisterName: "InverterL1Current", 274 | Register: 1028, 275 | Id: 20, 276 | Length: 1, 277 | Unit: "A", 278 | Factor: 0.1, 279 | Type: "uint16", 280 | writable: false 281 | }, 282 | InverterL2Current: { 283 | RegisterName: "InverterL2Current", 284 | Register: 1032, 285 | Id: 20, 286 | Length: 1, 287 | Unit: "A", 288 | Factor: 0.1, 289 | Type: "uint16", 290 | writable: false 291 | }, 292 | InverterL3Current: { 293 | RegisterName: "InverterL3Current", 294 | Register: 1036, 295 | Id: 20, 296 | Length: 1, 297 | Unit: "A", 298 | Factor: 0.1, 299 | Type: "uint16", 300 | writable: false 301 | }, 302 | InverterTotalPower: { 303 | RegisterName: "InverterTotalPower", 304 | Register: 1052, 305 | Id: 20, 306 | Length: 1, 307 | Unit: "kW", 308 | Factor: 0.1, 309 | Type: "int32", 310 | writable: false 311 | } 312 | } 313 | }, 314 | GridL1Voltage: { 315 | RegisterName: "GridL1Voltage", 316 | Register: 2616, 317 | Id: 30, 318 | Length: 1, 319 | Unit: "V", 320 | Factor: 0.1, 321 | Type: "uint16", 322 | writable: false 323 | }, 324 | GridL2Voltage: { 325 | RegisterName: "GridL2Voltage", 326 | Register: 2618, 327 | Id: 30, 328 | Length: 1, 329 | Unit: "V", 330 | Factor: 0.1, 331 | Type: "uint16", 332 | writable: false 333 | }, 334 | GridL3Voltage: { 335 | RegisterName: "GridL3Voltage", 336 | Register: 2620, 337 | Id: 30, 338 | Length: 1, 339 | Unit: "V", 340 | Factor: 0.1, 341 | Type: "uint16", 342 | writable: false 343 | }, 344 | GridL1Current: { 345 | RegisterName: "GridL1Current", 346 | Register: 2617, 347 | Id: 30, 348 | Length: 1, 349 | Unit: "A", 350 | Factor: 0.1, 351 | Type: "int16", 352 | writable: false 353 | }, 354 | GridL2Current: { 355 | RegisterName: "GridL2Current", 356 | Register: 2619, 357 | Id: 30, 358 | Length: 1, 359 | Unit: "A", 360 | Factor: 0.1, 361 | Type: "int16", 362 | writable: false 363 | }, 364 | GridL3Current: { 365 | RegisterName: "GridL3Current", 366 | Register: 2621, 367 | Id: 30, 368 | Length: 1, 369 | Unit: "A", 370 | Factor: 0.1, 371 | Type: "int16", 372 | writable: false 373 | }, 374 | GridL1EnergyFromNet: { 375 | RegisterName: "GridL1EnergyFromNet", 376 | Register: 2603, 377 | Id: 30, 378 | Length: 1, 379 | Unit: "kWh", 380 | Factor: 0.01, 381 | Type: "uint16", 382 | writable: false 383 | }, 384 | GridL2EnergyFromNet: { 385 | RegisterName: "GridL2EnergyFromNet", 386 | Register: 2604, 387 | Id: 30, 388 | Length: 1, 389 | Unit: "kWh", 390 | Factor: 0.01, 391 | Type: "uint16", 392 | writable: false 393 | }, 394 | GridL3EnergyFromNet: { 395 | RegisterName: "GridL3EnergyFromNet", 396 | Register: 2605, 397 | Id: 30, 398 | Length: 1, 399 | Unit: "kWh", 400 | Factor: 0.01, 401 | Type: "uint16", 402 | writable: false 403 | }, 404 | GridL1EnergyToNet: { 405 | RegisterName: "GridL1EnergyToNet", 406 | Register: 2606, 407 | Id: 30, 408 | Length: 1, 409 | Unit: "kWh", 410 | Factor: 0.01, 411 | Type: "uint16", 412 | writable: false 413 | }, 414 | GridL2EnergyToNet: { 415 | RegisterName: "GridL2EnergyToNet", 416 | Register: 2607, 417 | Id: 30, 418 | Length: 1, 419 | Unit: "kWh", 420 | Factor: 0.01, 421 | Type: "uint16", 422 | writable: false 423 | }, 424 | GridL3EnergyToNet: { 425 | RegisterName: "GridL3EnergyToNet", 426 | Register: 2608, 427 | Id: 30, 428 | Length: 1, 429 | Unit: "kWh", 430 | Factor: 0.01, 431 | Type: "uint16", 432 | writable: false 433 | }, 434 | 435 | /* 436 | DCSystemBatteryVoltage: { 437 | RegisterName: "DCSystemBatteryVoltage", 438 | Register: 4400, 439 | Id: 229, 440 | Length: 1, 441 | Unit: "V", 442 | Factor: 0.01, 443 | Type: "uint16", 444 | writable: false 445 | }, 446 | 447 | BatteryVoltage_System: { 448 | RegisterName: "BatteryVoltage_System", 449 | Register: 840, 450 | Id: 100, 451 | Length: 1, 452 | Unit: "V", 453 | Factor: 0.1, 454 | Type: "uint16", 455 | writable: false 456 | }, 457 | BatteryCurrent_System: { 458 | RegisterName: "BatteryCurrent_System", 459 | Register: 841, 460 | Id: 100, 461 | Length: 1, 462 | Unit: "A", 463 | Factor: 0.1, 464 | Type: "int16", 465 | writable: false 466 | }, 467 | BatteryPower_System: { 468 | RegisterName: "BatteryPower_System", 469 | Register: 842, 470 | Id: 100, 471 | Length: 1, 472 | Unit: "W", 473 | Factor: 1, 474 | Type: "int16", 475 | writable: false 476 | }, 477 | BatterySOC_System: { 478 | RegisterName: "BatterySOC_System", 479 | Register: 843, 480 | Id: 100, 481 | Length: 1, 482 | Unit: "%", 483 | Factor: 1, 484 | Type: "uint16", 485 | writable: false 486 | }, 487 | BatteryState_System: { 488 | RegisterName: "BatteryState_System", 489 | Register: 844, 490 | Id: 100, 491 | Length: 1, 492 | Unit: "", 493 | Factor: 1, 494 | Type: "uint16", 495 | writable: false 496 | }, 497 | /* 498 | Battery: { 499 | RegisterName: "Battery", 500 | Register: 1288, 501 | Id: 100, 502 | Length: 1, 503 | Unit: "", 504 | Factor: 1, 505 | Type: "uint16", 506 | writable: false 507 | }, 508 | */ 509 | }; 510 | } 511 | 512 | module.exports = { getRegisters }; 513 | 514 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Creative Commons Attribution-NonCommercial 4.0 International Public License 2 | 3 | By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions. 4 | 5 | Section 1 – Definitions. 6 | 7 | Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image. 8 | Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License. 9 | Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. 10 | Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements. 11 | Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material. 12 | Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License. 13 | Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license. 14 | Licensor means the individual(s) or entity(ies) granting rights under this Public License. 15 | NonCommercial means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange. 16 | Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them. 17 | Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world. 18 | You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning. 19 | 20 | Section 2 – Scope. 21 | 22 | License grant. 23 | Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to: 24 | reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and 25 | produce, reproduce, and Share Adapted Material for NonCommercial purposes only. 26 | Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions. 27 | Term. The term of this Public License is specified in Section 6(a). 28 | Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material. 29 | Downstream recipients. 30 | Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License. 31 | No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material. 32 | No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i). 33 | 34 | Other rights. 35 | Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise. 36 | Patent and trademark rights are not licensed under this Public License. 37 | To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes. 38 | 39 | Section 3 – License Conditions. 40 | 41 | Your exercise of the Licensed Rights is expressly made subject to the following conditions. 42 | 43 | Attribution. 44 | 45 | If You Share the Licensed Material (including in modified form), You must: 46 | retain the following if it is supplied by the Licensor with the Licensed Material: 47 | identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated); 48 | a copyright notice; 49 | a notice that refers to this Public License; 50 | a notice that refers to the disclaimer of warranties; 51 | a URI or hyperlink to the Licensed Material to the extent reasonably practicable; 52 | indicate if You modified the Licensed Material and retain an indication of any previous modifications; and 53 | indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License. 54 | You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information. 55 | If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable. 56 | If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License. 57 | 58 | Section 4 – Sui Generis Database Rights. 59 | 60 | Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material: 61 | 62 | for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only; 63 | if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and 64 | You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database. 65 | 66 | For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights. 67 | 68 | Section 5 – Disclaimer of Warranties and Limitation of Liability. 69 | 70 | Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You. 71 | To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You. 72 | 73 | The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability. 74 | 75 | Section 6 – Term and Termination. 76 | 77 | This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically. 78 | 79 | Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates: 80 | automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or 81 | upon express reinstatement by the Licensor. 82 | For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License. 83 | For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License. 84 | Sections 1, 5, 6, 7, and 8 survive termination of this Public License. 85 | 86 | Section 7 – Other Terms and Conditions. 87 | 88 | The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed. 89 | Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License. 90 | 91 | Section 8 – Interpretation. 92 | 93 | For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License. 94 | To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions. 95 | No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor. 96 | Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority. 97 | 98 | Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the “Licensor.” The text of the Creative Commons public licenses is dedicated to the public domain under the CC0 Public Domain Dedication. Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at creativecommons.org/policies, Creative Commons does not authorize the use of the trademark “Creative Commons” or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses. 99 | 100 | Creative Commons may be contacted at creativecommons.org. -------------------------------------------------------------------------------- /io-package.json: -------------------------------------------------------------------------------- 1 | { 2 | "common": { 3 | "name": "ve", 4 | "version": "0.3.1", 5 | "news": { 6 | "0.3.1": { 7 | "en": "Fixed testing errors. Translated Admin UI. Updated README.", 8 | "de": "Testfehler behoben. Übersetzte Admin-Benutzeroberfläche. Aktualisierte README-Datei.", 9 | "ru": "Исправлены ошибки тестирования. Переведен интерфейс администратора. Обновлен README.", 10 | "pt": "Erros de teste corrigidos. IU do administrador traduzida. LEIA-ME atualizado.", 11 | "nl": "Vaste testfouten. Vertaalde beheerdersinterface. LEESMIJ bijgewerkt.", 12 | "fr": "Correction des erreurs de test. Interface utilisateur d'administration traduite. LISEZMOI mis à jour.", 13 | "it": "Risolti errori di test. Interfaccia utente di amministrazione tradotta. LEGGIMI aggiornato.", 14 | "es": "Errores de prueba fijos. IU de administración traducida. Léame actualizado.", 15 | "pl": "Naprawiono błędy testowania. Przetłumaczony interfejs administratora. Zaktualizowano plik README.", 16 | "uk": "Виправлені помилки тестування. Перекладений інтерфейс адміністратора. Оновлено README.", 17 | "zh-cn": "修复了测试错误。翻译后的管理用户界面。更新了自述文件。" 18 | }, 19 | "0.3.0": { 20 | "en": "Added writable variable in victron registers.\nAdded register 1052/TotalPower in victron registers.\nAdded more Grid registers (Voltage, Current, Energy fom net, Energy to net).\nAdded writable variable to createStateAsync() functions in main.js.\nFixed wrong registers for 'Battery Error'.\nAdded checks to create folders in 'Objects' for 'Battery', 'BatteryError', 'AC' and 'Grid'.", 21 | "de": "Hinzugefügt schreibbare Variable in victron Register.\nHinzugefügt Register 1052/TotalPower in victron Register.\nHinzu kommen Grid-Register (Voltage, Current, Energy fom net, Energy to net).\nHinzufügen von schreibbaren Variablen, umStateAsync() Funktionen in der Haupt. j).\nBehobene falsche Register für 'Battery Error'.\nEs wurden auch Ordner in Objekten für Batterie, BatteryError, AC und Grid erstellt.", 22 | "ru": "Добавлена переменная writable в victron реестры.\nДобавлена регистрация 1052/TotalPower в victron реестрах.\nДобавлены больше Grid реестров (Voltage, Current, Energy fom net, Energy to net).\nДобавлены параметры writable для созданияStateAsync() функции в главном. Джс.\nИсправлены неправильные реестры для 'Battery Error'.\nДобавлены проверки для создания папок в объектах для батареи, BatteryError, AC и Grid.", 23 | "pt": "Adicionado variável writable em registros victron.\nAdicionado registro 1052/TotalPower em registros victron.\nAdicionado mais Grid registra (Voltage, Current, Energy fom net, Energy to net).\nAdicionado variável writable para criarStateAsync() funções em principal. Js.\nRegistos errados corrigidos para 'Erro de bateria'.\nVerificações adicionadas para criar pastas em Objetos para Bateria, BatteryError, AC e Grade.", 24 | "nl": "Toegevoegd schrijfbaar variabel in vitron registers.\nGeregistreerd op naam van 1052/TotalPower in vitron registers.\nVoegde meer Grid registers toe. (Voltage, Current, Energy Fom net, Energie naar netten.\".\nToegevoegd schrijfbaar variabel om SStateAsync te creëren. Js.\nVerkeerde kentekens voor 'Battery Error'.\nToegevoegde cheques om folders te creëren in Objects voor Battery, BatteryError, AC en Grid.", 25 | "fr": "Ajout d'une variable écriture dans les registres victron.\nAjout du registre 1052/TotalPower dans les registres de victron.\nAjout d'autres registres Grid (Voltage, Current, Energy fom net, Energy to net).\nAjout de la variable writable pour créer des fonctionsStateAsync() dans main. js.\nCorrection de registres incorrects pour 'Battery Error'.\nAjout de vérifications pour créer des dossiers dans Objets pour Batterie, BatteryError, AC et Grid.", 26 | "it": "Aggiunto variabile writable in victron registri.\nAggiunto registro 1052/TotalPower in victron registri.\nAggiunti altri registri Grid (Voltage, Corrente, Energy fom net, Energy to net).\nAggiunto variabile scrivibile per creare funzioniStateAsync() in principale. j.\nRegistrati errati corretti per 'Errore di batteria'.\nAggiunti i controlli per creare cartelle in Oggetti per Batteria, BatteryError, AC e Grid.", 27 | "es": "Añadido variable writable in victron registers.\nRegistro 1052/TotalPower in victron registers.\nAñadido más Registros de Grid (Voltaje, corriente, red de fom de energía, energía a red).\nVariable adicional para crear funciones StateAsync() en principal. js.\nRegistros incorrectos fijos para 'Bloqueo de batería'.\nSe agregaron cheques para crear carpetas en objetos para batería, batería, aire acondicionado y rejilla.", 28 | "pl": "Added writable variable in the Victron registers (ang.).\nDodany rejestr 1052/TotalPower w rejestrach victronów.\nDodano więcej rejestrów Grid (Voltage, Current, Energy Fom net, Energy to net).\nAdded writable variable to tworzenie funkcjiStateAsync() w głównej mierze. js.\nFixed bad registers for ‘Battery Error’ (ang.).\nWstępne sprawdzanie tworzy foldery w Objects for Battery, BatteryError, AC i Grid.", 29 | "uk": "Додана змінна в реєстрах victron.\nДодано реєстрацію 1052/TotalPower в реєстрах victron.\nДодано більше Сітчастих реєстрів (Voltage, Current, Energy fom net, Energy to net).\nДодана writable змінна для створенняStateAsync() функції в основному. свінгери.\nВиправлено неправильні реєстри для \"Помилки\".\nДодано перевірки для створення папок в об'єктах для акумулятора, акумулятора, AC та Grid.", 30 | "zh-cn": "在天文登记册中增加可量化的变量。.\n在天体登记册中增列了1052/Totalios。.\n增加Grid登记册(目前、能源网、能源网和净能源)。.\n增加可量化的可变性,以产生主要国家阿森克()职能。 j.\n为Battery Error的错误登记册。.\n在Battery、BatteryError、AC 和Grid等物品上制造了手。." 31 | }, 32 | "0.2.2": { 33 | "en": "Fixed 'check and lint' and integration test. Changed version in package.json and io-package.json\n", 34 | "de": "Behobener 'Check- und Lint'- und Integrationstest. Geänderte Version im Paket. json und io-package. Json\n", 35 | "ru": "Исправлена проверка и lint' и проверка интеграции. Изменена версия в пакете. json и io-package. Джсон\n", 36 | "pt": "Corrigido 'check e lint' e teste de integração. Versão alterada no pacote. json e io-package. O que foi\n", 37 | "nl": "Gerepareerd 'check and lint' en integratietest. Veranderde versie in pakket. Json en io-package. Json\n", 38 | "fr": "Correction 'check and lint' et le test d'intégration. Version modifiée dans le paquet. Json et io-package. json\n", 39 | "it": "Risolto \"check and lint\" e test di integrazione. Versione modificata nel pacchetto. json e io-package. J\n", 40 | "es": "Prueba de integración y control fijo. Versión modificada en paquete. json y io-package. json\n", 41 | "pl": "Fixed 'check and lint' and integration test. Wersja zmienna w pakiecie. json i io-package. json\n", 42 | "uk": "Виправлено 'check and lint' і тестування інтеграції. Змінена версія в пакеті. json і io-package. свінгери\n", 43 | "zh-cn": "固定的检查和标记以及一体化试验。 一揽子计划的修改版本。 json和碘。 json\n" 44 | }, 45 | "0.2.1": { 46 | "en": "Added function with try...catch for receive inverter data", 47 | "de": "Zusatzfunktion mit Try...Katch für den Empfang von Wechselrichterdaten", 48 | "ru": "Добавлена функция с try...catch для получения инверторных данных", 49 | "pt": "Função adicionada com try...catch para receber dados do inversor", 50 | "nl": "Voeg de functie toe met een poging om inverter gegevens te ontvangen", 51 | "fr": "Fonction ajoutée avec essayer...catch pour recevoir des données d'inverter", 52 | "it": "Funzione aggiunta con provare...catch per ricevere dati inverter", 53 | "es": "Función agregada con el intento... capturar para recibir datos del inversor", 54 | "pl": "Funkcja dodawana do testu..catch za odwracanie danych", 55 | "uk": "Додано функцію з try...catch для отримання інверторних даних", 56 | "zh-cn": "增加工作功能。" 57 | }, 58 | "0.2.0": { 59 | "en": "Process separate inverter object (multiple inverters) and write to data points. Updated \"Getestete Geräte\" in Readme. Inserted section \"configure\" in Readme. Updated io-package.json. ", 60 | "de": "Bearbeiten Sie separate Wechselrichterobjekt (mehrfache Wechselrichter) und schreiben Sie an Datenpunkte. Aktualisierte \"Getestete Geräte\" in Readme. Einfügen Abschnitt Konfigurieren in Readme. Aktualisierte io-package.json.", 61 | "ru": "Процесс отдельных инверторных объектов (много инверторов) и написать в пункты данных. Обновлено \"Getestete Geräte\" в Readme. Встроенная настройка раздела в Readme. Обновлен io-package.json.", 62 | "pt": "Processe o objeto inversor separado (versores múltiplos) e escreva para os pontos de dados. Atualizado \"Getestete Geräte\" em Readme. Seção inserida configurada no Readme. Atualizado io-package.json.", 63 | "nl": "Process apart inverter object (multiple inverters) en schrijf op data punten. Update \"Getestete Geräte\" in Readme. Geïnstrueerde sectie configuur in Readme. Upded io-package.", 64 | "fr": "Procéder à un objet d'invertisseur séparé (invertisseurs multiples) et écrire aux points de données. Actualisé \"Getestete Geräte\" à Readme. Configuration de section insérée dans Readme. Actualisé io-package.json.", 65 | "it": "Elaborare oggetto inverter separato (multiple inverter) e scrivere ai punti di dati. Aggiornato \"Getestete Geräte\" in Readme. Sezione inserita configurata in Readme. Aggiornato io-package.json.", 66 | "es": "Procesar un objeto inversor separado (invertores múltiples) y escribir a los puntos de datos. Actualizado \"Getestete Geräte\" en Readme. Configuración de sección insertada en Readme. Actualizado io-package.json.", 67 | "pl": "Proces odwrócenia odwrócenia (współczynnik wielokrotnych) i zapisywany na punkty danych. \"Getestete Geräte\" w Readme. Wykorzystywana sekcja jest w Readme. Wyd. io-package.json.", 68 | "uk": "Процес окремий інверторний об'єкт (багаторазові інвертори) і напишіть на точки даних. Оновлено \"Getestete Geräte\" в Readme. Вмонтований розділ, налаштовується в Readme. Оновлено io-package.json.", 69 | "zh-cn": "处理不同的物体(纵火器)并填写数据点。 阅读摘要中更新的“Getestete Geräte”。 编页图。 最新包装." 70 | }, 71 | "0.1.1": { 72 | "en": "Changed inverter register to a seperate object to use multiple PV-Inverters. Added textbox in UI to set a count of PV-Inverters.", 73 | "de": "Wechseln Sie das Wechselrichterregister in ein seperate Objekt, um mehrere PV-Inverter zu verwenden. Textfeld in UI hinzugefügt, um eine Anzahl von PV-Invertern einzustellen.", 74 | "ru": "Изменена инверторная регистрация на сеператый объект для использования нескольких PV-инверторов. Добавлен текстовый ящик в UI для установки количества PV-инверторов.", 75 | "pt": "Registro do inversor alterado para um objeto seperado para usar vários PV-Inverters. Adicionado caixa de texto em UI para definir uma contagem de PV-Inverters.", 76 | "nl": "Veranderde inverter register naar een seperaat object om meerdere PV-Inverters te gebruiken. Gevoegd in UI om een aantal PV-Inverters te tellen.", 77 | "fr": "Changed inverter register to a seperate object to use multiple PV-Inverters. Ajout de la boîte de texte dans l'interface utilisateur pour définir un nombre de PV-Inverters.", 78 | "it": "Cambiato registro inverter a un oggetto seperato per utilizzare più PV-Inverter. Aggiunta casella di testo in UI per impostare un conteggio di PV-Inverters.", 79 | "es": "Cambia el registro de inversor a un objeto seperado para utilizar múltiples PV-Inverters. Se agregó un buzón de texto en UI para establecer un recuento de inversores PV.", 80 | "pl": "Zmienił rejestratora na szeroki obiekt, aby użyć wielu zmiennych PV-Inverters. Added textbox in UI to set the count of PV-Inverters.", 81 | "uk": "Змінений інверторний реєстр для seperate об'єкта для використання декількох PV-інверторів. Додано текстову скриньку в UI для встановлення кількості PV-Інверторів.", 82 | "zh-cn": "不同地点的登记册有变化,目的在于使用多种电网。 在UI中增加案文箱,以建立光纤器。." 83 | }, 84 | "0.1.0": { 85 | "en": "First running version, Added Registers, Added more registers", 86 | "de": "Erste Ausführung, Hinzugefügt Register, Hinzugefügt mehr Register", 87 | "ru": "Первая версия, Добавленные Регистры, Добавлены больше регистров", 88 | "pt": "Primeira versão em execução, Registos adicionados, Adicionado mais registros", 89 | "nl": "Eerste draaiende versie, Added Registers, voegde meer registers toe", 90 | "fr": "Première version en cours, Ajout de registres, Ajout d'autres registres", 91 | "it": "Prima versione in esecuzione, Aggiunto Registrati, Aggiunto più registri", 92 | "es": "Primera versión en ejecución, Registros añadidos, Añadido más registros", 93 | "pl": "Pierwsza wersja, Added Registers, zawiera więcej rejestrów", 94 | "uk": "Перший запуск версії, Додано реєстри, Додано більше реєстрів", 95 | "zh-cn": "第一版,《增编登记册》,增加登记册" 96 | }, 97 | "0.0.1": { 98 | "en": "initial release", 99 | "de": "Erstveröffentlichung", 100 | "ru": "Начальная версия", 101 | "pt": "lançamento inicial", 102 | "nl": "Eerste uitgave", 103 | "fr": "Première version", 104 | "it": "Versione iniziale", 105 | "es": "Versión inicial", 106 | "pl": "Pierwsze wydanie", 107 | "zh-cn": "首次出版", 108 | "uk": "початковий випуск" 109 | } 110 | }, 111 | "title": "Victron Energy", 112 | "titleLang": { 113 | "en": "Victron Energy", 114 | "de": "Victron Energie", 115 | "ru": "Виктрон Энерджи", 116 | "pt": "Victron Energy", 117 | "nl": "Victron energie", 118 | "fr": "Victron Énergie", 119 | "it": "Victron Energy", 120 | "es": "Energía victron", 121 | "pl": "Energia Victrona", 122 | "zh-cn": "伟创能源", 123 | "uk": "Victron Energy" 124 | }, 125 | "desc": { 126 | "en": "ve", 127 | "de": "ve", 128 | "ru": "ве", 129 | "pt": "eu", 130 | "nl": "ve", 131 | "fr": "je", 132 | "it": "ve", 133 | "es": "ve", 134 | "pl": "ve", 135 | "zh-cn": "已经", 136 | "uk": "ve" 137 | }, 138 | "authors": [ 139 | "derAlff " 140 | ], 141 | "keywords": [ 142 | "ioBroker", 143 | "template", 144 | "Smart Home", 145 | "home automation" 146 | ], 147 | "license": "CC BY-NC 4.0", 148 | "platform": "Javascript/Node.js", 149 | "main": "main.js", 150 | "icon": "ve.png", 151 | "enabled": true, 152 | "extIcon": "https://raw.githubusercontent.com/derAlff/ioBroker.ve/main/admin/ve.png", 153 | "readme": "https://github.com/derAlff/ioBroker.ve/blob/main/README.md", 154 | "loglevel": "info", 155 | "mode": "daemon", 156 | "type": "iot-systems", 157 | "compact": true, 158 | "connectionType": "local", 159 | "dataSource": "poll", 160 | "adminUI": { 161 | "config": "json" 162 | }, 163 | "dependencies": [ 164 | { 165 | "js-controller": ">=5.0.19" 166 | } 167 | ], 168 | "globalDependencies": [ 169 | { 170 | "admin": ">=6" 171 | } 172 | ] 173 | }, 174 | "native": { 175 | "victronIp": "", 176 | "victronPort": 502, 177 | "useMqtt": false, 178 | "fetchInterval": 5000, 179 | "numOfPvInverters": 0, 180 | "dcSystemAvailable": false, 181 | "mppts": [] 182 | }, 183 | "objects": [], 184 | "instanceObjects": [] 185 | } 186 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Logo](admin/ve.png) 2 | # ioBroker.ve 3 | 4 | [![NPM version](https://img.shields.io/npm/v/iobroker.ve.svg)](https://www.npmjs.com/package/iobroker.ve) 5 | [![Downloads](https://img.shields.io/npm/dm/iobroker.ve.svg)](https://www.npmjs.com/package/iobroker.ve) 6 | ![Number of Installations](https://iobroker.live/badges/ve-installed.svg) 7 | ![Current version in stable repository](https://iobroker.live/badges/ve-stable.svg) 8 | 9 | [![NPM](https://nodei.co/npm/iobroker.ve.png?downloads=true)](https://nodei.co/npm/iobroker.ve/) 10 | 11 | **Tests:** ![Test and Release](https://github.com/derAlff/ioBroker.ve/workflows/Test%20and%20Release/badge.svg) 12 | 13 | ## Victron-Energy adapter für ioBroker 14 | 15 | Mit diesem adapter kannst du dich über eine gwählte Netzwerktechnik (Modbus oder MQTT) zu deinem Victron Energy GX Gerät verbinden. 16 | 17 | ## Einrichtung 18 | Buy Me A Coffee
19 | 1. IP-Adresse - Hier wird die IP-Adresse deines GX-Gerätes angegeben. Diese solltest du fest vergeben. 20 | 2. Port - Hier wird der Modbus-Port angegeben. Diesen Port kannst du im GX-Gerät setzen bzw. ablesen. Modbus MUSS zur Zeit im GX-Gerät aktiviert sein! 21 | 3. Anzahl PV-Wechselrichter - Hier wird die Anzahl der Wechselrichter angegeben, welche mit dem GX-Gerät verbunden sind (Sunspec-Modbus, usw...). 22 | 4. Intervall - Mit der Angabe des Intervalls kannst du steuern, in welchem Takt die Daten bei deinem GX-Gerät abgeholt werden sollen. Die Angabe erfolgt in ms - Millisekunden . 23 | 24 | ## Getestete Geräte 25 | Bisher wurden folgende Geräte erfolgreich getestet: 26 | 1. Victron Energy MultiPlus II GX 3000/35 27 | 2. Cerbo GX - Large Firmware (tested by "kopierschnitte") 28 | 29 | Buy Me A Coffee 30 | 31 | 32 | ## Changelog 33 | ### ToDoInTheFuture 34 | * #001 Add 'batteryState_System' 35 | 36 | ### Current work 37 | * (derAlff) Added MPPTs (to test) 38 | * (derAlff) Added DCCoupledPower (to test) - [Issue #24](https://github.com/derAlff/ioBroker.ve/issues/24) 39 | * (derAlff) Fixed lint issues 40 | * (derAlff) Fixed problem with object and .length 41 | * (derAlff) Added 'lint:fix' to package.json 42 | * (derAlff) Updated Readme 43 | 44 | ### 0.3.1 45 | * (derAlff) Fixed testing errors 46 | * (derAlff) Translated Admin UI 47 | * (derAlff) Updated README. 48 | 49 | ### 0.3.0 50 | * (derAlff) Added writable variable in victron registers 51 | * (derAlff) Added register 1052/TotalPower in victron registers 52 | * (derAlff) Added more Grid registers (Voltage, Current, Energy fom net, Energy to net) 53 | * (derAlff) Added writable variable to createStateAsync() functions in main.js 54 | * (derAlff) Fixed wrong registers for 'Battery Error' 55 | * (derAlff) Added checks to create folders in 'Objects' for 'Battery', 'BatteryError', 'AC' and 'Grid' 56 | 57 | ### 0.2.2 58 | * (derAlff) Fixed 'check and lint' and integration test. Changed version in package.json and io-package.json 59 | 60 | ### 0.2.1 61 | * (derAlff) Added function with try...catch for receive inverter data 62 | 63 | ### 0.2.0 64 | * (derAlff) Process separate inverter object (multiple inverters) and write to data points 65 | * (derAlff) Updated "Getestete Geräte" in Readme 66 | * (derAlff) Inserted section "configure" in Readme 67 | * (derAlff) Updated io-package.json 68 | 69 | ### 0.1.1 70 | * (derAlff) Changed inverter register to a seperate object to use multiple PV-Inverters 71 | * (derAlff) Added textbox in UI to set a count of PV-Inverters 72 | 73 | ### 0.1.0 74 | * (derAlff) First running version 75 | * (derAlff) Added Registers 76 | * (derAlff) Added more registers 77 | 78 | ## License 79 | Creative Commons Attribution-NonCommercial 4.0 International Public License 80 | 81 | By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions. 82 | 83 | Section 1 – Definitions. 84 | 85 | Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image. 86 | Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License. 87 | Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. 88 | Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements. 89 | Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material. 90 | Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License. 91 | Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license. 92 | Licensor means the individual(s) or entity(ies) granting rights under this Public License. 93 | NonCommercial means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange. 94 | Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them. 95 | Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world. 96 | You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning. 97 | 98 | Section 2 – Scope. 99 | 100 | License grant. 101 | Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to: 102 | reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and 103 | produce, reproduce, and Share Adapted Material for NonCommercial purposes only. 104 | Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions. 105 | Term. The term of this Public License is specified in Section 6(a). 106 | Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material. 107 | Downstream recipients. 108 | Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License. 109 | No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material. 110 | No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i). 111 | 112 | Other rights. 113 | Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise. 114 | Patent and trademark rights are not licensed under this Public License. 115 | To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes. 116 | 117 | Section 3 – License Conditions. 118 | 119 | Your exercise of the Licensed Rights is expressly made subject to the following conditions. 120 | 121 | Attribution. 122 | 123 | If You Share the Licensed Material (including in modified form), You must: 124 | retain the following if it is supplied by the Licensor with the Licensed Material: 125 | identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated); 126 | a copyright notice; 127 | a notice that refers to this Public License; 128 | a notice that refers to the disclaimer of warranties; 129 | a URI or hyperlink to the Licensed Material to the extent reasonably practicable; 130 | indicate if You modified the Licensed Material and retain an indication of any previous modifications; and 131 | indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License. 132 | You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information. 133 | If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable. 134 | If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License. 135 | 136 | Section 4 – Sui Generis Database Rights. 137 | 138 | Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material: 139 | 140 | for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only; 141 | if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and 142 | You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database. 143 | 144 | For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights. 145 | 146 | Section 5 – Disclaimer of Warranties and Limitation of Liability. 147 | 148 | Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You. 149 | To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You. 150 | 151 | The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability. 152 | 153 | Section 6 – Term and Termination. 154 | 155 | This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically. 156 | 157 | Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates: 158 | automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or 159 | upon express reinstatement by the Licensor. 160 | For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License. 161 | For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License. 162 | Sections 1, 5, 6, 7, and 8 survive termination of this Public License. 163 | 164 | Section 7 – Other Terms and Conditions. 165 | 166 | The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed. 167 | Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License. 168 | 169 | Section 8 – Interpretation. 170 | 171 | For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License. 172 | To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions. 173 | No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor. 174 | Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority. 175 | 176 | Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the “Licensor.” The text of the Creative Commons public licenses is dedicated to the public domain under the CC0 Public Domain Dedication. Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at creativecommons.org/policies, Creative Commons does not authorize the use of the trademark “Creative Commons” or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses. 177 | 178 | Creative Commons may be contacted at creativecommons.org. -------------------------------------------------------------------------------- /main.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /* 3 | * Created with @iobroker/create-adapter v2.3.0 4 | */ 5 | 6 | // The adapter-core module gives you access to the core ioBroker functions 7 | // you need to create an adapter 8 | const utils = require("@iobroker/adapter-core"); 9 | const ModbusRTU = require("modbus-serial").default; 10 | // const fs = require('fs'); 11 | const client = new ModbusRTU(); 12 | 13 | const registers = require("./register/ve.register.victronenergy"); 14 | 15 | const ve = registers.getRegisters(); 16 | 17 | let interval; 18 | const RUN_OLD_Program = true; 19 | const RUN_NEW_PROGRAM = false; 20 | 21 | /* #001 To show actual battery state in datapoint. Not yet implemented. 22 | const batteryState_System = { 23 | 0: "idle", 24 | 1: "charging", 25 | 2: "discharging" 26 | }; 27 | */ 28 | const activeInputSource ={ 29 | //0=Unknown;1=Grid;2=Generator;3=Shore power;240=Not connected 30 | 0: "Unknown", 31 | 1: "Grid", 32 | 2: "Generator", 33 | 3: "Shore power", 34 | 240: "Not connected" 35 | }; 36 | 37 | const batteryErrors = { 38 | 0:"No error", 39 | 1:"Battery initialization error", 40 | 2:"No batteries connected", 41 | 3:"Unknown battery connected", 42 | 4:"Different battery type", 43 | 5:"Number of batteries incorrect", 44 | 6:"Lynx Shunt not found", 45 | 7:"Battery measure error", 46 | 8:"Internal calculation error", 47 | 9:"Batteries in series not ok", 48 | 10:"Number of batteries incorrect", 49 | 11:"Hardware error", 50 | 12:"Watchdog error", 51 | 13:"Over voltage", 52 | 14:"Under voltage", 53 | 15:"Over temperature", 54 | 16:"Under temperature", 55 | 17:"Hardware fault", 56 | 18:"Standby shutdown", 57 | 19:"Pre-charge charge error", 58 | 20:"Safety contactor check error", 59 | 21:"Pre-charge discharge error", 60 | 22:"ADC error", 61 | 23:"Slave error", 62 | 24:"Slave warning", 63 | 25:"Pre-charge error", 64 | 26:"Safety contactor error", 65 | 27:"Over current", 66 | 28:"Slave update failed", 67 | 29:"Slave update unavailable", 68 | 30:"Calibration data lost", 69 | 31:"Settings invalid", 70 | 32:"BMS cable", 71 | 33:"Reference failure", 72 | 34:"Wrong system voltage", 73 | 35:"Pre-charge timeout" 74 | }; 75 | 76 | // Load your modules here, e.g.: 77 | // const fs = require("fs"); 78 | 79 | function checkIfValidIP(str) { 80 | // Regular expression to check if string is a IP address 81 | const regexExp = /^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/gi; 82 | 83 | return regexExp.test(str); 84 | } 85 | 86 | function signedToNumber(bits, value) { 87 | return value & (1 << (bits - 1)) ? value - (1 << bits) : value; 88 | } 89 | 90 | function convertRegister(sType, nValue){ 91 | let returnValue = 0; 92 | let hexString = ""; 93 | 94 | try{ 95 | if(sType === "int16"){ // vorzeichen! 96 | hexString = nValue[0].toString(16); 97 | 98 | switch(hexString.length){ 99 | case 1: hexString = "000" + hexString; 100 | break; 101 | case 2: hexString = "00" + hexString; 102 | break; 103 | case 3: hexString = "0" + hexString; 104 | break; 105 | } 106 | 107 | hexString = "0x" + hexString; 108 | returnValue = signedToNumber(16, hexString); 109 | } 110 | else{ 111 | returnValue = nValue[0]; 112 | } 113 | } 114 | catch{ 115 | returnValue = nValue[0]; 116 | } 117 | return returnValue; 118 | } 119 | 120 | class Ve extends utils.Adapter { 121 | /** 122 | * @param {Partial} [options={}] 123 | */ 124 | constructor(options) { 125 | super({ 126 | ...options, 127 | name: "ve", 128 | }); 129 | this.on("ready", this.onReady.bind(this)); 130 | this.on("stateChange", this.onStateChange.bind(this)); 131 | this.on("unload", this.onUnload.bind(this)); 132 | } 133 | 134 | /** 135 | * Is called when databases are connected and adapter received configuration. 136 | */ 137 | async onReady() { 138 | // The adapters config (in the instance object everything under the attribute "native") is accessible via 139 | // this.config: 140 | this.log.info("Config IP: " + this.config.victronIp); 141 | this.log.info("Config port: " + this.config.victronPort); 142 | this.log.info("Number of PV-Inverters: " + this.config.numOfPvInverters); 143 | this.log.info(`MPPT installed: ${this.config.dcSystemAvailable}`); 144 | 145 | 146 | 147 | // Subscribe writable states 148 | await this.subscribeStatesAsync("*BatteryCapacity"); 149 | 150 | //await this.subscribeStatesAsync('*'); 151 | if(RUN_OLD_Program){ 152 | this.log.info(`MPPTs: ${JSON.stringify(this.config.mppts)}`); 153 | 154 | const oMppts = await this.config.mppts; 155 | this.log.debug(`Length of 'oMPPT': ${oMppts.length}`); 156 | 157 | if(oMppts != null && oMppts !== undefined && oMppts.length > 0) 158 | { 159 | this.log.debug(`Length of 'oMppts' > 0: ${oMppts.length}`); 160 | this.log.error(`1st Mppt: '${JSON.stringify(oMppts[0])}'`); 161 | this.log.error(`2nd Mppt: '${JSON.stringify(oMppts[1])}'`); 162 | 163 | oMppts.forEach(mppt => { 164 | this.log.debug("Complete JSON: " + JSON.stringify(mppt)); 165 | 166 | const bEnabled = mppt.enabled; 167 | const bVedirect = mppt.vedirect; 168 | const bEthernet = mppt.ethernet; 169 | const sDeviceName = mppt.device; 170 | const nDeviceId = mppt.id; 171 | const sIpAddress = mppt.ipaddress; 172 | 173 | this.log.debug(`bEnabled: '${bEnabled}'`); 174 | this.log.debug(`bVedirect: '${bVedirect}'`); 175 | this.log.debug(`bEthernet: '${bEthernet}'`); 176 | this.log.debug(`sDeviceName: '${sDeviceName}'`); 177 | this.log.debug(`nDeviceId: '${nDeviceId}'`); 178 | this.log.debug(`sIpAddress: '${sIpAddress}'`); 179 | 180 | if(!bEnabled){ 181 | this.log.warn(`MPPT '${sDeviceName}' is disabled.`); 182 | return; 183 | } 184 | if(!bVedirect && !bEthernet) 185 | { 186 | this.log.warn(`The MPPT '${sDeviceName}' has no option (VE.Direct or Ethernet) assigned. Please assign an option to the device.`); 187 | return; 188 | } 189 | if(bVedirect && bEthernet) 190 | { 191 | this.log.warn(`The MPPT '${sDeviceName}' has all options (VE.Direct or Ethernet) assigned. Please assign only option to the device.`); 192 | return; 193 | } 194 | if(bVedirect && nDeviceId.length <= 0) 195 | { 196 | this.log.warn(`VE.Direct assigned. But there is no Device-ID available`); 197 | return; 198 | } 199 | if(bEthernet && !checkIfValidIP(sIpAddress)){ 200 | this.log.warn(`Ethernet assigned but the IP-Address is not correct.`); 201 | } 202 | 203 | }); 204 | 205 | } 206 | else{ 207 | this.log.debug(`Length of 'oMppts' <= 0`); 208 | } 209 | 210 | if(this.config.victronIp !== "") 211 | { 212 | // Check IP-Address 213 | if(!checkIfValidIP(this.config.victronIp)){ 214 | this.log.error(`Your IP-Address '${this.config.victronIp}' is not valid. Restart the Adapter.`); 215 | 216 | this.getAdapterObjects(data => { 217 | this.log.warn(data.toString()); 218 | }); 219 | } 220 | 221 | // Connect to VE-Device 222 | client.connectTCP(this.config.victronIp, { port: this.config.victronPort }).catch(() => {this.log.debug("brb");}); 223 | 224 | interval = this.setInterval(() =>{ 225 | this.log.debug("Started interval..."); 226 | 227 | 228 | Object.entries(ve).forEach(async register => { 229 | // Non-inverter values 230 | if(!register.includes("Inverter")) 231 | { 232 | this.log.debug(JSON.stringify(register)); 233 | let run = true; 234 | const deviceCount = 1; 235 | let sRegisterName = register.toString().split(",")[0]; 236 | const nRegisterNumber = register[1].Register; 237 | const nRegisterLength = register[1].Length; 238 | const nRegisterId = register[1].Id; 239 | const sRegisterUnit = register[1].Unit; 240 | const nRegisterFactor = register[1].Factor; 241 | const sRegisterType = register[1].Type; 242 | const bRegisterWritable = register[1].writable; 243 | let writeValue = null; 244 | 245 | if(sRegisterName.includes("DCSystem") && !this.config.dcSystemAvailable) 246 | { 247 | this.log.debug("Do not use DC-System."); 248 | run = false; 249 | } 250 | 251 | this.log.debug("Value of 'run': " + run.toString()); 252 | if(run) 253 | { 254 | for(let i = 0; i < deviceCount; i++){ 255 | this.log.debug(`Read ID: '${nRegisterId + i}'`); // DEBUG 256 | client.setID(nRegisterId + i); 257 | this.log.debug(`Read register: '${nRegisterNumber}'`); // DEBUG 258 | const data = await client.readHoldingRegisters(nRegisterNumber, nRegisterLength); 259 | if(data !== undefined && data != null){ 260 | if(data !== undefined) 261 | { 262 | let out = ""; 263 | const nV = data.data; 264 | const nValue = convertRegister(sRegisterType, nV); 265 | 266 | if(nRegisterFactor > 0) 267 | { 268 | out = (nValue * nRegisterFactor).toFixed(2).toString(); 269 | } 270 | else{ 271 | out = nValue.toString(); 272 | } 273 | 274 | if(sRegisterName == "ActiveInputSource") 275 | { 276 | out = activeInputSource[out.toString()]; 277 | } 278 | if(sRegisterName.toLowerCase().includes("battery") && sRegisterName.toLowerCase().includes("lasterror")){ 279 | // Create folder for Errors in ve.0.Battery.Error 280 | sRegisterName = "Battery.Error." + sRegisterName; 281 | out = batteryErrors[out.toString()]; 282 | } 283 | 284 | // Create folders 285 | // Battery 286 | if(sRegisterName.toLowerCase().includes("battery") && !sRegisterName.toLowerCase().includes("lasterror")) 287 | { 288 | sRegisterName = "Battery." + sRegisterName; 289 | } 290 | // AC 291 | if(sRegisterName.toLowerCase().includes("ac")) 292 | { 293 | sRegisterName = "AC." + sRegisterName; 294 | } 295 | // Grid 296 | if(sRegisterName.toLowerCase().includes("grid")) 297 | { 298 | sRegisterName = "Grid." + sRegisterName; 299 | } 300 | 301 | this.log.debug(sRegisterName + ": " + out + " " + sRegisterUnit); // DEBUG 302 | /* 303 | HERE SET OBJECTS 304 | */ 305 | this.log.debug(sRegisterName.toLowerCase()); 306 | if(/*sRegisterType.includes("uint") && */(!sRegisterName.toLowerCase().includes("activeinputsource") || sRegisterName.toLowerCase().includes("batterycurrent_system"))) 307 | { 308 | await this.setObjectNotExistsAsync(sRegisterName, { 309 | type: "state", 310 | common: { 311 | name: sRegisterName, 312 | type: "number", 313 | role: "indicator", 314 | unit: sRegisterUnit, 315 | read: true, 316 | write: bRegisterWritable, 317 | }, 318 | native: {}, 319 | }); 320 | 321 | writeValue = Number(out); 322 | } 323 | else{ 324 | await this.setObjectNotExistsAsync(sRegisterName, { 325 | type: "state", 326 | common: { 327 | name: sRegisterName, 328 | type: "string", 329 | role: "indicator", 330 | unit: sRegisterUnit, 331 | read: true, 332 | write: bRegisterWritable, 333 | }, 334 | native: {}, 335 | }); 336 | 337 | writeValue = out; 338 | } 339 | 340 | await this.setStateAsync(sRegisterName, { val: writeValue, ack: true }); 341 | } 342 | else{ 343 | this.log.debug(`ID: '${nRegisterId + i}' is undefined`); // DEBUG 344 | } 345 | } 346 | } 347 | } 348 | } 349 | else{ 350 | this.log.debug(`It is the INVERTER :) -> Installed ${this.config.numOfPvInverters}`); 351 | if(this.config.numOfPvInverters > 0) 352 | { 353 | for(let i = 0; i < this.config.numOfPvInverters; i++) 354 | { 355 | this.log.debug(`Actual PV-Inverter: '${i.toString()}'`); 356 | 357 | Object.entries(register[1]["Registers"]).forEach(async invRegister =>{ 358 | const oRegister = invRegister[1]; 359 | const sRegisterName = oRegister["RegisterName"].toString(); 360 | const nRegisterNr = Number(oRegister["Register"]); 361 | const nRegisterId = Number(oRegister["Id"]); 362 | const nRegisterLength = Number(oRegister["Length"]); 363 | const sRegisterUnit = oRegister["Unit"].toString(); 364 | const nRegisterFactor = Number(oRegister["Factor"]); 365 | const sRegisterType = oRegister["Type"].toString(); 366 | const bRegisterWritable = oRegister["writable"]; 367 | 368 | this.log.debug("----------------------------------"); 369 | this.log.debug(`Value for inverter '${i.toString()}' - RegisterName: '${sRegisterName}'`); 370 | this.log.debug(`Value for inverter '${i.toString()}' - nRegisterNr: '${nRegisterNr.toString()}'`); 371 | this.log.debug(`Value for inverter '${i.toString()}' - nRegisterId: '${nRegisterId.toString()}'`); 372 | this.log.debug(`Value for inverter '${i.toString()}' - nRegisterLength: '${nRegisterLength.toString()}'`); 373 | this.log.debug(`Value for inverter '${i.toString()}' - sRegisterUnit: '${sRegisterUnit}'`); 374 | this.log.debug(`Value for inverter '${i.toString()}' - nRegisterFactor: '${nRegisterFactor.toString()}'`); 375 | this.log.debug(`Value for inverter '${i.toString()}' - sRegisterType: '${sRegisterType}'`); 376 | this.log.debug("----------------------------------"); 377 | 378 | //client.setID(nRegisterId + i); 379 | //const data = await client.readHoldingRegisters(nRegisterNr, nRegisterLength); 380 | const data = await this.getInverter(nRegisterId + i, nRegisterNr, nRegisterLength); 381 | 382 | if(data !== undefined && data !== null) 383 | { 384 | this.log.debug(`Received data for inverter no. '${(i+1).toString()}'`); 385 | //this.log.debug("Data: " + data.data.toString()); 386 | const iobDatapoint = "Inverter." + nRegisterId.toString() + "." + sRegisterName; 387 | const nV = data.data; 388 | const nValue = (convertRegister(sRegisterType, nV) * nRegisterFactor).toFixed(2); 389 | const out = Number(nValue); 390 | 391 | this.log.debug(`Value for '${sRegisterName}': ${nValue.toString()} ${sRegisterUnit}`); 392 | 393 | await this.setObjectNotExistsAsync(iobDatapoint, { 394 | type: "state", 395 | common: { 396 | name: sRegisterName, 397 | type: "number", 398 | role: "indicator", 399 | unit: sRegisterUnit, 400 | read: true, 401 | write: bRegisterWritable, 402 | }, 403 | native: {}, 404 | }); 405 | 406 | const writeValue = out; 407 | 408 | await this.setStateAsync(iobDatapoint, { val: writeValue, ack: true }); 409 | 410 | } 411 | else{ 412 | this.log.warn(`Can not read '${sRegisterName}' data for inverter no. '${(i+1).toString()}'. Is this inverter available?`); 413 | } 414 | }); 415 | } 416 | } 417 | } 418 | }); 419 | }, 5000); 420 | } 421 | else{ 422 | interval = setInterval(() => { 423 | this.log.debug("The IP address is not set. Adapter is not running!"); 424 | }, 5000); 425 | } 426 | } 427 | else{ 428 | this.log.warn("Old program is disabled for tests..."); 429 | } 430 | 431 | if(RUN_NEW_PROGRAM){ 432 | if(this.config.victronIp !== ""){ // The IP Address of victron GX Device must be set! 433 | if(checkIfValidIP(this.config.victronIp)){ // Check IP-Address. If valid, then work. 434 | 435 | } 436 | else{ 437 | this.log.error(`Your IP-Address '${this.config.victronIp}' is not valid. Restart the Adapter.`); 438 | 439 | this.getAdapterObjects(data => { 440 | this.log.warn(data.toString()); 441 | }); 442 | } 443 | } 444 | else{ 445 | interval = setInterval(() => { 446 | this.log.debug("The IP address is not set. Adapter is not running!"); 447 | }, 5000); 448 | } 449 | } 450 | else{ 451 | this.log.warn("New program is disabled for tests..."); 452 | } 453 | } 454 | 455 | async getInverter(nRegisterId, nRegisterNr, nRegisterLength){ 456 | try{ 457 | client.setID(nRegisterId); 458 | const data = await client.readHoldingRegisters(nRegisterNr, nRegisterLength); 459 | return data; 460 | }catch(err){ 461 | return null; 462 | } 463 | } 464 | /** 465 | * Is called when adapter shuts down - callback has to be called under any circumstances! 466 | * @param {() => void} callback 467 | */ 468 | onUnload(callback) { 469 | try { 470 | // Here you must clear all timeouts or intervals that may still be active 471 | // clearTimeout(timeout1); 472 | // clearTimeout(timeout2); 473 | // ... 474 | // clearInterval(interval1); 475 | this.log.info("Unload adapter..."); 476 | clearInterval(interval); 477 | callback(); 478 | } catch (e) { 479 | callback(); 480 | } 481 | } 482 | 483 | // If you need to react to object changes, uncomment the following block and the corresponding line in the constructor. 484 | // You also need to subscribe to the objects with `this.subscribeObjects`, similar to `this.subscribeStates`. 485 | // /** 486 | // * Is called if a subscribed object changes 487 | // * @param {string} id 488 | // * @param {ioBroker.Object | null | undefined} obj 489 | // */ 490 | // onObjectChange(id, obj) { 491 | // if (obj) { 492 | // // The object was changed 493 | // this.log.info(`object ${id} changed: ${JSON.stringify(obj)}`); 494 | // } else { 495 | // // The object was deleted 496 | // this.log.info(`object ${id} deleted`); 497 | // } 498 | // } 499 | 500 | /** 501 | * Is called if a subscribed state changes 502 | * @param {string} id 503 | * @param {ioBroker.State | null | undefined} state 504 | */ 505 | onStateChange(id, state) { 506 | 507 | if (state) { 508 | // The state was changed 509 | this.log.info(`state ${id} changed: ${state.val} (ack = ${state.ack})`); 510 | this.log.info(`Send via Modbus`); 511 | } else { 512 | // The state was deleted 513 | this.log.info(`state ${id} deleted`); 514 | } 515 | } 516 | 517 | // If you need to accept messages in your adapter, uncomment the following block and the corresponding line in the constructor. 518 | // /** 519 | // * Some message was sent to this instance over message box. Used by email, pushover, text2speech, ... 520 | // * Using this method requires "common.messagebox" property to be set to true in io-package.json 521 | // * @param {ioBroker.Message} obj 522 | // */ 523 | // onMessage(obj) { 524 | // if (typeof obj === "object" && obj.message) { 525 | // if (obj.command === "send") { 526 | // // e.g. send email or pushover or whatever 527 | // this.log.info("send command"); 528 | 529 | // // Send response in callback if required 530 | // if (obj.callback) this.sendTo(obj.from, obj.command, "Message received", obj.callback); 531 | // } 532 | // } 533 | // } 534 | } 535 | 536 | if (require.main !== module) { 537 | // Export the constructor in compact mode 538 | /** 539 | * @param {Partial} [options={}] 540 | */ 541 | module.exports = (options) => new Ve(options); 542 | } else { 543 | // otherwise start the instance directly 544 | new Ve(); 545 | } --------------------------------------------------------------------------------