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.
    • 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

                            947
                            Online

                            31.9k
                            Users

                            80.1k
                            Topics

                            1.3m
                            Posts

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