Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Umstellung auf "axios"

    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

    Umstellung auf "axios"

    This topic has been deleted. Only users with topic management privileges can see it.
    • Wal
      Wal Developer @bahnuhr last edited by

      @bahnuhr sagte in Umstellung auf "axios":

      Gibts da irgendwo mehr infos ?

      Ja bei google.
      Du musst auch nicht axios nehmen, es funktioniert auch http.

      bahnuhr 1 Reply Last reply Reply Quote 0
      • G
        glitzi @glitzi last edited by

        @OliverIO
        Puhh ich glaube ich bin etwas weiter... trotzdem drehe ich mich irgendwie im Kreis .

        16:53:20.267	error	javascript.0 (6088) script.js.Guntamatic.Guntamatic_Daten_aus_Http_Seite_Parsen_axios: schedule callback missing
        
        createState('Guntamatic_Betrieb_0');
        createState('Guntamatic_Aussentemperatur_1');
        createState('Guntamatic_Kesseltemperatur_3');
        createState('Guntamatic_Leistung_5');
        createState('Guntamatic_Rücklauf_6');
        createState('Guntamatic_CO2_Gehalt_8');
        createState('Guntamatic_Puffer_oben_17');
        createState('Guntamatic_Puffer_unten_19');
        createState('Guntamatic_Pumpe_HP0_20');
        createState('Guntamatic_Warmwasser_21');
        createState('Guntamatic_Vorlauf_31');
        createState('Guntamatic_Füllstand_65');
        createState('Guntamatic_Kesselfreigabe_68');
        createState('Guntamatic_Programm_69');
        createState('Guntamatic_Programm_HK1_71');
        createState('Guntamatic_Stoer0_79');
        createState('Guntamatic_Stoer1_80');
        createState('Guntamatic_Asche_entleeren_85');
        createState('Guntamatic_Brennstoffzähler_89');
        createState('Guntamatic_Pufferladung_90');
        createState('Guntamatic_CO2_Gehalt_korrigiert');
        
        const axios=require('axios');
        
        schedule("*/5 * * * * *",
        
        	axios.post('http://xx.xx.xx.xx/daqdata.cgi?key=xxxx', {
        		responseEncoding: 'latin1'
        	})
        
        	.then(function(response) {
        			//console.log(response);
        
        			if (response.data) {
        
        				var parts = response.data.split('\n');
        
        				var parts_Guntamatic = parts[0];
        				setState('Guntamatic_Betrieb_0', parts_Guntamatic, true);
        
        				var parts_Guntamatic = parts[1];
        				setState('Guntamatic_Aussentemperatur_1', parts_Guntamatic, true);
        
        				var parts_Guntamatic = parts[3];
        				setState('Guntamatic_Kesseltemperatur_3', parts_Guntamatic, true);
        
        				var parts_Guntamatic = parts[5];
        				setState('Guntamatic_Leistung_5', parts_Guntamatic, true);
        
        				var parts_Guntamatic = parts[6];
        				setState('Guntamatic_Rücklauf_6', parts_Guntamatic, true);
        
        				var parts_Guntamatic = parts[8];
        				setState('Guntamatic_CO2_Gehalt_8', parts_Guntamatic, true);
        
        				var parts_Guntamatic = parts[17];
        				setState('Guntamatic_Puffer_oben_17', parts_Guntamatic, true);
        
        				var parts_Guntamatic = parts[19];
        				setState('Guntamatic_Puffer_unten_19', parts_Guntamatic, true);
        
        				var parts_Guntamatic = parts[20];
        				setState('Guntamatic_Pumpe_HP0_20', parts_Guntamatic, true);
        
        				var parts_Guntamatic = parts[21];
        				setState('Guntamatic_Warmwasser_21', parts_Guntamatic, true);
        
        				var parts_Guntamatic = parts[31];
        				setState('Guntamatic_Vorlauf_31', parts_Guntamatic, true);
        
        				var parts_Guntamatic = parts[65];
        				setState('Guntamatic_Füllstand_65', parts_Guntamatic, true);
        
        				var parts_Guntamatic = parts[68];
        				setState('Guntamatic_Kesselfreigabe_68', parts_Guntamatic, true);
        
        				var parts_Guntamatic = parts[69];
        				setState('Guntamatic_Programm_69', parts_Guntamatic, true);
        
        				var parts_Guntamatic = parts[71];
        				setState('Guntamatic_Programm_HK1_71', parts_Guntamatic, true);
        
        				var parts_Guntamatic = parts[79];
        				setState('Guntamatic_Stoer0_79', parts_Guntamatic, true);
        
        				var parts_Guntamatic = parts[80];
        				setState('Guntamatic_Stoer1_80', parts_Guntamatic, true);
        
        				var parts_Guntamatic = parts[85];
        				setState('Guntamatic_Asche_entleeren_85', parts_Guntamatic, true);
        
        				var parts_Guntamatic = parts[89];
        				setState('Guntamatic_Brennstoffzähler_89', parts_Guntamatic, true);
        
        				var parts_Guntamatic = parts[90];
        				setState('Guntamatic_Pufferladung_90', parts_Guntamatic, true);
        
        				/*
        				CO2 Korrigieren da der Wert im Leerlauf teils 18.00 annimmt.
        				parts[5] = Leistung parts[8] = CO2 Gehalt
        				*/
        
        				if (parts[5] == 0) {
        					setState("Guntamatic_CO2_Gehalt_korrigiert", 0, true);
        				} else {
        					setState("Guntamatic_CO2_Gehalt_korrigiert", parts[8], true);
        				}
        
        			}
        		
        
        
            })
        
        );
        
        1 Reply Last reply Reply Quote 0
        • bahnuhr
          bahnuhr Forum Testing Most Active @Wal last edited by

          @wal sagte in Umstellung auf "axios":

          Du musst auch nicht axios nehmen, es funktioniert auch http.

          hast du mal ein Beispiel ?

          OliverIO 1 Reply Last reply Reply Quote 0
          • OliverIO
            OliverIO @bahnuhr last edited by

            @bahnuhr
            das ist aber alles sehr ähnlich.
            Noch einfacher geht nicht wirklich

            1 Reply Last reply Reply Quote 0
            • T
              tombox @Thomas Braun last edited by tombox

              @thomas-braun Ich denke auch mit 50.000 Dependents wird es wohl nie entfernt werden können. Also kann der kleine ioBroker Skripter sich mit der Umstellung noch zeit lassen.
              @glitzi
              der schedule wird nicht richtig aufgemacht

              schedule("*/5 * * * * *", function(){
              	axios.post('http://xx.xx.xx.xx/daqdata.cgi?key=xxxx', {
              		responseEncoding: 'latin1'
              	})
              	.then(function(response) {
              			//console.log(response);
                       })
              })
              
              OliverIO G 2 Replies Last reply Reply Quote 0
              • OliverIO
                OliverIO @tombox last edited by OliverIO

                @tombox
                und wenn es aus iobroker entfernt wird, dann lädt man es selbst nach.
                es ist ja nicht so das es da sicherheitsbedenken gibt, sonder das die bibliothekt zu ende entwickelt ist.

                T 1 Reply Last reply Reply Quote 0
                • T
                  tombox @OliverIO last edited by

                  @oliverio Korrekt solange es kein security problem gibt wäre es auch ziemlich gemein es aus der iobroker skript default package rauszunehmen

                  1 Reply Last reply Reply Quote 0
                  • G
                    glitzi @tombox last edited by

                    @tombox

                    SUPER, vielen Dank! jetzt läuft es !!!

                    👍

                    1 Reply Last reply Reply Quote 0
                    • G
                      glitzi @AlCalzone last edited by

                      @alcalzone

                      Leider scheint das Encoding nicht zu funktionieren, ist hier etwas falsch?

                      const axios=require('axios');
                      
                      schedule("*/5 * * * * *", function(){
                      
                      	axios.post('http://xx.xx.xx.xx/daqdata.cgi?key=abcde', {
                      		responseEncoding: 'utf-8'
                      	})
                      
                      	.then(function(response) {
                      		
                      			if (response.data) {
                      
                      				var parts = response.data.split('\n');
                      
                      				var parts_Guntamatic = parts[0];
                      				setState('Guntamatic_Betrieb_0', parts_Guntamatic, true);
                      
                      
                      OliverIO 2 Replies Last reply Reply Quote 0
                      • OliverIO
                        OliverIO @glitzi last edited by

                        @glitzi

                        das sind zu wenig informationen.
                        in was ist den die quelle encodiert?
                        utf8 scheint es ja nicht zu sein.
                        woran erkennst du es das das encoding nicht funktioniert?

                        G 1 Reply Last reply Reply Quote 0
                        • G
                          glitzi @OliverIO last edited by glitzi

                          @oliverio
                          Laut Hersteller utf8, in meinem alten Skript mit request und latin hat es funktioniert.

                          var request= require('request');
                          request.post({
                            url:     'http://xx.xx.xx.xx/daqdata.cgi?key=xxx...xxx',
                            encoding: 'latin1'
                          
                          1 Reply Last reply Reply Quote 0
                          • OliverIO
                            OliverIO @glitzi last edited by

                            @glitzi sagte in Umstellung auf "axios":

                            Guntamatic

                            hat es damit etwas zu tun
                            https://next.openhab.org/addons/bindings/guntamatic/?
                            da steht dann was von
                            windows-1252

                            G 1 Reply Last reply Reply Quote 0
                            • G
                              glitzi @OliverIO last edited by

                              @oliverio

                              z.B. Steht bei Zündung dann Z?ndung

                              OliverIO 1 Reply Last reply Reply Quote 0
                              • OliverIO
                                OliverIO @glitzi last edited by OliverIO

                                @glitzi
                                dann trag latin1 ein
                                da steht doch jetzt utf-8
                                zeile 6

                                G 1 Reply Last reply Reply Quote 0
                                • G
                                  glitzi @OliverIO last edited by glitzi

                                  @oliverio

                                  oh.. ja das kommt von meinen versuchen, da es mit latin1 nicht funktionier hat.

                                  Ist denn mein Skript fehlerfrei?

                                  OliverIO 1 Reply Last reply Reply Quote 0
                                  • OliverIO
                                    OliverIO @glitzi last edited by

                                    @glitzi

                                    nein, es fehlen diverse schließende klammern.
                                    kommt aber auch evtl davon das du dein skript nicht komplett kopiert hast

                                    G 1 Reply Last reply Reply Quote 0
                                    • G
                                      glitzi @OliverIO last edited by glitzi

                                      @oliverio

                                      so eben noch einmal alles probiert, ich habe alle möglichen Encodings ausprobiert, es ändert sich nichts, habe das Gefühl es wird überhaupt nicht berücksichtigt.

                                      Bei umlauten kommt immer das �

                                      Hier noch einmal das gesamte Skript

                                      const axios=require('axios');
                                      
                                      schedule("*/5 * * * * *", function(){
                                      
                                      	axios.post('http://xx.xx.xx.x/daqdata.cgi?key=abcxyz', {
                                      		responseEncoding: 'latin1'
                                      	})
                                      
                                      	.then(function(response) {
                                      		
                                      			if (response.data) {
                                                      //console.log(response.data);
                                      				var parts = response.data.split('\n');
                                      
                                      				var parts_Guntamatic = parts[0];
                                      				setState('Guntamatic_Betrieb_0', parts_Guntamatic, true);
                                      
                                      				var parts_Guntamatic = parts[1];
                                      				setState('Guntamatic_Aussentemperatur_1', parts_Guntamatic, true);
                                      
                                      				var parts_Guntamatic = parts[3];
                                      				setState('Guntamatic_Kesseltemperatur_3', parts_Guntamatic, true);
                                      
                                      				var parts_Guntamatic = parts[5];
                                      				setState('Guntamatic_Leistung_5', parts_Guntamatic, true);
                                      
                                      				var parts_Guntamatic = parts[6];
                                      				setState('Guntamatic_Rücklauf_6', parts_Guntamatic, true);
                                      
                                      				var parts_Guntamatic = parts[8];
                                      				setState('Guntamatic_CO2_Gehalt_8', parts_Guntamatic, true);
                                      
                                      				var parts_Guntamatic = parts[17];
                                      				setState('Guntamatic_Puffer_oben_17', parts_Guntamatic, true);
                                      
                                      				var parts_Guntamatic = parts[19];
                                      				setState('Guntamatic_Puffer_unten_19', parts_Guntamatic, true);
                                      
                                      				var parts_Guntamatic = parts[20];
                                      				setState('Guntamatic_Pumpe_HP0_20', parts_Guntamatic, true);
                                      
                                      				var parts_Guntamatic = parts[21];
                                      				setState('Guntamatic_Warmwasser_21', parts_Guntamatic, true);
                                      
                                      				var parts_Guntamatic = parts[31];
                                      				setState('Guntamatic_Vorlauf_31', parts_Guntamatic, true);
                                      
                                      				var parts_Guntamatic = parts[65];
                                      				setState('Guntamatic_Füllstand_65', parts_Guntamatic, true);
                                      
                                      				var parts_Guntamatic = parts[68];
                                      				setState('Guntamatic_Kesselfreigabe_68', parts_Guntamatic, true);
                                      
                                      				var parts_Guntamatic = parts[69];
                                      				setState('Guntamatic_Programm_69', parts_Guntamatic, true);
                                      
                                      				var parts_Guntamatic = parts[71];
                                      				setState('Guntamatic_Programm_HK1_71', parts_Guntamatic, true);
                                      
                                      				var parts_Guntamatic = parts[79];
                                      				setState('Guntamatic_Stoer0_79', parts_Guntamatic, true);
                                      
                                      				var parts_Guntamatic = parts[80];
                                      				setState('Guntamatic_Stoer1_80', parts_Guntamatic, true);
                                      
                                      				var parts_Guntamatic = parts[85];
                                      				setState('Guntamatic_Asche_entleeren_85', parts_Guntamatic, true);
                                      
                                      				var parts_Guntamatic = parts[89];
                                      				setState('Guntamatic_Brennstoffzähler_89', parts_Guntamatic, true);
                                      
                                      				var parts_Guntamatic = parts[90];
                                      				setState('Guntamatic_Pufferladung_90', parts_Guntamatic, true);
                                      
                                      				/*
                                      				CO2 Korrigieren da der Wert im Leerlauf teils 18.00 annimmt.
                                      				parts[5] = Leistung parts[8] = CO2 Gehalt
                                      				*/
                                      
                                      				if (parts[5] == 0) {
                                      					setState("Guntamatic_CO2_Gehalt_korrigiert", 0, true);
                                      				} else {
                                      					setState("Guntamatic_CO2_Gehalt_korrigiert", parts[8], true);
                                      				}
                                      
                                      			}
                                      
                                      
                                      
                                          })
                                      
                                      })
                                      
                                      G 1 Reply Last reply Reply Quote 0
                                      • G
                                        glitzi @glitzi last edited by

                                        @glitzi
                                        Ergänzung,

                                        mit

                                        axios.get('http://xx.xx.xx.x/daqdata.cgi?key=abcxyz', {
                                        		responseEncoding: 'latin1'
                                        	})
                                        

                                        wird der Eintrag bei Encoding berücksichtigt, ich gehe wieder in den Test

                                        OliverIO 1 Reply Last reply Reply Quote 0
                                        • OliverIO
                                          OliverIO @glitzi last edited by

                                          @glitzi

                                          ob get oder post dürfte da kein unterschied machen.
                                          aber gut wenn es funktioniert

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

                                          Support us

                                          ioBroker
                                          Community Adapters
                                          Donate

                                          825
                                          Online

                                          31.8k
                                          Users

                                          80.0k
                                          Topics

                                          1.3m
                                          Posts

                                          9
                                          33
                                          1867
                                          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