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. Node-Red Homekit und Rollladen Problem

    NEWS

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Node-Red Homekit und Rollladen Problem

    This topic has been deleted. Only users with topic management privileges can see it.
    • ?
      A Former User last edited by

      Ich wollte mal versuchen neben dem yahka auch Node-red zu benutzen für die Anbindung an Homekit. beim Yahka Adapter hängt Siri sich ab und zu auf.

      Also mein erster Versuch mit Node-red und ich habe im Debug Fenster einen Fehler:

      4.8.2021, 21:34:44 node: function
      function : (error)
      "TypeError: Cannot read property 'TargetPosition' of undefined

      Eingebunden habe die Fibaro RollerShutter2
      Bildschirmfoto 2021-08-04 um 21.43.09.png

      Flow


      [
      {
      "id": "b26516f4.b6d45",
      "type": "homekit-service",
      "z": "a117fda6.a687c8",
      "isParent": true,
      "hostType": "0",
      "bridge": "bb104aaa.9190f",
      "accessoryId": "",
      "parentService": "",
      "name": "Büro Rollladen",
      "serviceName": "WindowCovering",
      "topic": "",
      "filter": true,
      "manufacturer": "Fibaro",
      "model": "Roller Shutter",
      "serialNo": "Default Serial Number",
      "firmwareRev": "25.25",
      "hardwareRev": "2.4",
      "softwareRev": "",
      "cameraConfigVideoProcessor": "ffmpeg",
      "cameraConfigSource": "",
      "cameraConfigStillImageSource": "",
      "cameraConfigMaxStreams": 2,
      "cameraConfigMaxWidth": 1280,
      "cameraConfigMaxHeight": 720,
      "cameraConfigMaxFPS": 10,
      "cameraConfigMaxBitrate": 300,
      "cameraConfigVideoCodec": "libx264",
      "cameraConfigAudioCodec": "libfdk_aac",
      "cameraConfigAudio": false,
      "cameraConfigPacketSize": 1316,
      "cameraConfigVerticalFlip": false,
      "cameraConfigHorizontalFlip": false,
      "cameraConfigMapVideo": "0:0",
      "cameraConfigMapAudio": "0:1",
      "cameraConfigVideoFilter": "scale=1280:720",
      "cameraConfigAdditionalCommandLine": "-tune zerolatency",
      "cameraConfigDebug": false,
      "cameraConfigSnapshotOutput": "disabled",
      "cameraConfigInterfaceName": "",
      "characteristicProperties": "{}",
      "waitForSetupMsg": false,
      "outputs": 2,
      "x": 740,
      "y": 120,
      "wires": [
      [
      "c582e46c.f90ff8",
      "905da1a6.b0082"
      ],
      []
      ]
      },
      {
      "id": "ffb77161.62b42",
      "type": "ioBroker in",
      "z": "a117fda6.a687c8",
      "name": "Büro CurrentPosition",
      "topic": "zwave2.0.Node_006.Multilevel_Switch.currentValue",
      "payloadType": "value",
      "onlyack": false,
      "func": "all",
      "gap": "",
      "fireOnStart": "true",
      "x": 140,
      "y": 120,
      "wires": [
      [
      "e480e1c1.1942a8"
      ]
      ]
      },
      {
      "id": "fe390faa.b8722",
      "type": "ioBroker in",
      "z": "a117fda6.a687c8",
      "name": "Büro TargetPosition",
      "topic": "zwave2.0.Node_006.Manufacturer_Proprietary.fibaro_venetianBlindsPosition",
      "payloadType": "value",
      "onlyack": false,
      "func": "all",
      "gap": "",
      "fireOnStart": "true",
      "x": 130,
      "y": 180,
      "wires": [
      [
      "5f69a9cc.b58ea8"
      ]
      ]
      },
      {
      "id": "cc6101c6.013a4",
      "type": "ioBroker out",
      "z": "a117fda6.a687c8",
      "name": "Venetian blinds position",
      "topic": "zwave2.0.Node_006.Manufacturer_Proprietary.fibaro_venetianBlindsPosition",
      "ack": "false",
      "autoCreate": "false",
      "stateName": "",
      "role": "",
      "payloadType": "",
      "readonly": "",
      "stateUnit": "",
      "stateMin": "",
      "stateMax": "",
      "x": 1310,
      "y": 120,
      "wires": []
      },
      {
      "id": "c582e46c.f90ff8",
      "type": "function",
      "z": "a117fda6.a687c8",
      "name": "function",
      "func": "var newMsg = { payload: msg.payload.TargetPosition };\nreturn newMsg",
      "outputs": 1,
      "noerr": 0,
      "initialize": "",
      "finalize": "",
      "libs": [],
      "x": 920,
      "y": 120,
      "wires": [
      [
      "ea0d74e0.c5aba8",
      "3a83eb15.8e628c"
      ]
      ]
      },
      {
      "id": "8439034a.14b11",
      "type": "change",
      "z": "a117fda6.a687c8",
      "name": "",
      "rules": [
      {
      "t": "move",
      "p": "payload",
      "pt": "msg",
      "to": "payload.CurrentPosition",
      "tot": "msg"
      }
      ],
      "action": "",
      "property": "",
      "from": "",
      "to": "",
      "reg": false,
      "x": 520,
      "y": 120,
      "wires": [
      [
      "b26516f4.b6d45"
      ]
      ]
      },
      {
      "id": "e480e1c1.1942a8",
      "type": "range",
      "z": "a117fda6.a687c8",
      "minin": "0",
      "maxin": "99",
      "minout": "0",
      "maxout": "100",
      "action": "scale",
      "round": true,
      "property": "payload",
      "name": "",
      "x": 320,
      "y": 120,
      "wires": [
      [
      "8439034a.14b11"
      ]
      ]
      },
      {
      "id": "ea0d74e0.c5aba8",
      "type": "range",
      "z": "a117fda6.a687c8",
      "minin": "0",
      "maxin": "100",
      "minout": "0",
      "maxout": "99",
      "action": "scale",
      "round": true,
      "property": "payload.TargetPosition",
      "name": "",
      "x": 1090,
      "y": 120,
      "wires": [
      [
      "cc6101c6.013a4",
      "4badb69a.071a98"
      ]
      ]
      },
      {
      "id": "5f69a9cc.b58ea8",
      "type": "range",
      "z": "a117fda6.a687c8",
      "minin": "0",
      "maxin": "99",
      "minout": "0",
      "maxout": "100",
      "action": "scale",
      "round": true,
      "property": "payload",
      "name": "",
      "x": 320,
      "y": 180,
      "wires": [
      [
      "29a293d4.cae19c"
      ]
      ]
      },
      {
      "id": "29a293d4.cae19c",
      "type": "change",
      "z": "a117fda6.a687c8",
      "name": "",
      "rules": [
      {
      "t": "move",
      "p": "payload",
      "pt": "msg",
      "to": "payload.TargetPosition",
      "tot": "msg"
      }
      ],
      "action": "",
      "property": "",
      "from": "",
      "to": "",
      "reg": false,
      "x": 520,
      "y": 180,
      "wires": [
      [
      "b26516f4.b6d45"
      ]
      ]
      },
      {
      "id": "905da1a6.b0082",
      "type": "debug",
      "z": "a117fda6.a687c8",
      "name": "11",
      "active": true,
      "tosidebar": true,
      "console": false,
      "tostatus": false,
      "complete": "payload",
      "targetType": "msg",
      "statusVal": "",
      "statusType": "auto",
      "x": 870,
      "y": 260,
      "wires": []
      },
      {
      "id": "3a83eb15.8e628c",
      "type": "debug",
      "z": "a117fda6.a687c8",
      "name": "22",
      "active": true,
      "tosidebar": true,
      "console": false,
      "tostatus": false,
      "complete": "payload",
      "targetType": "msg",
      "statusVal": "",
      "statusType": "auto",
      "x": 1030,
      "y": 260,
      "wires": []
      },
      {
      "id": "4badb69a.071a98",
      "type": "debug",
      "z": "a117fda6.a687c8",
      "name": "33",
      "active": true,
      "tosidebar": true,
      "console": false,
      "tostatus": false,
      "complete": "payload",
      "targetType": "msg",
      "statusVal": "",
      "statusType": "auto",
      "x": 1230,
      "y": 260,
      "wires": []
      },
      {
      "id": "bb104aaa.9190f",
      "type": "homekit-bridge",
      "bridgeName": "Node-RED",
      "pinCode": "123-45-678",
      "port": "",
      "advertiser": "bonjour-hap",
      "allowInsecureRequest": false,
      "manufacturer": "NRCHKB",
      "model": "0.140.4",
      "serialNo": "Default Serial Number",
      "firmwareRev": "0.140.4",
      "hardwareRev": "0.140.4",
      "softwareRev": "0.140.4",
      "customMdnsConfig": false,
      "mdnsMulticast": true,
      "mdnsInterface": "",
      "mdnsPort": "",
      "mdnsIp": "",
      "mdnsTtl": "",
      "mdnsLoopback": true,
      "mdnsReuseAddr": true,
      "allowMessagePassthrough": true
      }
      ]

      Vielleicht kann mir ja einer sagen wo das Problem liegt oder einen Knoten im Kopf habe.
      Danke für eure Hilfe.

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

        @typ1er Du versuchst eine Eigenschaft TargetPosition von einem nicht definierten Objekt zu beschreiben. Hört halt auf so was in function Nodes zu packen.

        ? 1 Reply Last reply Reply Quote 0
        • ?
          A Former User @mickym last edited by

          @mickym Ich habe versucht aus dem Homekitschalter den Zahlenwert zu extrahieren um damit den Wert in ioBroker zu schreiben.

          Aus dem Schalter kommen die Werte so raus:

          4.8.2021, 21:55:31node: 11
          msg.payload : Object
          object
          TargetPosition: 4

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

            @typ1er Ok dafür braucht man aber keine function Node, das macht man mit einer Change Node:

            2c116b87-a19c-4cc9-8086-f4c431e9c339-image.png

            Allerdings warum machst Du die function Node dazwischen, wenn Du dann in der Range Node nicht auf die Eigenschaft sondern wieder auf die das Objekt gehst:

            a92b5cea-3e08-4531-a813-6196c8426b12-image.png

            Das macht doch dann keinen Sinn???

            Mit Deiner Function Node setzt Du doch die Payload auf die TargetPosition???

            Ansonsten funktioniert Deine function Node habe es gerade getestet:

            Dein Problem ist aber meines Erachtens, dass Du wahrscheinlich aus der homekit Node nichts rausbekommst - bzw. das Objekt nicht gesetzt ist:

            Du filterst nach einem Topic das Du gar nicht gesetzt hast

            ee6dd56c-b73d-49bf-bd8e-88bec6d00068-image.png

            ? 1 Reply Last reply Reply Quote 0
            • ?
              A Former User @mickym last edited by A Former User

              @mickym

              Die Function Node hatte ich schon rausgeschmissen nach deinem Kommentar und gegen die Change Node getauscht. Die Homekit Node bringt nach jedem deploy noch 4x "undefined", was ich mit dem zusätzlichen switch(ist nicht null) rausgefiltert habe. Ansonsten funktioniert es jetzt.

              Bildschirmfoto 2021-08-05 um 01.19.56.png
              Flow

              [
                  {
                      "id": "b26516f4.b6d45",
                      "type": "homekit-service",
                      "z": "a117fda6.a687c8",
                      "isParent": true,
                      "hostType": "0",
                      "bridge": "bb104aaa.9190f",
                      "accessoryId": "",
                      "parentService": "",
                      "name": "Büro Rollladen",
                      "serviceName": "WindowCovering",
                      "topic": "",
                      "filter": false,
                      "manufacturer": "Fibaro",
                      "model": "Roller Shutter",
                      "serialNo": "Zwave 2.0 Node_006",
                      "firmwareRev": "25.25",
                      "hardwareRev": "2.4",
                      "softwareRev": "",
                      "cameraConfigVideoProcessor": "ffmpeg",
                      "cameraConfigSource": "",
                      "cameraConfigStillImageSource": "",
                      "cameraConfigMaxStreams": 2,
                      "cameraConfigMaxWidth": 1280,
                      "cameraConfigMaxHeight": 720,
                      "cameraConfigMaxFPS": 10,
                      "cameraConfigMaxBitrate": 300,
                      "cameraConfigVideoCodec": "libx264",
                      "cameraConfigAudioCodec": "libfdk_aac",
                      "cameraConfigAudio": false,
                      "cameraConfigPacketSize": 1316,
                      "cameraConfigVerticalFlip": false,
                      "cameraConfigHorizontalFlip": false,
                      "cameraConfigMapVideo": "0:0",
                      "cameraConfigMapAudio": "0:1",
                      "cameraConfigVideoFilter": "scale=1280:720",
                      "cameraConfigAdditionalCommandLine": "-tune zerolatency",
                      "cameraConfigDebug": false,
                      "cameraConfigSnapshotOutput": "disabled",
                      "cameraConfigInterfaceName": "",
                      "characteristicProperties": "{}",
                      "waitForSetupMsg": false,
                      "outputs": 2,
                      "x": 800,
                      "y": 120,
                      "wires": [
                          [
                              "26feb2fd.1bf25e"
                          ],
                          []
                      ]
                  },
                  {
                      "id": "ffb77161.62b42",
                      "type": "ioBroker in",
                      "z": "a117fda6.a687c8",
                      "name": "Büro CurrentPosition",
                      "topic": "zwave2.0.Node_006.Multilevel_Switch.currentValue",
                      "payloadType": "value",
                      "onlyack": false,
                      "func": "all",
                      "gap": "",
                      "fireOnStart": "true",
                      "x": 140,
                      "y": 120,
                      "wires": [
                          [
                              "e480e1c1.1942a8"
                          ]
                      ]
                  },
                  {
                      "id": "fe390faa.b8722",
                      "type": "ioBroker in",
                      "z": "a117fda6.a687c8",
                      "name": "Büro TargetPosition",
                      "topic": "zwave2.0.Node_006.Manufacturer_Proprietary.fibaro_venetianBlindsPosition",
                      "payloadType": "value",
                      "onlyack": false,
                      "func": "all",
                      "gap": "",
                      "fireOnStart": "true",
                      "x": 130,
                      "y": 180,
                      "wires": [
                          [
                              "5f69a9cc.b58ea8"
                          ]
                      ]
                  },
                  {
                      "id": "cc6101c6.013a4",
                      "type": "ioBroker out",
                      "z": "a117fda6.a687c8",
                      "name": "Büro venetianBlindsPosition",
                      "topic": "zwave2.0.Node_006.Manufacturer_Proprietary.fibaro_venetianBlindsPosition",
                      "ack": "false",
                      "autoCreate": "false",
                      "stateName": "",
                      "role": "",
                      "payloadType": "",
                      "readonly": "",
                      "stateUnit": "",
                      "stateMin": "",
                      "stateMax": "",
                      "x": 1540,
                      "y": 120,
                      "wires": []
                  },
                  {
                      "id": "8439034a.14b11",
                      "type": "change",
                      "z": "a117fda6.a687c8",
                      "name": "",
                      "rules": [
                          {
                              "t": "move",
                              "p": "payload",
                              "pt": "msg",
                              "to": "payload.CurrentPosition",
                              "tot": "msg"
                          }
                      ],
                      "action": "",
                      "property": "",
                      "from": "",
                      "to": "",
                      "reg": false,
                      "x": 580,
                      "y": 120,
                      "wires": [
                          [
                              "b26516f4.b6d45"
                          ]
                      ]
                  },
                  {
                      "id": "e480e1c1.1942a8",
                      "type": "range",
                      "z": "a117fda6.a687c8",
                      "minin": "0",
                      "maxin": "99",
                      "minout": "0",
                      "maxout": "100",
                      "action": "scale",
                      "round": true,
                      "property": "payload",
                      "name": "",
                      "x": 380,
                      "y": 120,
                      "wires": [
                          [
                              "8439034a.14b11"
                          ]
                      ]
                  },
                  {
                      "id": "ea0d74e0.c5aba8",
                      "type": "range",
                      "z": "a117fda6.a687c8",
                      "minin": "0",
                      "maxin": "100",
                      "minout": "0",
                      "maxout": "99",
                      "action": "scale",
                      "round": true,
                      "property": "payload",
                      "name": "",
                      "x": 1350,
                      "y": 120,
                      "wires": [
                          [
                              "cc6101c6.013a4"
                          ]
                      ]
                  },
                  {
                      "id": "5f69a9cc.b58ea8",
                      "type": "range",
                      "z": "a117fda6.a687c8",
                      "minin": "0",
                      "maxin": "99",
                      "minout": "0",
                      "maxout": "100",
                      "action": "scale",
                      "round": true,
                      "property": "payload",
                      "name": "",
                      "x": 380,
                      "y": 180,
                      "wires": [
                          [
                              "29a293d4.cae19c"
                          ]
                      ]
                  },
                  {
                      "id": "29a293d4.cae19c",
                      "type": "change",
                      "z": "a117fda6.a687c8",
                      "name": "",
                      "rules": [
                          {
                              "t": "move",
                              "p": "payload",
                              "pt": "msg",
                              "to": "payload.TargetPosition",
                              "tot": "msg"
                          }
                      ],
                      "action": "",
                      "property": "",
                      "from": "",
                      "to": "",
                      "reg": false,
                      "x": 580,
                      "y": 180,
                      "wires": [
                          [
                              "b26516f4.b6d45"
                          ]
                      ]
                  },
                  {
                      "id": "4bcd17f0.61705",
                      "type": "change",
                      "z": "a117fda6.a687c8",
                      "name": "",
                      "rules": [
                          {
                              "t": "set",
                              "p": "payload",
                              "pt": "msg",
                              "to": "payload.TargetPosition",
                              "tot": "msg"
                          }
                      ],
                      "action": "",
                      "property": "",
                      "from": "",
                      "to": "",
                      "reg": false,
                      "x": 1190,
                      "y": 120,
                      "wires": [
                          [
                              "ea0d74e0.c5aba8"
                          ]
                      ]
                  },
                  {
                      "id": "26feb2fd.1bf25e",
                      "type": "switch",
                      "z": "a117fda6.a687c8",
                      "name": "",
                      "property": "payload",
                      "propertyType": "msg",
                      "rules": [
                          {
                              "t": "nnull"
                          }
                      ],
                      "checkall": "true",
                      "repair": false,
                      "outputs": 1,
                      "x": 1030,
                      "y": 120,
                      "wires": [
                          [
                              "4bcd17f0.61705"
                          ]
                      ]
                  },
                  {
                      "id": "bb104aaa.9190f",
                      "type": "homekit-bridge",
                      "bridgeName": "Node-RED",
                      "pinCode": "123-45-678",
                      "port": "",
                      "advertiser": "bonjour-hap",
                      "allowInsecureRequest": false,
                      "manufacturer": "NRCHKB",
                      "model": "0.140.4",
                      "serialNo": "Default Serial Number",
                      "firmwareRev": "0.140.4",
                      "hardwareRev": "0.140.4",
                      "softwareRev": "0.140.4",
                      "customMdnsConfig": false,
                      "mdnsMulticast": true,
                      "mdnsInterface": "",
                      "mdnsPort": "",
                      "mdnsIp": "",
                      "mdnsTtl": "",
                      "mdnsLoopback": true,
                      "mdnsReuseAddr": true,
                      "allowMessagePassthrough": true
                  }
              ]
              

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

                @typ1er

                Ich importiere zwar Deine Flows - um es nachzuvolliehen, wäre aber schön wenn Du den Code nicht nur in dem Spoiler verpackst, sondern in die CodeTags packst, dann kann man das nämlich mit einem Click in die Zwischenablage kopieren und muss nicht den ganzen Code abscrollen. 😉

                Gut Du hast das jetzt mit der switch Node rausgefiltert, aber wäre es nicht mit einer Debug Node interssant (das Nachrichtenobjekt) zu anaylisieren, woher das kommt?

                Das Filtern hilft - ich würde aber ggf. die Ursache abstellen - aber das ist dann wohl eine philosophische Frage.

                Kann das Problem an sich nicht nachvollziehen. Bei mir kommen die Nachrichten auch nach einem Deploy als Objekte raus:

                128c0677-f41c-41dd-af10-dc6eefb7f66b-image.png

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

                Support us

                ioBroker
                Community Adapters
                Donate

                900
                Online

                31.7k
                Users

                79.7k
                Topics

                1.3m
                Posts

                2
                6
                545
                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