Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. ioBroker Allgemein
    4. API Werte in ioBroker

    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

    API Werte in ioBroker

    This topic has been deleted. Only users with topic management privileges can see it.
    • Homoran
      Homoran Global Moderator Administrators @Wuschl last edited by

      @wuschl sagte in API Werte in ioBroker:

      Per ip werden mir die Daten im Browser angezeigt.

      und wo liegt dein Problem?
      mit der Logikmaschine deiner Wahl die IP aufrufen und die Antwort auswerten und in eigene Datenpunkte schreiben.

      W 1 Reply Last reply Reply Quote 0
      • W
        Wuschl @Homoran last edited by

        @homoran Logikmaschine? Ich check es einfach nicht. Wie muss ich das mit Simple-API handhaben? Ich habe die Datenpunkte erstellt, und in Javascript ein Script eingefügt, das bringt aber leider keine Daten, nur eine Fehlermeldung.

        const url = 'http://192.168.30.127/api/fetch'; // IP-Adresse eintragen !
        const idTemp = '0_userdata.0.EZOGateway.Temperatur';
        const idPH = '0_userdata.0.EZOGateway.pH_Wert';
        const idRedox = '0_userdata.0.EZOGateway.Redox_Potential';
         
        schedule('* * * * *', function() { // jede Minute
            request(url, function(error, response, result) {
                let obj = JSON.parse(result);
                setState(idTemp, obj['1'].Value, true);
                setState(idPH, obj['2'].Value, true);
                setState(idRedox, obj['3'].Value, true);
            });
        });
        
        javascript.0	09:26:00.004	error	at Object.<anonymous> (script.js.Pool.PoolLab:8:5)
        
        Homoran 1 Reply Last reply Reply Quote 0
        • Homoran
          Homoran Global Moderator Administrators @Wuschl last edited by

          @wuschl sagte in API Werte in ioBroker:

          Wie muss ich das mit Simple-API handhaben? Ich habe die Datenpunkte erstellt,

          von simple api war bisher keine Rede!

          @wuschl sagte in API Werte in ioBroker:

          Logikmaschine? Ich check es einfach nicht. ...und in Javascript ein Script eingefügt,

          Das wäre eine der möglichen Logikmaschinen.

          @wuschl sagte in API Werte in ioBroker:

          nur eine Fehlermeldung.

          wenn das diese ist,

          @wuschl sagte in API Werte in ioBroker:

          javascript.0 09:26:00.004 error at Object.<anonymous> (script.js.Pool.PoolLab:8:5)

          hast du in Zeile 8 an Position 5 einen Fehler.
          näheres siehe log.

          BTW
          @wuschl sagte in API Werte in ioBroker:

          request(url, function(error, response, result) {

          request ist deprecated, da sollte im log auch eine Warnung stehen

          W 1 Reply Last reply Reply Quote 0
          • W
            Wuschl @Homoran last edited by

            @homoran Ich habe noch ein anderes Script,

            const url = 'http://192.168.30.127/api/fetch'; // IP-Adresse eintragen !
            const idTemp = '0_userdata.0.EZOGateway.Temperatur';
            const idPH = '0_userdata.0.EZOGateway.pH_Wert';
            const idRedox = '0_userdata.0.EZOGateway.Redox_Potential';
             
            schedule('* * * * *', function() { // jede Minute
                request(url, function(error, response, result) {
                    if(!error && result) {
                        let obj = JSON.parse(result);
                        setState(idTemp, obj['1'].Value, true);
                        setState(idPH, obj['2'].Value, true);
                        setState(idRedox, obj['3'].Value, true);
                    }
                });
            

            da kommt diese Fehlermeldung

            javascript.0	10:00:02.679	error	script.js.Pool.PoolLab compile failed: at script.js.Pool.PoolLab:20
            

            Stehe momentan voll auf dem Schlauch...

            paul53 1 Reply Last reply Reply Quote 0
            • paul53
              paul53 @Wuschl last edited by

              @wuschl sagte: anderes Script

              Wenn es das vollständige Skript ist, dann ist schedule() nicht abgeschlossen. Zeile 15:

              });
              

              @wuschl sagte in API Werte in ioBroker:

              Per ip werden mir die Daten im Browser angezeigt.

              Wir sollen nun raten, welche Daten geliefert werden?

              W 2 Replies Last reply Reply Quote 0
              • W
                Wuschl @paul53 last edited by

                @paul53 das wird geliefert

                {
                  "1": {
                    "Name": "",
                    "Timestamp": "2024-06-07T08:15:24.2908368+02:00",
                    "Value": "NaN",
                    "Unit": "",
                    "Symbol": ""
                  },
                  "2": {
                    "Name": "PH value",
                    "Timestamp": "2024-06-07T08:15:24.2908368+02:00",
                    "Value": 9.532,
                    "Unit": "",
                    "Symbol": ""
                  },
                  "3": {
                    "Name": "Redox potential",
                    "Timestamp": "2024-06-07T08:15:24.2908368+02:00",
                    "Value": -586.3,
                    "Unit": "Millivolt",
                    "Symbol": "mV"
                  }
                }
                
                1 Reply Last reply Reply Quote 0
                • W
                  Wuschl @paul53 last edited by Wuschl

                  @paul53 said in API Werte in ioBroker:

                  });

                  Die Fehlermeldung ist mit dem Abschluß weg 👍

                  Jetzt kommt wieder diese

                  javascript.0	10:34:00.004	error	at Object.<anonymous> (script.js.Pool.PoolLab:8:5)
                  
                  paul53 1 Reply Last reply Reply Quote 0
                  • paul53
                    paul53 @Wuschl last edited by

                    @wuschl sagte: Jetzt kommt wieder diese

                    Im Tab "Protokolle" findet man weitere Information zu der Fehlermeldung.

                    W 1 Reply Last reply Reply Quote 0
                    • W
                      Wuschl @paul53 last edited by

                      @paul53

                      avascript.0
                      2024-06-07 10:51:00.010	error	at processTimers (node:internal/timers:512:7)
                      
                      javascript.0
                      2024-06-07 10:51:00.010	error	at listOnTimeout (node:internal/timers:569:17)
                      
                      javascript.0
                      2024-06-07 10:51:00.010	error	at Timeout._onTimeout (/opt/iobroker/node_modules/node-schedule/lib/Invocation.js:228:7)
                      
                      javascript.0
                      2024-06-07 10:51:00.010	error	at /opt/iobroker/node_modules/node-schedule/lib/Invocation.js:268:28
                      
                      javascript.0
                      2024-06-07 10:51:00.010	error	at Job.invoke (/opt/iobroker/node_modules/node-schedule/lib/Job.js:171:15)
                      
                      javascript.0
                      2024-06-07 10:51:00.009	error	at Job.job (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1769:34)
                      
                      javascript.0
                      2024-06-07 10:51:00.009	error	at Object.<anonymous> (script.js.Pool.PoolLab:8:5)
                      
                      javascript.0
                      2024-06-07 10:51:00.009	error	Error in callback: ReferenceError: request is not defined
                      
                      paul53 1 Reply Last reply Reply Quote 0
                      • paul53
                        paul53 @Wuschl last edited by

                        @wuschl sagte: request is not defined

                        Stelle auf httpGet() um:

                        const url = 'http://192.168.30.127/api/fetch'; // IP-Adresse eintragen !
                        const idTemp = '0_userdata.0.EZOGateway.Temperatur';
                        const idPH = '0_userdata.0.EZOGateway.pH_Wert';
                        const idRedox = '0_userdata.0.EZOGateway.Redox_Potential';
                         
                        schedule('* * * * *', function() { // jede Minute
                            httpGet(url, function(error, response) {
                                if(!error) {
                                    const obj = JSON.parse(response.data);
                                    if(typeof obj['1'].Value == 'number') setState(idTemp, obj['1'].Value, true);
                                    if(typeof obj['2'].Value == 'number') setState(idPH, obj['2'].Value, true);
                                    if(typeof obj['3'].Value == 'number') setState(idRedox, obj['3'].Value, true);
                                }
                            });
                        });
                        
                        W 1 Reply Last reply Reply Quote 0
                        • W
                          Wuschl @paul53 last edited by

                          @paul53 cool 😎 Danke, das wars. Jetzt kommen die Daten.👍

                          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

                          756
                          Online

                          31.9k
                          Users

                          80.3k
                          Topics

                          1.3m
                          Posts

                          3
                          12
                          415
                          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