Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. ioBroker Allgemein
    4. Problem mit ioBroker Sma-em Adapter nach node update

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    Problem mit ioBroker Sma-em Adapter nach node update

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

      Dann bitte einen GitHub issue öffnen das es de entwickle auch mitbekommt.

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

        @Winni

        Die buffer-checks sind mit Node 10 wohl etwas penibler geworden:

        buf.readUIntBE(offset, byteLength)#

        offset <integer> Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - byteLength.
        byteLength <integer> Number of bytes to read. Must satisfy 0 < byteLength <= 6.
        Returns: <integer>

        Reads byteLength number of bytes from buf at the specified offset and interprets the result as an unsigned integer. Supports up to 48 bits of accuracy.

        IMHO nichts mit 8 Bytes lesen, wie im Source Code vorgesehen.

        Aber mit Node 12.0.0+: buf.readBigUInt64BE
        Da gibts was. :))

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

          @apollon77 ich hätte es ja glatt probiert, trotz meines eher mässigen englisch😏 , aber ich habe gesehen, dass das Problem bereits gemeldet wurde:
          https://github.com/CTJaeger/ioBroker.sma-em/issues/17

          andiling created this issue in CTJaeger/ioBroker.sma-em

          closed Node.js Version 10 not working #17

          apollon77 1 Reply Last reply Reply Quote 0
          • Winni
            Winni @Stabilostick last edited by

            @Stabilostick danke für dein posting, aber das was du schreibst ist für mich etwas 😉 zu hoch.

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

              @Winni muss auch nicht englisch. Deutsch geht meistens auch. Hauptsache issue anlegen!

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

                @apollon77 ok, habs hier dazu geschrieben.
                https://github.com/CTJaeger/ioBroker.sma-em/issues/17#issuecomment-503830658

                andiling created this issue in CTJaeger/ioBroker.sma-em

                closed Node.js Version 10 not working #17

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

                  Der Entwickler hat sich auf GitHub gemeldet, er will sich um die Sache kümmern.👍

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

                    Super, daher: Solche bestätigten Bugs und Probleme immer auf GitHub als Issue einstellen. Deutsch oder englisch ist egal und Links ins Forum helfen ggf mehr Kontext zu bekommen

                    1 Reply Last reply Reply Quote 0
                    • C
                      C1500 last edited by

                      Servus
                      Bei mir das gleiche Problem nach dem node Update.
                      Hoffentlich findet er bald das Problem.
                      Gruß Peer

                      1 Reply Last reply Reply Quote 0
                      • A
                        aftershowman last edited by

                        Hatte das selbe Problem.

                        Das Problem wurde ja schon "Gefunden/beschrieben".
                        Die verwendete Methode "buf.readUIntBE(offset, byteLength)" kann in node10 nur noch 6 Bytes lesen.
                        Ich hab auch keine andere Methode gefunden, die 8 Bit direkt in ein "int" einliest.
                        Ich hab keine Ahnung von Github.
                        Bin auch kein Java-Skript Guro.
                        Hab deshalb den Code direkt in der main.js angepasst.
                        Bei einer IObroker Linux Installation liegt die main.js hier:
                        /opt/iobroker/node_modules/iobroker.sma-em

                        Funktioniert bei mir.
                        Bekomme jetzt den Momentanverbrauch und den Bezugzähler alle 30s
                        Objekte.PNG
                        Hier die original und die geänderte Datei:
                        main.js main - org.js

                        Ich hab den Code jetzt so angepasst; dass wenn 8 Bytes gelesen werden sollen, werden diese als "string" gelesen und anschließend zu "int" konvertiert.
                        Weiterhin habe ich einen Timer eingebaut, der "nur" alle 30s das Multicast Paket abgreift.

                        Alle Änderungen wurden in der Funktion"read Data" gemacht.
                        Eingefügter Code ist "fett" markiert.

                        function readData() {
                        var client = dgram.createSocket('udp4');
                        var timer;

                        client.on('listening', function () {
                            client.setBroadcast(true);
                        });
                        
                        client.on('message', function (message, rinfo) {
                        	**if (!timer) {
                            timer = setTimeout(function () {
                                timer = null;
                            }, 30000);**
                        
                        	var ser = message.readUIntBE(points['SMASerial'].offset, points['SMASerial'].length) * points['SMASerial'].factor;
                        	 adapter.setObjectNotExists(ser, {
                           		 type: 'channel',
                         		 common: {
                             	 name: ser,
                            	 type: 'channel'
                           		 },
                            native: {}
                        });
                            
                        if (!connected) {
                                connected = true;
                                adapter.setState('info.connection', true, true);
                            }
                        
                            for (var point in points) {
                                if (points.hasOwnProperty(point)) {
                                    //adapter.log.info('Name: ' + point + 'offset: ' + points[point].offset + 'length: ' + points[point].length + 'factor: ' + points[point].factor);
                        			**if (points[point].length == 8) {
                        				var val1 = message.toString('hex', points[point].offset, points[point].offset + 8);
                        				//adapter.log.info('val1 : ' + val1);
                        				var val = parseInt(val1, 16);
                        				//adapter.log.info('val nach toInt : ' + val);
                        				val = val * points[point].factor;
                        				//adapter.log.info('val nach Multi: ' + val);
                        			} else {**
                        				var val = message.readUIntBE(points[point].offset, points[point].length) * points[point].factor;
                        			**}**
                                    if (points[point].val === undefined || points[point].val !== val) {
                                        points[point].val = val;
                                        adapter.setObjectNotExists (adapter.namespace + '.' + ser + '.' + point, {
                        				type: 'state',
                        				role: 'value',
                        				common: {
                        					name: point,
                        					type: 'state',
                        					role: 'value'
                        					},
                        				native: {}
                        		});
                        		adapter.setState (ser + '.' + point, val,true);
                                    }
                                }
                            }
                        	**}**
                        });
                        apollon77 1 Reply Last reply Reply Quote 0
                        • Heimerdinger
                          Heimerdinger last edited by

                          Wie überschreibe ich eigentlich die main.js?
                          Stoppen des Adapters und/oder des iobrokers reicht wohl nicht.

                          Danke

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

                            @aftershowman mach doch mal einen pull request auf GitHub beim Adapter.

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

                              Hallo in die Runde, der Entwickler hat angekündigt, dass er den Adapter an die Community Adapter Crew übergeben möchte. Ich denke das dies bedeutet, dass es mit dem Adapter weiter geht, was mich natürlich sehr freut. 👍

                              1 Reply Last reply Reply Quote 0
                              • A
                                andiling last edited by

                                Hallo, bin zwar nicht der Entwickler des Adapters aber ich habe eine Lösung für Node 8 - einschliesslich 12 erarbeitet. Ich muss die Daten noch verifizieren aber der Adapter scheint jetzt für Node 10 auch zu laufen. Warten wir mal noch paar Tage ab auf den Transfer zu Community Adapter dann werde ich relativ zeitnah den Adapter updaten!

                                Wer Lust hat kann ja mal für Node 10 testen! Hier die Datei einfach ersetzen und Adapter neu starten!
                                Feedback wäre super!
                                Gruß

                                Andi

                                main.js

                                Winni 2 Replies Last reply Reply Quote 2
                                • Winni
                                  Winni @andiling last edited by

                                  @andiling Super, vielen Dank dafür 🙂

                                  1 Reply Last reply Reply Quote 0
                                  • S
                                    stephane last edited by

                                    Ist e denn schon absehbar wann der Bug im normalen Updateprozess behoben sind?
                                    Ich hab das mit dem Manuellen Fix mal versucht, der Adapter startet aber leider immer noch nicht 😞

                                    1 Reply Last reply Reply Quote 0
                                    • Winni
                                      Winni @andiling last edited by

                                      @andiling sagte in Problem mit ioBroker Sma-em Adapter nach node update:

                                      Hallo, bin zwar nicht der Entwickler des Adapters aber ich habe eine Lösung für Node 8 - einschliesslich 12 erarbeitet. Ich muss die Daten noch verifizieren aber der Adapter scheint jetzt für Node 10 auch zu laufen. Warten wir mal noch paar Tage ab auf den Transfer zu Community Adapter dann werde ich relativ zeitnah den Adapter updaten!

                                      Wer Lust hat kann ja mal für Node 10 testen! Hier die Datei einfach ersetzen und Adapter neu starten!
                                      Feedback wäre super!
                                      Gruß

                                      Andi

                                      main.js

                                      Hallo, ich wollte mal nachfragen, wie hier der Stand der Dinge ist.
                                      Wenn ichdie main.js mit der der Version aus deinem post ersetze bleibt der Adapter rot und im Log sind diese Fehler:

                                      host.winni-NUC6CAYH	2020-01-05 12:37:58.844	error	instance system.adapter.sma-em.0 terminated with code 1 (JS_CONTROLLER_STOPPED)
                                      host.winni-NUC6CAYH	2020-01-05 12:37:58.844	error	Caught by controller[0]: at bootstrap_node.js:625:3
                                      host.winni-NUC6CAYH	2020-01-05 12:37:58.844	error	Caught by controller[0]: at startup (bootstrap_node.js:204:16)
                                      host.winni-NUC6CAYH	2020-01-05 12:37:58.844	error	Caught by controller[0]: at Function.Module.runMain (module.js:694:10)
                                      host.winni-NUC6CAYH	2020-01-05 12:37:58.844	error	Caught by controller[0]: at Function.Module._load (module.js:498:3)
                                      host.winni-NUC6CAYH	2020-01-05 12:37:58.843	error	Caught by controller[0]: at tryModuleLoad (module.js:506:12)
                                      host.winni-NUC6CAYH	2020-01-05 12:37:58.843	error	Caught by controller[0]: at Module.load (module.js:566:32)
                                      host.winni-NUC6CAYH	2020-01-05 12:37:58.843	error	Caught by controller[0]: at Object.Module._extensions..js (module.js:664:10)
                                      host.winni-NUC6CAYH	2020-01-05 12:37:58.843	error	Caught by controller[0]: at Module._compile (module.js:617:28)
                                      host.winni-NUC6CAYH	2020-01-05 12:37:58.842	error	Caught by controller[0]: at Object.runInThisContext (vm.js:139:10)
                                      host.winni-NUC6CAYH	2020-01-05 12:37:58.842	error	Caught by controller[0]: at createScript (vm.js:80:10)
                                      host.winni-NUC6CAYH	2020-01-05 12:37:58.842	error	Caught by controller[0]: SyntaxError: Invalid or unexpected token
                                      host.winni-NUC6CAYH	2020-01-05 12:37:58.841	error	Caught by controller[0]: ^^
                                      host.winni-NUC6CAYH	2020-01-05 12:37:58.841	error	Caught by controller[0]: var val = Number(((highbyte << 32n) + lowbyte));
                                      host.winni-NUC6CAYH	2020-01-05 12:37:58.840	error	Caught by controller[0]: /opt/iobroker/node_modules/iobroker.sma-em/main.js:76
                                      

                                      Zurück auf die orginal main.js läufts wieder, aber klar, nicht auf der 10.x. 😉
                                      Bin für jede Hilfestellung dankbar 🙂

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

                                        @Winni da ist ein „n“ Zuviel nach der 32

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

                                          @apollon77 vielen Dank für die schnelle Hilfe, nach der Korrektur läuft es unter 8.17 aber leider nicht unter 10.18 😞
                                          da bleibt der Adapter rot und der Log schaut es so aus:

                                          host.winni-NUC6CAYH	2020-01-05 13:42:03.970	error	Caught by controller[0]: at UDP.onMessage [as onmessage] (dgram.js:628:8)
                                          host.winni-NUC6CAYH	2020-01-05 13:42:03.970	error	Caught by controller[0]: at Socket.emit (events.js:198:13)
                                          host.winni-NUC6CAYH	2020-01-05 13:42:03.969	error	Caught by controller[0]: at Socket.<anonymous> (/opt/iobroker/node_modules/iobroker.sma-em/main.js:76:53)
                                          host.winni-NUC6CAYH	2020-01-05 13:42:03.969	error	Caught by controller[0]: TypeError: Cannot mix BigInt and other types, use explicit conversions
                                          sma-em.0	2020-01-05 13:42:03.444	info	(4206) Terminated (NO_ERROR): Without reason
                                          sma-em.0	2020-01-05 13:42:03.443	info	(4206) terminating
                                          sma-em.0	2020-01-05 13:42:03.395	info	(4206) cleaned everything up...
                                          sma-em.0	2020-01-05 13:42:03.394	error	(4206) TypeError: Cannot mix BigInt and other types, use explicit conversions at Socket.<anonymous> (/opt/iobroker/node_modules/iobroker.sma-em/main.js:76:53) at Socket.emit (events.js:198:13)
                                          sma-em.0	2020-01-05 13:42:03.394	error	(4206) uncaught exception: Cannot mix BigInt and other types, use explicit conversions
                                          sma-em.0	2020-01-05 13:42:02.553	info	(4206) Details L1 false Details L2 false Details L3 false
                                          sma-em.0	2020-01-05 13:42:02.553	info	(4206) Listen via UDP on Port 9522 for Multicast IP 239.12.255.254
                                          sma-em.0	2020-01-05 13:42:02.510	info	(4206) starting. Version 0.5.3 in /opt/iobroker/node_modules/iobroker.sma-em, node: v10.18.0
                                          host.winni-NUC6CAYH	2020-01-05 13:42:02.555	info	instance system.adapter.sma-speedwire.1 terminated with code 0 (NO_ERROR)
                                          sma-speedwire.1	2020-01-05 13:42:01.474	info	(4193) starting. Version 0.6.6 in /opt/iobroker/node_modules/iobroker.sma-speedwire, node: v10.18.0
                                          host.winni-NUC6CAYH	2020-01-05 13:42:00.956	info	instance system.adapter.sma-em.0 started with pid 4206
                                          host.winni-NUC6CAYH	2020-01-05 13:42:00.022	info	instance system.adapter.sma-speedwire.1 started with pid 4193
                                          host.winni-NUC6CAYH	2020-01-05 13:41:36.554	info	instance system.adapter.sma-speedwire.1 terminated with code 0 (NO_ERROR)
                                          sma-speedwire.1	2020-01-05 13:41:35.487	info	(4177) starting. Version 0.6.6 in /opt/iobroker/node_modules/iobroker.sma-speedwire, node: v10.18.0
                                          host.winni-NUC6CAYH	2020-01-05 13:41:34.040	info	instance system.adapter.sma-speedwire.1 started with pid 4177
                                          host.winni-NUC6CAYH	2020-01-05 13:41:32.557	info	instance system.adapter.sma-speedwire.0 terminated with code 0 (NO_ERROR)
                                          sma-speedwire.0	2020-01-05 13:41:31.469	info	(4162) starting. Version 0.6.6 in /opt/iobroker/node_modules/iobroker.sma-speedwire, node: v10.18.0
                                          host.winni-NUC6CAYH	2020-01-05 13:41:30.941	info	Restart adapter system.adapter.sma-em.0 because enabled
                                          host.winni-NUC6CAYH	2020-01-05 13:41:30.941	info	instance system.adapter.sma-em.0 terminated with code 0 (NO_ERROR)
                                          host.winni-NUC6CAYH	2020-01-05 13:41:30.941	error	Caught by controller[0]: at UDP.onMessage [as onmessage] (dgram.js:628:8)
                                          host.winni-NUC6CAYH	2020-01-05 13:41:30.941	error	Caught by controller[0]: at Socket.emit (events.js:198:13)
                                          host.winni-NUC6CAYH	2020-01-05 13:41:30.941	error	Caught by controller[0]: at Socket.<anonymous> (/opt/iobroker/node_modules/iobroker.sma-em/main.js:76:53)
                                          host.winni-NUC6CAYH	2020-01-05 13:41:30.940	error	Caught by controller[0]: TypeError: Cannot mix BigInt and other types, use explicit conversions
                                          sma-em.0	2020-01-05 13:41:30.411	info	(4147) Terminated (NO_ERROR): Without reason
                                          sma-em.0	2020-01-05 13:41:30.410	info	(4147) terminating
                                          sma-em.0	2020-01-05 13:41:30.400	info	(4147) cleaned everything up...
                                          sma-em.0	2020-01-05 13:41:30.399	error	(4147) TypeError: Cannot mix BigInt and other types, use explicit conversions at Socket.<anonymous> (/opt/iobroker/node_modules/iobroker.sma-em/main.js:76:53) at Socket.emit (events.js:198:13)
                                          sma-em.0	2020-01-05 13:41:30.398	error	(4147) uncaught exception: Cannot mix BigInt and other types, use explicit conversions
                                          

                                          zurück auf die 8.17 und es läuft wieder, ohne die main.js nochmal mit der orginalen ersetzt zu haben, also mit der Version von @andiling

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

                                            @Winni Also ist das "n" wohl doch nötig gewesen ...

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate
                                            FAQ Cloud / IOT
                                            HowTo: Node.js-Update
                                            HowTo: Backup/Restore
                                            Downloads
                                            BLOG

                                            663
                                            Online

                                            31.9k
                                            Users

                                            80.1k
                                            Topics

                                            1.3m
                                            Posts

                                            problem mit node 10.16
                                            8
                                            23
                                            2047
                                            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