Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Error/Bug
    4. [Fehler] ModBus-Adapter 2.0.3

    NEWS

    • ioBroker goes Matter ... Matter Adapter in Stable

    • 15. 05. Wartungsarbeiten am ioBroker Forum

    • Monatsrückblick - April 2025

    [Fehler] ModBus-Adapter 2.0.3

    This topic has been deleted. Only users with topic management privileges can see it.
    • Stabilostick
      Stabilostick last edited by

      Nach dem Update von 1.1.1 auf 2.0.3 läuft ein für die UVR16x02 konfigurierter MODBUS-Adapter nicht mehr. Zwei weitere Instanzen, die sich um SMA-Geräte kümmern, funktionieren auf der gleichen Maschine problemlos.

      Worauf weisen die folgenden Logeinträge hin?

      host.ARBEITSZIMMER	2018-06-20 23:27:25.865	info	Restart adapter system.adapter.modbus.2 because enabled
      host.ARBEITSZIMMER	2018-06-20 23:27:25.865	error	instance system.adapter.modbus.2 terminated with code 6 (uncaught exception)
      Caught	2018-06-20 23:27:25.865	error	by controller[0]: at Array.forEach (<anonymous>)
      Caught	2018-06-20 23:27:25.865	error	by controller[0]: at Modbus.fs.readdirSync.filter.forEach.file (C:\dev\iobroker\node_modules\iobroker.modbus\lib\jsmodbus\index.js:9:29)
      Caught	2018-06-20 23:27:25.865	error	by controller[0]: at require (internal/module.js:11:18)
      Caught	2018-06-20 23:27:25.865	error	by controller[0]: at Module.require (module.js:596:17)
      Caught	2018-06-20 23:27:25.865	error	by controller[0]: at Function.Module._load (module.js:497:3)
      Caught	2018-06-20 23:27:25.865	error	by controller[0]: at tryModuleLoad (module.js:505:12)
      Caught	2018-06-20 23:27:25.865	error	by controller[0]: at Module.load (module.js:565:32)
      Caught	2018-06-20 23:27:25.865	error	by controller[0]: at Object.Module._extensions..js (module.js:663:10)
      Caught	2018-06-20 23:27:25.865	error	by controller[0]: at Module._compile (module.js:652:30)
      Caught	2018-06-20 23:27:25.865	error	by controller[0]: at Object. <anonymous>(C:\dev\iobroker\node_modules\iobroker.modbus\lib\jsmodbus\handler\server\ReadDiscreteInputs.js:71:18)
      Caught	2018-06-20 23:27:25.855	error	by controller[0]: ReferenceError: handler is not defined
      modbus.2	2018-06-20 23:27:24.843	error	at Array.forEach (<anonymous>)
      modbus.2	2018-06-20 23:27:24.843	error	at Modbus.fs.readdirSync.filter.forEach.file (C:\dev\iobroker\node_modules\iobroker.modbus\lib\jsmodbus\index.js:9:29)
      modbus.2	2018-06-20 23:27:24.843	error	at require (internal/module.js:11:18)
      modbus.2	2018-06-20 23:27:24.843	error	at Module.require (module.js:596:17)
      modbus.2	2018-06-20 23:27:24.843	error	at Function.Module._load (module.js:497:3)
      modbus.2	2018-06-20 23:27:24.843	error	at tryModuleLoad (module.js:505:12)
      modbus.2	2018-06-20 23:27:24.843	error	at Module.load (module.js:565:32)
      modbus.2	2018-06-20 23:27:24.843	error	at Object.Module._extensions..js (module.js:663:10)
      modbus.2	2018-06-20 23:27:24.843	error	at Module._compile (module.js:652:30)
      modbus.2	2018-06-20 23:27:24.843	error	at Object. <anonymous>(C:\dev\iobroker\node_modules\iobroker.modbus\lib\jsmodbus\handler\server\ReadDiscreteInputs.js:71:18)
      modbus.2	2018-06-20 23:27:24.843	error	ReferenceError: handler is not defined
      modbus.2	2018-06-20 23:27:24.843	error	uncaught exception: handler is not defined
      modbus.2	2018-06-20 23:27:24.543	info	starting. Version 2.0.3 in C:/dev/iobroker/node_modules/iobroker.modbus, node: v8.11.1
      modbus.2	2018-06-20 23:27:24.533	debug	statesDB connected
      modbus.2	2018-06-20 23:27:24.523	debug	objectDB connected
      host.ARBEITSZIMMER	2018-06-20 23:27:24.145	info	instance system.adapter.modbus.2 started with pid 16356
      host.ARBEITSZIMMER	2018-06-20 23:27:24.135	info	object change system.adapter.modbus.2</anonymous></anonymous></anonymous></anonymous> 
      

      Wo soll ich anfangen, zu suchen?

      1 Reply Last reply Reply Quote 0
      • Stabilostick
        Stabilostick last edited by

        Bin mal zurück auf 1.1.1 gegangen. Da funktioniert wieder alles…

        Ich möchte aber gerne das Problem eingrenzen. Worauf können die Fehler oben hinweisen?

        1 Reply Last reply Reply Quote 0
        • apollon77
          apollon77 last edited by

          Auf einen Bug im Code. Bitte als Github Issue anlegen

          1 Reply Last reply Reply Quote 0
          • Stabilostick
            Stabilostick last edited by

            Kurze prägnate Antwort. Danke 😉

            1 Reply Last reply Reply Quote 0
            • Stabilostick
              Stabilostick last edited by

              Noch zwei Screenshots mit den Settings, die zum Fehler führen:

              7446_modbus_settings1.png

              7446_modbus_settings2.png

              Die Dialoge für die "Diskreten Ein- und Augänge" sowie die "Eingangsregister" sind leer.

              1 Reply Last reply Reply Quote 0
              • Stabilostick
                Stabilostick last edited by

                DIe Dateien und Verzeichnisse, die von jsmodbus/index.js angesprochen werden sind

                C:\dev\iobroker\node_modules\iobroker.modbus\lib\jsmodbus/transports/modbus-server-tcp.js
                
                C:\dev\iobroker\node_modules\iobroker.modbus\lib\jsmodbus/handler/server
                
                C:\dev\iobroker\node_modules\iobroker.modbus\lib\jsmodbus/handler/server/ReadCoils.js -> vor require
                
                C:\dev\iobroker\node_modules\iobroker.modbus\lib\jsmodbus/handler/server/ReadCoils.js -> require gelaufen
                
                function Factory(refs) {
                    for (var _len9 = arguments.length, args = Array(_len9 > 1 ? _len9 - 1 : 0), _key9 = 1; _key9 < _len9; _key9++) {
                      args[_key9 - 1] = arguments[_key9];
                    }
                
                    var instance = (0, _supermixer.mixin)(create(fixed.methods), fixed.refs, refs);
                    (0, _supermixer.mergeUnique)(instance, fixed.props); // props are safely merged into refs
                
                    var nextPromise = null;
                    if (fixed.init.length > 0) {
                      (0, _lodashCollectionForEach2['default'])(fixed.init, function (fn) {
                        if (!(0, _lodashLangIsFunction2['default'])(fn)) {
                          return; // not a function, do nothing.
                        }
                
                        // Check if we are in the async mode.
                        if (!nextPromise) {
                          // Call the init().
                          var callResult = fn.call(instance, { args: args, instance: instance, stamp: factory });
                          if (!callResult) {
                            return; // The init() returned nothing. Proceed to the next init().
                          }
                
                          // Returned value is meaningful.
                          // It will replace the stampit-created object.
                          if (!isThenable(callResult)) {
                            instance = callResult; // stamp is synchronous so far.
                            return;
                          }
                
                          // This is the sync->async conversion point.
                          // Since now our factory will return a promise, not an object.
                          nextPromise = callResult;
                        } else {
                          // As long as one of the init() functions returned a promise,
                          // now our factory will 100% return promise too.
                          // Linking the init() functions into the promise chain.
                          nextPromise = nextPromise.then(function (newInstance) {
                            // The previous promise might want to return a value,
                            // which we should take as a new object instance.
                            instance = newInstance || instance;
                
                            // Calling the following init().
                            // NOTE, than `fn` is wrapped to a closure within the forEach loop.
                            var callResult = fn.call(instance, { args: args, instance: instance, stamp: factory });
                            // Check if call result is truthy.
                            if (!callResult) {
                              // The init() returned nothing. Thus using the previous object instance.
                              return instance;
                            }
                
                            if (!isThenable(callResult)) {
                              // This init() was synchronous and returned a meaningful value.
                              instance = callResult;
                              // Resolve the instance for the next `then()`.
                              return instance;
                            }
                
                            // The init() returned another promise. It is becoming our nextPromise.
                            return callResult;
                          });
                        }
                      });
                    }
                
                    // At the end we should resolve the last promise and
                    // return the resolved value (as a promise too).
                    return nextPromise ? nextPromise.then(function (newInstance) {
                      return newInstance || instance;
                    }) : instance;
                  } 
                -> nach compose
                
                C:\dev\iobroker\node_modules\iobroker.modbus\lib\jsmodbus/handler/server/ReadDiscreteInputs.js -> vor require
                
                

                Dann ist Stille.

                Obiges kam aus -> krudes Logging in jsmodbus/index.js eingefügt:

                'use strict';
                const fs = require('fs');
                
                var util = require('util');
                var log_file = fs.createWriteStream('C:/debug.log', {flags : 'w'});
                var log_stdout = process.stdout;
                
                console.log = function(d) { //
                  log_file.write(util.format(d) + '\n');
                  log_stdout.write(util.format(d) + '\n');
                };
                
                function Modbus(type, transport) {
                console.log(__dirname + `/transports/modbus-${type}-${transport || 'tcp'}.js`);
                console.log(__dirname + `/handler/${type}`);
                
                    let core = require(__dirname + `/transports/modbus-${type}-${transport || 'tcp'}.js`);
                
                    fs.readdirSync(__dirname + `/handler/${type}`)
                        .filter(file => file.substr(-3) === '.js').forEach(file => {
                            console.log(__dirname + `/handler/${type}/${file} -> vor require`); 
                            const handler = require(__dirname + `/handler/${type}/${file}`);
                            console.log(__dirname + `/handler/${type}/${file} -> require gelaufen`); 
                            core = core.compose(handler);
                            console.log(handler + ` -> nach compose`); 
                            //core.handler[file.substr(0, file.length - 3)] = handler;
                        });
                
                    return core;
                }
                
                module.exports = Modbus;
                
                1 Reply Last reply Reply Quote 0
                • Stabilostick
                  Stabilostick last edited by

                  Es scheint mir so, als ob die letzte Zeile der Datei /handler/server/ReadDiscreteInputs.js unnötig ist?

                  Flugs dort auskommentiert:

                  // module.exports = handler;
                  

                  Jetzt läuft jsmodbus/index.js durch.

                  Als Belohnung gibt es einen neuen Fehler:

                  2018-06-21 09:30:29.849 - info: host.ARBEITSZIMMER instance system.adapter.modbus.2 started with pid 1608
                  2018-06-21 09:30:30.268 - debug: modbus.2 objectDB connected
                  2018-06-21 09:30:30.277 - debug: modbus.2 statesDB connected
                  2018-06-21 09:30:30.288 - info: modbus.2 starting. Version 2.0.3 in C:/dev/iobroker/node_modules/iobroker.modbus, node: v8.11.1
                  2018-06-21 09:30:30.654 - silly: modbus.2 inMem message modbus.2.* modbus.2.info.connection val=0, ack=true, ts=1529566230655, q=0, from=system.adapter.modbus.2, lc=1529535577826
                  2018-06-21 09:30:30.721 - error: modbus.2 uncaught exception: Cannot read property 'tcp' of undefined
                  2018-06-21 09:30:30.721 - error: modbus.2 TypeError: Cannot read property 'tcp' of undefined
                  at init (C:\dev\iobroker\node_modules\iobroker.modbus\lib\jsmodbus\transports\modbus-server-tcp.js:19:36)
                  at Object. (C:\dev\iobroker\node_modules\iobroker.modbus\lib\jsmodbus\transports\modbus-server-tcp.js:148:9)
                  at C:\dev\iobroker\node_modules\iobroker.modbus\node_modules\stampit\dist\stampit.js:185:31
                  at arrayEach (C:\dev\iobroker\node_modules\iobroker.modbus\node_modules\lodash\internal\arrayEach.js:15:9)
                  at C:\dev\iobroker\node_modules\iobroker.modbus\node_modules\lodash\internal\createForEach.js:15:9
                  at Factory (C:\dev\iobroker\node_modules\iobroker.modbus\node_modules\stampit\dist\stampit.js:177:48)
                  at Slave.initValues (C:\dev\iobroker\node_modules\iobroker.modbus\lib\slave.js:149:51)
                  at adapter.getStates (C:\dev\iobroker\node_modules\iobroker.modbus\lib\slave.js:141:13)
                  at C:\dev\iobroker\node_modules\iobroker.js-controller\lib\adapter.js:4036:61
                  at Socket. (C:\dev\iobroker\node_modules\iobroker.js-controller\lib\states\statesInMemClient.js:153:27)
                  2018-06-21 09:30:31.738 - error: Caught by controller[0]: TypeError: Cannot read property 'tcp' of undefined
                  2018-06-21 09:30:31.738 - error: Caught by controller[0]: at init (C:\dev\iobroker\node_modules\iobroker.modbus\lib\jsmodbus\transports\modbus-server-tcp.js:19:36)
                  2018-06-21 09:30:31.738 - error: Caught by controller[0]: at Object. (C:\dev\iobroker\node_modules\iobroker.modbus\lib\jsmodbus\transports\modbus-server-tcp.js:148:9)
                  2018-06-21 09:30:31.738 - error: Caught by controller[0]: at C:\dev\iobroker\node_modules\iobroker.modbus\node_modules\stampit\dist\stampit.js:185:31
                  2018-06-21 09:30:31.738 - error: Caught by controller[0]: at arrayEach (C:\dev\iobroker\node_modules\iobroker.modbus\node_modules\lodash\internal\arrayEach.js:15:9)
                  2018-06-21 09:30:31.738 - error: Caught by controller[0]: at C:\dev\iobroker\node_modules\iobroker.modbus\node_modules\lodash\internal\createForEach.js:15:9
                  2018-06-21 09:30:31.738 - error: Caught by controller[0]: at Factory (C:\dev\iobroker\node_modules\iobroker.modbus\node_modules\stampit\dist\stampit.js:177:48)
                  2018-06-21 09:30:31.738 - error: Caught by controller[0]: at Slave.initValues (C:\dev\iobroker\node_modules\iobroker.modbus\lib\slave.js:149:51)
                  2018-06-21 09:30:31.738 - error: Caught by controller[0]: at adapter.getStates (C:\dev\iobroker\node_modules\iobroker.modbus\lib\slave.js:141:13)
                  2018-06-21 09:30:31.738 - error: Caught by controller[0]: at C:\dev\iobroker\node_modules\iobroker.js-controller\lib\adapter.js:4036:61
                  2018-06-21 09:30:31.738 - error: Caught by controller[0]: at Socket. (C:\dev\iobroker\node_modules\iobroker.js-controller\lib\states\statesInMemClient.js:153:27)
                  2018-06-21 09:30:31.738 - error: host.ARBEITSZIMMER instance system.adapter.modbus.2 terminated with code 6 (uncaught exception)
                  2018-06-21 09:30:31.738 - info: host.ARBEITSZIMMER Restart adapter system.adapter.modbus.2 because enabled
                  

                  Hey, erst mal was positives aus dem Log: Der Adapter hat sowas wie Daten empfangen:

                  2018-06-21 09:30:30.654 - silly: modbus.2 inMem message modbus.2.* modbus.2.info.connection val=0, ack=true, ts=1529566230655, q=0, from=system.adapter.modbus.2, lc=1529535577826
                  

                  Hrrm…

                  1 Reply Last reply Reply Quote 0
                  • apollon77
                    apollon77 last edited by

                    Ja das eine exports war denke zuviel. Soweit war ich auch gekommen kurz bevor ich es hier gelesen habe 🙂

                    Ein TCP Objekt wird nur "gebaut" wenn slave gewählt ist … Ich hae mal was rumgebastelt. Bitte Github Version testen

                    Aber generell ist bei TCP noch was unvollständig!!

                    1 Reply Last reply Reply Quote 0
                    • Stabilostick
                      Stabilostick last edited by

                      Nope, leider nix guut.

                      [...npm install]
                      
                      2018-06-21 10:51:32.943 - info: iobroker url "https://github.com/ioBroker/ioBroker.modbus/tarball/master" modbus
                      2018-06-21 10:51:33.339 - info: iobroker install https://github.com/ioBroker/ioBroker.modbus/tarball/master
                      2018-06-21 10:51:33.399 - info: iobroker npm install https://github.com/ioBroker/ioBroker.modbus/tarball/master --production --prefix "C:/dev/iobroker" (System call)
                      2018-06-21 10:51:37.419 - info: iobroker npm
                      2018-06-21 10:51:37.419 - info: iobroker WARN deprecated parser-readline@1.0.2: reanmed to @serialport/parser-readline
                      2018-06-21 10:51:37.419 - info: iobroker npm
                      2018-06-21 10:51:37.419 - info: iobroker WARN deprecated parser-byte-length@1.0.2: renamed to @serialport/parser-byte-length
                      2018-06-21 10:51:37.419 - info: iobroker npm
                      2018-06-21 10:51:37.419 - info: iobroker WARN deprecated parser-cctalk@1.0.2: reanmed to @serialport/parser-cctalk
                      2018-06-21 10:51:37.419 - info: iobroker npm
                      2018-06-21 10:51:37.419 - info: iobroker WARN deprecated parser-delimiter@1.0.2: reanmed to @serialport/parser-delimiter
                      2018-06-21 10:51:37.428 - info: iobroker npm
                      2018-06-21 10:51:37.428 - info: iobroker WARN deprecated parser-ready@1.0.2: reanmed to @serialport/parser-readynpm WARN deprecated parser-regex@1.0.2: reanmed to @serialport/parser-regex
                      2018-06-21 10:51:42.728 - info: iobroker got C:/dev/iobroker/node_modules/iobroker.modbus/admin
                      2018-06-21 10:51:42.758 - info: iobroker upload [19] modbus.admin C:/dev/iobroker/node_modules/iobroker.modbus/admin/words.js words.js application/javascript
                      2018-06-21 10:51:42.838 - info: iobroker upload [18] modbus.admin C:/dev/iobroker/node_modules/iobroker.modbus/admin/modbus.png modbus.png image/png
                      2018-06-21 10:51:42.918 - info: iobroker upload [17] modbus.admin C:/dev/iobroker/node_modules/iobroker.modbus/admin/lib/js/jsgrid.js lib/js/jsgrid.js application/javascript
                      2018-06-21 10:51:42.995 - info: iobroker upload [16] modbus.admin C:/dev/iobroker/node_modules/iobroker.modbus/admin/lib/js/grid.locale-ru.js lib/js/grid.locale-ru.js application/javascript
                      2018-06-21 10:51:43.070 - info: iobroker upload [15] modbus.admin C:/dev/iobroker/node_modules/iobroker.modbus/admin/lib/js/grid.locale-de.js lib/js/grid.locale-de.js application/javascript
                      2018-06-21 10:51:43.125 - info: iobroker upload [14] modbus.admin C:/dev/iobroker/node_modules/iobroker.modbus/admin/lib/css/jsgrid.min.css lib/css/jsgrid.min.css text/css
                      2018-06-21 10:51:43.191 - info: iobroker upload [13] modbus.admin C:/dev/iobroker/node_modules/iobroker.modbus/admin/lib/css/jsgrid.css lib/css/jsgrid.css text/css
                      2018-06-21 10:51:43.256 - info: iobroker upload [12] modbus.admin C:/dev/iobroker/node_modules/iobroker.modbus/admin/lib/css/jsgrid-theme.min.css lib/css/jsgrid-theme.min.css text/css
                      2018-06-21 10:51:43.318 - info: iobroker upload [11] modbus.admin C:/dev/iobroker/node_modules/iobroker.modbus/admin/lib/css/jsgrid-theme.css lib/css/jsgrid-theme.css text/css
                      2018-06-21 10:51:43.398 - info: iobroker upload [10] modbus.admin C:/dev/iobroker/node_modules/iobroker.modbus/admin/index.html index.html text/html
                      2018-06-21 10:51:43.478 - info: iobroker upload [9] modbus.admin C:/dev/iobroker/node_modules/iobroker.modbus/admin/img/plc_back.png img/plc_back.png image/png
                      2018-06-21 10:51:43.558 - info: iobroker upload [8] modbus.admin C:/dev/iobroker/node_modules/iobroker.modbus/admin/i18n/ru/translations.json i18n/ru/translations.json application/json
                      2018-06-21 10:51:43.638 - info: iobroker upload [7] modbus.admin C:/dev/iobroker/node_modules/iobroker.modbus/admin/i18n/pt/translations.json i18n/pt/translations.json application/json
                      2018-06-21 10:51:43.719 - info: iobroker upload [6] modbus.admin C:/dev/iobroker/node_modules/iobroker.modbus/admin/i18n/pl/translations.json i18n/pl/translations.json application/json
                      2018-06-21 10:51:43.798 - info: iobroker upload [5] modbus.admin C:/dev/iobroker/node_modules/iobroker.modbus/admin/i18n/nl/translations.json i18n/nl/translations.json application/json
                      2018-06-21 10:51:43.878 - info: iobroker upload [4] modbus.admin C:/dev/iobroker/node_modules/iobroker.modbus/admin/i18n/it/translations.json i18n/it/translations.json application/json
                      2018-06-21 10:51:43.959 - info: iobroker upload [3] modbus.admin C:/dev/iobroker/node_modules/iobroker.modbus/admin/i18n/fr/translations.json i18n/fr/translations.json application/json
                      2018-06-21 10:51:44.039 - info: iobroker upload [2] modbus.admin C:/dev/iobroker/node_modules/iobroker.modbus/admin/i18n/es/translations.json i18n/es/translations.json application/json
                      2018-06-21 10:51:44.119 - info: iobroker upload [1] modbus.admin C:/dev/iobroker/node_modules/iobroker.modbus/admin/i18n/en/translations.json i18n/en/translations.json application/json
                      2018-06-21 10:51:44.199 - info: iobroker upload [0] modbus.admin C:/dev/iobroker/node_modules/iobroker.modbus/admin/i18n/de/translations.json i18n/de/translations.json application/json
                      2018-06-21 10:51:44.289 - info: iobroker exit 0
                      2018-06-21 10:51:44.400 - info: host.ARBEITSZIMMER Update repository "latest" under "http://download.iobroker.net/sources-dist-latest.json"
                      
                      [...running - oder eher nicht ;-) ]
                      
                      2018-06-21 10:52:09.228 - info: host.ARBEITSZIMMER object change system.adapter.modbus.2
                      2018-06-21 10:52:09.228 - info: host.ARBEITSZIMMER instance system.adapter.modbus.2 started with pid 8232
                      2018-06-21 10:52:09.658 - debug: modbus.2 objectDB connected
                      2018-06-21 10:52:09.668 - debug: modbus.2 statesDB connected
                      2018-06-21 10:52:09.688 - info: modbus.2 starting. Version 2.0.3 in C:/dev/iobroker/node_modules/iobroker.modbus, node: v8.11.1
                      2018-06-21 10:52:10.088 - silly: modbus.2 inMem message modbus.2.* modbus.2.info.connection val=0, ack=true, ts=1529571130088, q=0, from=system.adapter.modbus.2, lc=1529535577826
                      2018-06-21 10:52:10.159 - error: modbus.2 uncaught exception: Cannot read property 'tcp' of undefined
                      2018-06-21 10:52:10.159 - error: modbus.2 TypeError: Cannot read property 'tcp' of undefined
                      at init (C:\dev\iobroker\node_modules\iobroker.modbus\lib\jsmodbus\transports\modbus-server-tcp.js:19:36)
                      at Object. (C:\dev\iobroker\node_modules\iobroker.modbus\lib\jsmodbus\transports\modbus-server-tcp.js:148:9)
                      at C:\dev\iobroker\node_modules\iobroker.modbus\node_modules\stampit\dist\stampit.js:185:31
                      at arrayEach (C:\dev\iobroker\node_modules\iobroker.modbus\node_modules\lodash\internal\arrayEach.js:15:9)
                      at C:\dev\iobroker\node_modules\iobroker.modbus\node_modules\lodash\internal\createForEach.js:15:9
                      at Factory (C:\dev\iobroker\node_modules\iobroker.modbus\node_modules\stampit\dist\stampit.js:177:48)
                      at Slave.initValues (C:\dev\iobroker\node_modules\iobroker.modbus\lib\slave.js:149:51)
                      at adapter.getStates (C:\dev\iobroker\node_modules\iobroker.modbus\lib\slave.js:141:13)
                      at C:\dev\iobroker\node_modules\iobroker.js-controller\lib\adapter.js:4036:61
                      at Socket. (C:\dev\iobroker\node_modules\iobroker.js-controller\lib\states\statesInMemClient.js:153:27)
                      2018-06-21 10:52:11.167 - error: Caught by controller[0]: TypeError: Cannot read property 'tcp' of undefined
                      2018-06-21 10:52:11.167 - error: Caught by controller[0]: at init (C:\dev\iobroker\node_modules\iobroker.modbus\lib\jsmodbus\transports\modbus-server-tcp.js:19:36)
                      2018-06-21 10:52:11.167 - error: Caught by controller[0]: at Object. (C:\dev\iobroker\node_modules\iobroker.modbus\lib\jsmodbus\transports\modbus-server-tcp.js:148:9)
                      2018-06-21 10:52:11.167 - error: Caught by controller[0]: at C:\dev\iobroker\node_modules\iobroker.modbus\node_modules\stampit\dist\stampit.js:185:31
                      2018-06-21 10:52:11.167 - error: Caught by controller[0]: at arrayEach (C:\dev\iobroker\node_modules\iobroker.modbus\node_modules\lodash\internal\arrayEach.js:15:9)
                      2018-06-21 10:52:11.167 - error: Caught by controller[0]: at C:\dev\iobroker\node_modules\iobroker.modbus\node_modules\lodash\internal\createForEach.js:15:9
                      2018-06-21 10:52:11.167 - error: Caught by controller[0]: at Factory (C:\dev\iobroker\node_modules\iobroker.modbus\node_modules\stampit\dist\stampit.js:177:48)
                      2018-06-21 10:52:11.167 - error: Caught by controller[0]: at Slave.initValues (C:\dev\iobroker\node_modules\iobroker.modbus\lib\slave.js:149:51)
                      2018-06-21 10:52:11.167 - error: Caught by controller[0]: at adapter.getStates (C:\dev\iobroker\node_modules\iobroker.modbus\lib\slave.js:141:13)
                      2018-06-21 10:52:11.167 - error: Caught by controller[0]: at C:\dev\iobroker\node_modules\iobroker.js-controller\lib\adapter.js:4036:61
                      2018-06-21 10:52:11.167 - error: Caught by controller[0]: at Socket. (C:\dev\iobroker\node_modules\iobroker.js-controller\lib\states\statesInMemClient.js:153:27)
                      2018-06-21 10:52:11.167 - error: host.ARBEITSZIMMER instance system.adapter.modbus.2 terminated with code 6 (uncaught exception)
                      2018-06-21 10:52:11.167 - info: host.ARBEITSZIMMER Restart adapter system.adapter.modbus.2 because enabled
                      

                      Dem Weg würde ich folgen:

                      C:\dev\iobroker\node_modules\iobroker.modbus\lib\jsmodbus\transports\modbus-server-tcp.js:19:36

                      C:\dev\iobroker\node_modules\iobroker.modbus\lib\slave.js:149:51

                      1 Reply Last reply Reply Quote 0
                      • Stabilostick
                        Stabilostick last edited by

                        Ups, du hast verschlimmbessert. Die anderen Adapter (Master) bringen jetzt den folgenden Fehler:

                        2018-06-21 11:02:26.973 - info: host.ARBEITSZIMMER instance system.adapter.modbus.1 started with pid 25028
                        2018-06-21 11:02:27.412 - debug: modbus.1 objectDB connected
                        2018-06-21 11:02:27.422 - debug: modbus.1 statesDB connected
                        2018-06-21 11:02:27.436 - info: modbus.1 starting. Version 2.0.3 in C:/dev/iobroker/node_modules/iobroker.modbus, node: v8.11.1
                        2018-06-21 11:02:27.951 - info: history.0 enabled logging of modbus.1.inputRegisters.30775_AC_Leistung_Gesamt
                        2018-06-21 11:02:27.992 - info: history.0 enabled logging of modbus.1.inputRegisters.30803_Netzfrequenz
                        2018-06-21 11:02:28.032 - info: history.0 enabled logging of modbus.1.inputRegisters.30843_Batterie_Strom
                        2018-06-21 11:02:28.072 - info: history.0 enabled logging of modbus.1.inputRegisters.30845_Batterie_SOC
                        2018-06-21 11:02:28.112 - info: history.0 enabled logging of modbus.1.inputRegisters.30849_Batterie_Temperatur
                        2018-06-21 11:02:28.152 - info: history.0 enabled logging of modbus.1.inputRegisters.30851_Batterie_Spannung
                        2018-06-21 11:02:28.192 - info: history.0 enabled logging of modbus.1.inputRegisters.30855_Batterie_SetSpannung
                        2018-06-21 11:02:28.232 - info: history.0 enabled logging of modbus.1.inputRegisters.30861_Last_Leistung
                        2018-06-21 11:02:28.272 - info: history.0 enabled logging of modbus.1.inputRegisters.30867_Einspeiseleistung
                        2018-06-21 11:02:28.312 - info: history.0 enabled logging of modbus.1.inputRegisters.30869_PV_Gesamtleistung
                        2018-06-21 11:02:28.352 - info: history.0 enabled logging of modbus.1.inputRegisters.30873_Einverbrauchserhöhung
                        2018-06-21 11:02:29.514 - error: modbus.1 Socket Error
                        2018-06-21 11:02:29.514 - error: modbus.1 Client in error state.
                        2018-06-21 11:02:29.514 - warn: modbus.1 On error: {"code":"ECONNREFUSED","errno":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":502}
                        2018-06-21 11:02:29.515 - debug: modbus.1 Socket closed with error
                        2018-06-21 11:02:29.515 - debug: modbus.1 Cleaning up request fifo.
                        2018-06-21 11:02:30.521 - debug: modbus.1 Closing client on purpose.
                        2018-06-21 11:02:30.521 - debug: modbus.1 Closing client on purpose.
                        

                        7446_instances_-_iobroker.png

                        1 Reply Last reply Reply Quote 0
                        • apollon77
                          apollon77 last edited by

                          Ja ich sehe den grund … aber da bin ich jetzt raus ...

                          @Bluefus muss da ran. Das kann so nicht gehen ...

                          1 Reply Last reply Reply Quote 0
                          • Stabilostick
                            Stabilostick last edited by

                            Achtung, die von Bluefox auf Github eingestellte Version 2.0.4 ist weiterhin fehlerbehaftet. Es funktionieren bei TCP-Typ jetzt weder Master- noch-Slave-Konfigurationen. Damit Master wieder geht, in Datei "modbus-client-tcp.js" die Zeile 25 von

                            tcp.host = tcp.bind || 'localhost';
                            

                            nach

                            tcp.host = tcp.host || 'localhost';
                            

                            ändern.

                            Zudem sind mindestens in der Datei "slave.js" ab Zeile 150 weitere Anpassungen nötig, damit der Wert von "tcp" definiert ist:

                                 options: {
                                 tcp: {
                                        hostname: '127.0.0.1',  //??????
                                        port: parseInt(options.config.tcp.port, 10) || 502
                                 }},
                            

                            Übrig bleibt dann als nächstes die undefinierte "server"-Variable/Objekt? in

                            .compose(server.tcp.complete)
                            

                            ein paar Zeilen weiter unten.

                            Da gebe ich erst einmal auf… Ich kann leider kein Javascript.

                            1 Reply Last reply Reply Quote 0
                            • J
                              JackWolfskind last edited by

                              Habe auch gerade festgestellt das Modbus TCP mit der Version 2.0.4 nicht mehr geht und daher ein Issue auf github aufgemacht…

                              Update:

                              Mit der 2.0.6 ist Modbus TCP wieder gefixt!

                              1 Reply Last reply Reply Quote 0
                              • Stabilostick
                                Stabilostick last edited by

                                Nur der Master-Typ. Slave braucht noch. 😄

                                1 Reply Last reply Reply Quote 0
                                • Stabilostick
                                  Stabilostick last edited by

                                  Bluefox hat eine neue Revision der v2.0.6 auf Guthub bereitgestellt. Der TCP-Slave Modus soll laut seiner Angabe gefixed sein.

                                  Zwar sind die augenscheinlichen Exceptions jetzt weg. Leider findet bei mir aber mit der neuen Version keine Kommunikation statt. Der Status des Adapers bleibt auf gelb stehen.

                                  Ich verwende diese Konfiguration: 7446_2018-06-28_17_26_05-instances_-_iobroker.png

                                  In der Anleitung zum Adapter steht:

                                  Partner IP Address = IP address of modbus partner.

                                  Port = TCP Port of modbus partner if configured as master (client) or own port if configured as slave(server).

                                  Die Eingänge sind Holding Registers.

                                  Mit diesen Einstellungen hat V1.1.1 des Adpaters funktioniert. Jetzt wirft der Adapter v2.0.6(neu) den Fehler

                                  2018-06-28 11:56:28.913 - info: host.ARBEITSZIMMER instance system.adapter.modbus.2 started with pid 45604
                                  2018-06-28 11:56:29.331 - debug: modbus.2 objectDB connected
                                  2018-06-28 11:56:29.342 - debug: modbus.2 statesDB connected
                                  2018-06-28 11:56:29.342 - info: modbus.2 starting. Version 2.0.6 in C:/dev/iobroker/node_modules/iobroker.modbus, node: v8.11.1
                                  2018-06-28 11:56:29.612 - debug: modbus.2 Slave ready to start
                                  2018-06-28 11:56:29.682 - debug: modbus.2 server is listening on port
                                  2018-06-28 11:56:29.682 - debug: modbus.2 initiating read coils request handler.
                                  2018-06-28 11:56:29.682 - debug: modbus.2 setting request handler
                                  2018-06-28 11:56:29.682 - debug: modbus.2 initiating read discrete inputs request handler.
                                  2018-06-28 11:56:29.682 - debug: modbus.2 setting request handler
                                  2018-06-28 11:56:29.682 - debug: modbus.2 initiating read holding registers request handler.
                                  2018-06-28 11:56:29.682 - debug: modbus.2 setting request handler
                                  2018-06-28 11:56:29.682 - debug: modbus.2 initiating read input registers request handler.
                                  2018-06-28 11:56:29.682 - debug: modbus.2 setting request handler
                                  2018-06-28 11:56:29.682 - debug: modbus.2 initiating write multiple coils request handler.
                                  2018-06-28 11:56:29.682 - debug: modbus.2 setting request handler
                                  2018-06-28 11:56:29.682 - debug: modbus.2 initiating write multiple registers request handler.
                                  2018-06-28 11:56:29.682 - debug: modbus.2 setting request handler
                                  2018-06-28 11:56:29.682 - debug: modbus.2 initiating write single coil request handler.
                                  2018-06-28 11:56:29.682 - debug: modbus.2 setting request handler
                                  2018-06-28 11:56:29.682 - debug: modbus.2 initiating write single register request handler.
                                  2018-06-28 11:56:29.682 - debug: modbus.2 setting request handler
                                  2018-06-28 11:56:29.692 - error: modbus.2 uncaught exception: listen EADDRNOTAVAIL 192.168.179.28:502
                                  2018-06-28 11:56:29.692 - error: modbus.2 Error: listen EADDRNOTAVAIL 192.168.179.28:502
                                  at Object._errnoException (util.js:1022:11)
                                  at _exceptionWithHostPort (util.js:1044:20)
                                  at Server.setupListenHandle [as _listen2] (net.js:1350:19)
                                  at listenInCluster (net.js:1408:12)
                                  at doListen (net.js:1517:7)
                                  at _combinedTickCallback (internal/process/next_tick.js:141:11)
                                  at process._tickCallback (internal/process/next_tick.js:180:9)
                                  2018-06-28 11:56:29.692 - info: modbus.2 terminating
                                  2018-06-28 11:56:29.703 - error: Caught by controller[0]: { Error: listen EADDRNOTAVAIL 192.168.179.28:502
                                  2018-06-28 11:56:29.703 - error: Caught by controller[0]: at Object._errnoException (util.js:1022:11)
                                  2018-06-28 11:56:29.703 - error: Caught by controller[0]: at _exceptionWithHostPort (util.js:1044:20)
                                  2018-06-28 11:56:29.703 - error: Caught by controller[0]: at Server.setupListenHandle [as _listen2] (net.js:1350:19)
                                  2018-06-28 11:56:29.703 - error: Caught by controller[0]: at listenInCluster (net.js:1408:12)
                                  2018-06-28 11:56:29.703 - error: Caught by controller[0]: at doListen (net.js:1517:7)
                                  2018-06-28 11:56:29.703 - error: Caught by controller[0]: at _combinedTickCallback (internal/process/next_tick.js:141:11)
                                  2018-06-28 11:56:29.703 - error: Caught by controller[0]: at process._tickCallback (internal/process/next_tick.js:180:9)
                                  2018-06-28 11:56:29.703 - error: Caught by controller[0]: code: 'EADDRNOTAVAIL',
                                  2018-06-28 11:56:29.703 - error: Caught by controller[0]: errno: 'EADDRNOTAVAIL',
                                  2018-06-28 11:56:29.703 - error: Caught by controller[0]: syscall: 'listen',
                                  2018-06-28 11:56:29.703 - error: Caught by controller[0]: address: '192.168.179.28',
                                  2018-06-28 11:56:29.703 - error: Caught by controller[0]: port: 502 }
                                  2018-06-28 11:56:29.703 - error: host.ARBEITSZIMMER instance system.adapter.modbus.2 terminated with code 0 (OK)
                                  2018-06-28 11:56:29.703 - info: host.ARBEITSZIMMER Restart adapter system.adapter.modbus.2 because enabled
                                  

                                  Auf dem Modbus-Master 192.168.179.28 ist der Port 502 nicht geöffnet (war noch nie).

                                  Die Konfiguration auf dem Master, die mit Version 1.1.1 funktioniert hat, sieht so aus:
                                  7446_2018-06-28_17_02_42-cmi_ausg_nge.png

                                  Die Dokumentation des Masters sagt dazu:

                                  IP, Gerärt, Funktion, Adresse = Eingabe der IP-Adresse und der herstellerspezifischen Angaben des Modbus-Geräts (= Slave), an das der Wert gesendet wird

                                  Was nun? Mache ich etwas falsch? Muss ich 127.0.0.1 angeben beim Slave (funktioniert aber auch nicht!)?

                                  1 Reply Last reply Reply Quote 0
                                  • apollon77
                                    apollon77 last edited by

                                    du hast bei ioberoker in der Konfig aber "Master" ausgewählt. Wenn DU lesen willst bist Du eher ein Slave oder ?!

                                    1 Reply Last reply Reply Quote 0
                                    • Stabilostick
                                      Stabilostick last edited by

                                      Zwischenzeitlich ging der Master Mode bei der Version 2.0.6 (ohne neu) auch nicht. Im vorletzten Post zeige ich die Slave-Konfiguration für 2.0.6neu. Und ich will nicht lesen. Der ferne Master 192.168.179.28 schreibt in mich (192.168.179.56) als Slave rein.

                                      Also dürfte der ioBroker also gar nicht bei einer Slave-Konfiguration auf den Master zugreifen, oder?

                                      Wenn ich das so richtig verstanden habe…

                                      1 Reply Last reply Reply Quote 0
                                      • Stabilostick
                                        Stabilostick last edited by

                                        In der Version 1.1.2 stand noch in der Datei modbus-tcp-client.js

                                                    if (!this.protocolVersion) { this.protocolVersion = 0; }
                                                    if (!this.port) { this.port = 502; }
                                                    if (!this.host) { this.host = 'localhost'; }
                                                    if (!this.autoReconnect) { this.autoReconnect = false; }
                                                    if (!this.reconnectTimeout) { this.reconnectTimeout = 0; }
                                        

                                        Edit: Quatsch, was ich hier gerade schreibe. Steht nicht im Zusammenhang. Der Server-Prozess in modbus-tcp-server.js macht da nichts anderes:

                                                    if (!this.port) {
                                                        this.port = 502;
                                                    }
                                        
                                                    if (!this.hostname) {
                                                        this.hostname = '0.0.0.0';
                                                    }
                                                  server.listen(this.port, this.hostname, function (err) {
                                        [...]
                                        
                                        1 Reply Last reply Reply Quote 0
                                        • Stabilostick
                                          Stabilostick last edited by

                                          Der Modbus-Master hat auch ein Log.

                                          2018.06.28 23:10:01 [R854/V1.30.2] ( 39) Message: #FFFFFFFA Cannot connect to Modbus device

                                          Die Netzwerksockets sind am Master wie folgt:

                                          7446_b4014169-fac2-4757-800a-eb4ad168ec71.jpeg

                                          1 Reply Last reply Reply Quote 0
                                          • Stabilostick
                                            Stabilostick last edited by

                                            Setze ich die Partner-ID auf 127.0.0.1, dann überwacht der ioBroker (192.168.179.56) den lokalen Port 502:

                                             TCP    127.0.0.1:502          0.0.0.0:0              ABHÖREN       [node.exe]
                                            

                                            Jedoch sagt der Master weiterhin, dass er keine Verbindung zum Slave aufbauen kann.

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            929
                                            Online

                                            31.6k
                                            Users

                                            79.5k
                                            Topics

                                            1.3m
                                            Posts

                                            4
                                            24
                                            2297
                                            Loading More Posts
                                            • Oldest to Newest
                                            • Newest to Oldest
                                            • Most Votes
                                            Reply
                                            • Reply as topic
                                            Log in to reply
                                            Community
                                            Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                                            The ioBroker Community 2014-2023
                                            logo