Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. [gelöst] Wert (JSON) an URL senden

    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

    [gelöst] Wert (JSON) an URL senden

    This topic has been deleted. Only users with topic management privileges can see it.
    • T
      tofriedrich @arteck last edited by

      @arteck ich würde den Wert von Set_Level gern an http://192.168.178.24/set_level senden. Laut dem Entwickler kann man darüber den Wert burn_level ändern.

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

        @tofriedrich sagte: Wert von Set_Level gern an http://192.168.178.24/set_level senden.

        Versuche es mal so:

        on('0_userdata.0.Kamin.Set_Level', function(dp) {
            request({
                method: 'POST',
                url: 'http://192.168.178.24/set_level',
                body: '{"level":dp.state.val}'
            }, function(error, respnse, body) {
                if(error) log(error, 'warn');
            });
        });
        
        T 1 Reply Last reply Reply Quote 0
        • T
          tofriedrich @paul53 last edited by

          @paul53 als JavaScript oder wie kriege ich das abgebildet? Ich habe bis jetzt nur mit Blockly gearbeitet.

          M 1 Reply Last reply Reply Quote 0
          • M
            MCU @tofriedrich last edited by

            @tofriedrich Kurze Zwischenfrage: Die angegebene IP (192.168.178.24) ist vom Ofen?

            T 1 Reply Last reply Reply Quote 0
            • T
              tofriedrich @MCU last edited by

              @mcu genau, die IP ist vom Kamin

              M 1 Reply Last reply Reply Quote 0
              • M
                MCU @tofriedrich last edited by MCU

                @tofriedrich Laut Programm ist die Funktion aber nicht "set_level" sondern "set_burn_level".
                https://github.com/mvn23/hwam_stove/blob/master/pystove/pystove.py

                Zeile 166: STOVE_BURN_LEVEL_URL = '/set_burn_level'
                
                T 1 Reply Last reply Reply Quote 0
                • T
                  tofriedrich @MCU last edited by

                  @mcu Sorry, da hat sich bei mir ein Fehler eingeschlichen. Du hast recht 👍

                  M 1 Reply Last reply Reply Quote 0
                  • M
                    MCU @tofriedrich last edited by

                    @tofriedrich
                    Schon mal so eine Variante probiert:

                     http://192.168.178.24/set_burn_level?level=5 
                    
                    T 1 Reply Last reply Reply Quote 0
                    • T
                      tofriedrich @MCU last edited by tofriedrich

                      @mcu ja, da bekomme ich {"response":"unknown route"} angezeigt. Wie kann ich den Code von Paul in Blockly nutzen? Vielleicht klappt es.

                      M 1 Reply Last reply Reply Quote 0
                      • M
                        MCU @tofriedrich last edited by

                        @tofriedrich

                        http://192.168.178.24/set_burn_level?burn_level=5
                        
                        T 1 Reply Last reply Reply Quote 0
                        • T
                          tofriedrich @MCU last edited by

                          @mcu auch hier {"response":"unknown route"}

                          M 1 Reply Last reply Reply Quote 0
                          • M
                            MCU @tofriedrich last edited by MCU

                            @tofriedrich Funktionen -> Javascript-Funktion etwas tun

                            Da wird es verarbeitet:

                            json_str = await self._post('http://' + self.stove_host
                                                                + STOVE_BURN_LEVEL_URL, data)
                            

                            d3915d69-78d3-41f7-ab63-c33ace53a3c7-image.png

                            8260b754-0a69-4079-8a61-fbfd4b04dafe-image.png

                            1 Reply Last reply Reply Quote 0
                            • T
                              tofriedrich last edited by

                              Mit dem Script passiert leider nichts

                              8DF68CA8-5468-4277-BB04-17AA7A288E59.png

                              M 1 Reply Last reply Reply Quote 0
                              • M
                                MCU @tofriedrich last edited by MCU

                                @tofriedrich Was steht denn in der Funktion? s.o.

                                T 1 Reply Last reply Reply Quote 0
                                • T
                                  tofriedrich @MCU last edited by

                                  @mcu ```

                                  request({
                                      method: 'POST',
                                      url: 'http://192.168.178.24/set_burn_level',
                                      body: {"level":Level}
                                  }, function(error, respnse, body) {
                                      if(error) log(error, 'warn');
                                  });
                                  
                                  M 1 Reply Last reply Reply Quote 0
                                  • M
                                    MCU @tofriedrich last edited by MCU

                                    @tofriedrich ok? und jetzt? Zeig nochmal Dein Blockly.

                                    T 1 Reply Last reply Reply Quote 0
                                    • T
                                      tofriedrich @MCU last edited by

                                      @mcu 895880E5-2BD2-4DCB-ACDD-6C9CAA24F2D8.png

                                      1 Reply Last reply Reply Quote 0
                                      • T
                                        tofriedrich last edited by tofriedrich

                                        Der Wert wird nicht geändert egal ob ich mit Level arbeite oder wie in meinem Screenshot. Die Instanz wird sogar deaktiviert.

                                        1 Reply Last reply Reply Quote 0
                                        • T
                                          tofriedrich last edited by

                                          
                                          javascript.0
                                          2021-09-12 00:46:43.219	error	TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer or Uint8Array. Received an instance of Object at write_ (_http_outgoing.js:665:11) at ClientRequest.write (_http_outgoing.js:633:15) at Request.write (/opt/iobroker/node_modules/request/request.js:1494:27) at end (/opt/iobroker/node_modules/request/request.js:549:18) at Immediate._onImmediate (/opt/iobroker/node_modules/request/request.js:578:7) at processImmediate (internal/timers.js:461:21)
                                          
                                          javascript.0
                                          2021-09-12 00:46:43.218	error	Error: The first argument must be of type string or an instance of Buffer or Uint8Array. Received an instance of Object
                                          
                                          javascript.0
                                          2021-09-12 00:46:43.218	error	An error happened which is most likely from one of your scripts, but the originating script could not be detected.
                                          
                                          javascript.0
                                          2021-09-12 00:46:43.212	error	Request error: Error: Argument error, options.body.
                                          
                                          javascript.0
                                          2021-09-12 00:46:43.211	warn	script.js.Kamin_Set: {}
                                          
                                          
                                          1 Reply Last reply Reply Quote 0
                                          • M
                                            MCU last edited by

                                            @tofriedrich Wie ist denn Set_level definiert als String oder als number?

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            832
                                            Online

                                            31.8k
                                            Users

                                            79.9k
                                            Topics

                                            1.3m
                                            Posts

                                            6
                                            82
                                            4254
                                            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