Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Node-Red
    5. HTTP-request von Mobotix T25

    NEWS

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    HTTP-request von Mobotix T25

    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      ak68 @mickym last edited by

      @mickym

      Wie muss im HTTP-Out Node der Statuscode (= ReturnCode ?) gesetzt werden, mit den Voreinstellungen klappt es leider nicht !

      7f33bbc7-9be1-4ad6-8441-4fc7adb3824a-image.png

      mickym 1 Reply Last reply Reply Quote 0
      • mickym
        mickym Most Active @ak68 last edited by mickym

        @ak68 Doch Du musst die HTTP-Out aber direkt hinter die HTTP-In setzen.

        Die Respose Node gibt immer 200 zurück. Wenn ein anderer Code erwartet wird, dann musst Du den in dem statusCode mitgeben.

        fc87a479-f984-4a87-8ae3-111e93d86294-image.png

        2a4deda3-e9ab-43fd-b684-d7f9e3442fa8-image.png

        6aceaf07-2a01-4f22-abb1-5fb5960904b2-image.png

        Je nachdem was gesendet wurde, wird auch die vollständige Antwort im res (response Objekt) an den Sender zurückgeschickt.

        Also mach die ResponseNode in jedem Fall direkt hinter die http-IN Node und verfälsche den Request nicht.

        A 1 Reply Last reply Reply Quote 0
        • A
          ak68 @mickym last edited by

          @mickym

          super, funktioniert:

          d3bdfdb0-62e4-4ea9-a5cb-02c1f01cef1b-image.png

          ... so einfach wäre das gewesen 🙂

          mickym 1 Reply Last reply Reply Quote 0
          • mickym
            mickym Most Active @ak68 last edited by

            @ak68 Du codierst auch wieder zu viel. Zeig mal was wirklich in der HTTP-IN node ankommt, ob das ein JSON ist?

            16a7e59c-abb2-49b3-8efa-38b7ad4edc28-image.png

            Das ist total unschön und auch wieder mit function Nodes codieren - ist nicht toll. Die Filter sind doch alle die gleichen.

            A mickym 2 Replies Last reply Reply Quote 0
            • A
              ak68 @mickym last edited by

              @mickym

              Ja, es sind JSON-Objekte:

              7a816f04-99bc-4583-a9d5-d02bb176401a-image.png

              1 Reply Last reply Reply Quote 0
              • mickym
                mickym Most Active @mickym last edited by mickym

                Wenn Dein Request zum Beispiel so aussieht:

                1d75c2b7-61ac-42cd-9138-44c5a03661fd-image.png
                Also bei dir:

                http://<DeineIP>:1880/mobotix?Praxis=On
                

                Dann bekommst Du bereits ein Objekt zurück:
                26c80978-de67-4be3-b90e-a19957e875bb-image.png

                Dann kann man als erstes das Objekt in eine skalare Nachricht zerlegen und den key in das topic schreiben: und dann kannst Du Deine payload Abprüfungen machen:

                dfdbc7b6-2c7f-4a76-aa83-21a5b8e3e6a4-image.png

                Du nimmst also eine Split Node und kopierst den Schlüssel da rein.

                8900e94a-9e53-4023-9d5d-47519b21e838-image.png

                Du bekommst dann eine skalare Nachricht mit dem topic woher oder wofür das Kommando ist.

                mickym 1 Reply Last reply Reply Quote 0
                • mickym
                  mickym Most Active @mickym last edited by

                  @mickym Nun machst Du den Filter der payload nur einmal egal für welches topic er ist.

                  A 1 Reply Last reply Reply Quote 0
                  • A
                    ak68 @mickym last edited by

                    @mickym DANKE 🙂

                    mickym 1 Reply Last reply Reply Quote 0
                    • mickym
                      mickym Most Active @ak68 last edited by mickym

                      @ak68 War noch nicht fertig - zum Schluss prüfst dann nur noch das topic als Quelle ab:

                      d4b6fbdb-21f5-4439-8ec9-3277a272f805-image.png

                      594a3f5b-b27a-4bf6-b6d8-a42b809d9560-image.png

                      Da muss man nichts Programmieren - geschweige denn mit Javascript function Nodes nutzen!!! - Vermeide das so gut es geht, nur so wirst Du die Vorteile des grafischen Programmierens zu schätzen wissen!!

                      Hier mal der Flow zum Import:

                      [
                         {
                             "id": "1f1888c3e6587da8",
                             "type": "http response",
                             "z": "289f539dcc33814e",
                             "name": "",
                             "statusCode": "",
                             "headers": {},
                             "x": 290,
                             "y": 6560,
                             "wires": []
                         },
                         {
                             "id": "b5a3bf31f304a2c6",
                             "type": "http in",
                             "z": "289f539dcc33814e",
                             "name": "",
                             "url": "/mobotix",
                             "method": "get",
                             "upload": false,
                             "swaggerDoc": "",
                             "x": 110,
                             "y": 6560,
                             "wires": [
                                 [
                                     "1f1888c3e6587da8",
                                     "96a8f338668a17cc",
                                     "b8ca3dc79ed7b5aa"
                                 ]
                             ]
                         },
                         {
                             "id": "96a8f338668a17cc",
                             "type": "debug",
                             "z": "289f539dcc33814e",
                             "name": "JSON",
                             "active": true,
                             "tosidebar": true,
                             "console": false,
                             "tostatus": false,
                             "complete": "payload",
                             "targetType": "msg",
                             "statusVal": "",
                             "statusType": "auto",
                             "x": 310,
                             "y": 6480,
                             "wires": []
                         },
                         {
                             "id": "b8ca3dc79ed7b5aa",
                             "type": "split",
                             "z": "289f539dcc33814e",
                             "name": "",
                             "splt": "\\n",
                             "spltType": "str",
                             "arraySplt": 1,
                             "arraySpltType": "len",
                             "stream": false,
                             "addname": "topic",
                             "x": 290,
                             "y": 6620,
                             "wires": [
                                 [
                                     "2dd2f27ca23a09ba",
                                     "400ff1a9fc71116d"
                                 ]
                             ]
                         },
                         {
                             "id": "2dd2f27ca23a09ba",
                             "type": "debug",
                             "z": "289f539dcc33814e",
                             "name": "Kommando",
                             "active": true,
                             "tosidebar": true,
                             "console": false,
                             "tostatus": false,
                             "complete": "payload",
                             "targetType": "msg",
                             "statusVal": "",
                             "statusType": "auto",
                             "x": 430,
                             "y": 6720,
                             "wires": []
                         },
                         {
                             "id": "400ff1a9fc71116d",
                             "type": "switch",
                             "z": "289f539dcc33814e",
                             "name": "on/off",
                             "property": "payload",
                             "propertyType": "msg",
                             "rules": [
                                 {
                                     "t": "cont",
                                     "v": "On",
                                     "vt": "str"
                                 }
                             ],
                             "checkall": "true",
                             "repair": false,
                             "outputs": 1,
                             "x": 450,
                             "y": 6620,
                             "wires": [
                                 [
                                     "1bf95d49381f2202"
                                 ]
                             ]
                         },
                         {
                             "id": "1bf95d49381f2202",
                             "type": "change",
                             "z": "289f539dcc33814e",
                             "name": "on => 1",
                             "rules": [],
                             "action": "",
                             "property": "",
                             "from": "",
                             "to": "",
                             "reg": false,
                             "x": 600,
                             "y": 6620,
                             "wires": [
                                 [
                                     "bbb69ba12e160990"
                                 ]
                             ]
                         },
                         {
                             "id": "bbb69ba12e160990",
                             "type": "switch",
                             "z": "289f539dcc33814e",
                             "name": "Quelle",
                             "property": "topic",
                             "propertyType": "msg",
                             "rules": [
                                 {
                                     "t": "eq",
                                     "v": "Praxis",
                                     "vt": "str"
                                 },
                                 {
                                     "t": "eq",
                                     "v": "Privar",
                                     "vt": "str"
                                 }
                             ],
                             "checkall": "true",
                             "repair": false,
                             "outputs": 2,
                             "x": 750,
                             "y": 6620,
                             "wires": [
                                 [
                                     "3963aa4398c2f5b1"
                                 ],
                                 [
                                     "9d2b9bd63ed9d1be"
                                 ]
                             ]
                         },
                         {
                             "id": "3963aa4398c2f5b1",
                             "type": "debug",
                             "z": "289f539dcc33814e",
                             "name": "Praxis",
                             "active": true,
                             "tosidebar": true,
                             "console": false,
                             "tostatus": false,
                             "complete": "payload",
                             "targetType": "msg",
                             "statusVal": "",
                             "statusType": "auto",
                             "x": 910,
                             "y": 6560,
                             "wires": []
                         },
                         {
                             "id": "9d2b9bd63ed9d1be",
                             "type": "debug",
                             "z": "289f539dcc33814e",
                             "name": "Privat",
                             "active": true,
                             "tosidebar": true,
                             "console": false,
                             "tostatus": false,
                             "complete": "payload",
                             "targetType": "msg",
                             "statusVal": "",
                             "statusType": "auto",
                             "x": 890,
                             "y": 6640,
                             "wires": []
                         }
                      ]
                      

                      Was Du in den Filtern machst, habe ich zwar nicht kapiert - aber das weißt Du ja besser.

                      Du musst also Deine Logik etwas umdrehen.

                      Über die payload verzweigst Du ERST auf verschiedene Kommandoarten zur Bearbeitung und zum Schluss teilst Du via topic auf das jeweilige Endgerät auf.

                      A 1 Reply Last reply Reply Quote 0
                      • A
                        ak68 @mickym last edited by

                        @mickym DANKE, hat geklappt, ist deutlich "schlanker"

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

                        Support us

                        ioBroker
                        Community Adapters
                        Donate

                        731
                        Online

                        31.7k
                        Users

                        79.7k
                        Topics

                        1.3m
                        Posts

                        2
                        22
                        897
                        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