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. W2839 Messwerte (Tuya) über Node Red in CCU3 einlesen

    NEWS

    • Wir empfehlen: Node.js 22.x

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker goes Matter ... Matter Adapter in Stable

    W2839 Messwerte (Tuya) über Node Red in CCU3 einlesen

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

      @frieder Ja solange aus debug1 nichts Gscheites rauskommt, kann bei den anderen erst recht nichts rauskommen.
      Nochmal,

      1. Was für Nodes sind das?
      2. Was kommt am 2. Ausgang raus (weitere debug Node dran machen und anders benennen)

      Wenn das diese Nodes sind: https://flows.nodered.org/node/node-red-contrib-tuya-smart-device

      f0799595-e73a-4ff0-8fc9-84c70c443c60-image.png

      Du siehst ja was als data rauskommen muss.

      Hast du den Input entsprechend gesetzt? Du haust ja nur einen timestamp in die tuya Node - das ist sicher nicht richtig. Lies halt mal die Hilfe.

      Hast Du mal den Beispielflow importiert?

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

        @frieder Diese Nodes sind ausserdem schon uralt, meinst Du nicht, dass diese besser sind:

        https://flows.nodered.org/node/node-red-contrib-tuya-devices

        na so alt sind sie doch nicht. ich schau mir die mal an - aber ich hab im Moment kein tuya device.

        Die anderen Nodes triggern vielleicht selbst. Also schau erst mal, dass Du vernünftige Daten aus deinen Geräten bekommst, bevor Du sie in Homematic schickst. Das ist erst der 2. Schritt.

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

          So kein Wunder dass bei Dir nur Schmarn rauskommt. Hier importiere mal den mitgelieferten Beispielflow:

          [
             {
                 "id": "b2e04683.825318",
                 "type": "tab",
                 "label": "Example Flow",
                 "disabled": false,
                 "info": ""
             },
             {
                 "id": "e63245d0.e6cdc8",
                 "type": "tuya-smart-device",
                 "z": "b2e04683.825318",
                 "deviceName": "Tv Light",
                 "disableAutoStart": true,
                 "deviceId": "",
                 "deviceKey": "",
                 "storeAsCreds": false,
                 "deviceIp": "",
                 "retryTimeout": "1001",
                 "findTimeout": "2000",
                 "tuyaVersion": "3.1",
                 "eventMode": "event-both",
                 "x": 680,
                 "y": 360,
                 "wires": [
                     [
                         "ff4bd686.53ae18"
                     ],
                     [
                         "15d22ba6.824b84"
                     ]
                 ]
             },
             {
                 "id": "c016131.e98faf",
                 "type": "function",
                 "z": "b2e04683.825318",
                 "name": "",
                 "func": "msg.payload ={\n   //dps : 1,\n   dps: 20,\n    set : msg.payload\n}\n\n/*\n\n    */\nreturn msg;",
                 "outputs": 1,
                 "timeout": "",
                 "noerr": 0,
                 "initialize": "",
                 "finalize": "",
                 "libs": [],
                 "x": 510,
                 "y": 360,
                 "wires": [
                     [
                         "e63245d0.e6cdc8"
                     ]
                 ]
             },
             {
                 "id": "993c8470.01a278",
                 "type": "inject",
                 "z": "b2e04683.825318",
                 "name": "Turn On",
                 "props": [
                     {
                         "p": "payload"
                     },
                     {
                         "p": "topic",
                         "vt": "str"
                     }
                 ],
                 "repeat": "",
                 "crontab": "",
                 "once": false,
                 "onceDelay": 0.1,
                 "topic": "",
                 "payload": "true",
                 "payloadType": "bool",
                 "x": 310,
                 "y": 320,
                 "wires": [
                     [
                         "c016131.e98faf"
                     ]
                 ]
             },
             {
                 "id": "6403cde.251ab34",
                 "type": "inject",
                 "z": "b2e04683.825318",
                 "name": "Turn Off",
                 "props": [
                     {
                         "p": "payload"
                     },
                     {
                         "p": "topic",
                         "vt": "str"
                     }
                 ],
                 "repeat": "",
                 "crontab": "",
                 "once": false,
                 "onceDelay": 0.1,
                 "topic": "",
                 "payload": "false",
                 "payloadType": "bool",
                 "x": 310,
                 "y": 400,
                 "wires": [
                     [
                         "c016131.e98faf"
                     ]
                 ]
             },
             {
                 "id": "e4cfcdc.9520a3",
                 "type": "tuya-smart-device-generic",
                 "z": "b2e04683.825318",
                 "name": "",
                 "eventMode": "event-both",
                 "x": 660,
                 "y": 740,
                 "wires": [
                     [
                         "1e77cd28.a8c303"
                     ]
                 ]
             },
             {
                 "id": "81a451cc.919f9",
                 "type": "function",
                 "z": "b2e04683.825318",
                 "name": "",
                 "func": "msg.payload ={\n            \"deviceVirtualId\": \"\",\n            //deviceIp: \"192.168.1.71\",\n            \"deviceKey\": \"\",\n            \"deviceName\": \"PM\",\n            \"operation\": \"SET\", // optional default : SET\n            \"payload\": {\n                \"dps\": 20,\n                \"set\": msg.payload\n            },\n        //    \"version\":\"3.2\"\n            \n        }\nreturn msg;",
                 "outputs": 1,
                 "noerr": 0,
                 "initialize": "",
                 "finalize": "",
                 "x": 450,
                 "y": 740,
                 "wires": [
                     [
                         "e4cfcdc.9520a3"
                     ]
                 ]
             },
             {
                 "id": "dc28dca8.674c1",
                 "type": "inject",
                 "z": "b2e04683.825318",
                 "name": "ON",
                 "props": [
                     {
                         "p": "payload"
                     },
                     {
                         "p": "topic",
                         "vt": "str"
                     }
                 ],
                 "repeat": "",
                 "crontab": "",
                 "once": false,
                 "onceDelay": 0.1,
                 "topic": "",
                 "payload": "true",
                 "payloadType": "bool",
                 "x": 240,
                 "y": 780,
                 "wires": [
                     [
                         "81a451cc.919f9"
                     ]
                 ]
             },
             {
                 "id": "1e77cd28.a8c303",
                 "type": "debug",
                 "z": "b2e04683.825318",
                 "name": "",
                 "active": true,
                 "tosidebar": true,
                 "console": false,
                 "tostatus": false,
                 "complete": "false",
                 "statusVal": "",
                 "statusType": "auto",
                 "x": 940,
                 "y": 740,
                 "wires": []
             },
             {
                 "id": "4295327a.09bf3c",
                 "type": "inject",
                 "z": "b2e04683.825318",
                 "name": "OFF",
                 "props": [
                     {
                         "p": "payload"
                     },
                     {
                         "p": "topic",
                         "vt": "str"
                     }
                 ],
                 "repeat": "",
                 "crontab": "",
                 "once": false,
                 "onceDelay": 0.1,
                 "topic": "",
                 "payload": "false",
                 "payloadType": "bool",
                 "x": 240,
                 "y": 700,
                 "wires": [
                     [
                         "81a451cc.919f9"
                     ]
                 ]
             },
             {
                 "id": "8f69fe68.9e4ce",
                 "type": "catch",
                 "z": "b2e04683.825318",
                 "name": "",
                 "scope": null,
                 "uncaught": false,
                 "x": 640,
                 "y": 140,
                 "wires": [
                     [
                         "3764c769.6e1298"
                     ]
                 ]
             },
             {
                 "id": "3764c769.6e1298",
                 "type": "debug",
                 "z": "b2e04683.825318",
                 "name": "On Error",
                 "active": true,
                 "tosidebar": true,
                 "console": false,
                 "tostatus": false,
                 "complete": "true",
                 "targetType": "full",
                 "statusVal": "",
                 "statusType": "auto",
                 "x": 870,
                 "y": 140,
                 "wires": []
             },
             {
                 "id": "ff4bd686.53ae18",
                 "type": "debug",
                 "z": "b2e04683.825318",
                 "name": "Device Data",
                 "active": true,
                 "tosidebar": true,
                 "console": false,
                 "tostatus": false,
                 "complete": "true",
                 "targetType": "full",
                 "statusVal": "",
                 "statusType": "auto",
                 "x": 880,
                 "y": 300,
                 "wires": []
             },
             {
                 "id": "15d22ba6.824b84",
                 "type": "debug",
                 "z": "b2e04683.825318",
                 "name": "Node State",
                 "active": true,
                 "tosidebar": true,
                 "console": false,
                 "tostatus": false,
                 "complete": "payload",
                 "targetType": "msg",
                 "statusVal": "",
                 "statusType": "auto",
                 "x": 880,
                 "y": 400,
                 "wires": []
             },
             {
                 "id": "47ea1d2a.7d85f4",
                 "type": "inject",
                 "z": "b2e04683.825318",
                 "name": "RECONNECT ACTION",
                 "props": [
                     {
                         "p": "payload"
                     },
                     {
                         "p": "topic",
                         "vt": "str"
                     }
                 ],
                 "repeat": "",
                 "crontab": "",
                 "once": false,
                 "onceDelay": 0.1,
                 "topic": "",
                 "payload": "{\"operation\":\"CONTROL\",\"action\":\"RECONNECT\"}",
                 "payloadType": "json",
                 "x": 340,
                 "y": 260,
                 "wires": [
                     [
                         "e63245d0.e6cdc8"
                     ]
                 ]
             },
             {
                 "id": "1991e72.c15c719",
                 "type": "inject",
                 "z": "b2e04683.825318",
                 "name": "DISCONNECT ACTION",
                 "props": [
                     {
                         "p": "payload"
                     },
                     {
                         "p": "topic",
                         "vt": "str"
                     }
                 ],
                 "repeat": "",
                 "crontab": "",
                 "once": false,
                 "onceDelay": 0.1,
                 "topic": "",
                 "payload": "{\"operation\":\"CONTROL\",\"action\":\"DISCONNECT\"}",
                 "payloadType": "json",
                 "x": 340,
                 "y": 200,
                 "wires": [
                     [
                         "e63245d0.e6cdc8"
                     ]
                 ]
             },
             {
                 "id": "c820897454429637",
                 "type": "inject",
                 "z": "b2e04683.825318",
                 "name": "Get Schema",
                 "props": [
                     {
                         "p": "payload"
                     },
                     {
                         "p": "topic",
                         "vt": "str"
                     }
                 ],
                 "repeat": "",
                 "crontab": "",
                 "once": false,
                 "onceDelay": 0.1,
                 "topic": "",
                 "payload": "{\"operation\":\"GET\",\"schema\":true}",
                 "payloadType": "json",
                 "x": 310,
                 "y": 100,
                 "wires": [
                     [
                         "e63245d0.e6cdc8"
                     ]
                 ]
             },
             {
                 "id": "7b416b83a6edfd2b",
                 "type": "inject",
                 "z": "b2e04683.825318",
                 "name": "Get Status of dps 1",
                 "props": [
                     {
                         "p": "payload"
                     },
                     {
                         "p": "topic",
                         "vt": "str"
                     }
                 ],
                 "repeat": "",
                 "crontab": "",
                 "once": false,
                 "onceDelay": 0.1,
                 "topic": "",
                 "payload": "{\"operation\":\"GET\" , \"dps\": 1}",
                 "payloadType": "json",
                 "x": 330,
                 "y": 40,
                 "wires": [
                     [
                         "e63245d0.e6cdc8"
                     ]
                 ]
             },
             {
                 "id": "8616fca1bda4ddbf",
                 "type": "inject",
                 "z": "b2e04683.825318",
                 "name": "SET EVENT MODE - DATA",
                 "props": [
                     {
                         "p": "payload"
                     },
                     {
                         "p": "topic",
                         "vt": "str"
                     }
                 ],
                 "repeat": "",
                 "crontab": "",
                 "once": false,
                 "onceDelay": 0.1,
                 "topic": "",
                 "payload": "{\"operation\":\"CONTROL\",\"action\":\"SET_EVENT_MODE\",\"value\":\"event-data\"}",
                 "payloadType": "json",
                 "x": 260,
                 "y": 460,
                 "wires": [
                     [
                         "e63245d0.e6cdc8"
                     ]
                 ]
             },
             {
                 "id": "cbe30d8393fbb66a",
                 "type": "inject",
                 "z": "b2e04683.825318",
                 "name": "SET EVENT MODE - DP REFRESH",
                 "props": [
                     {
                         "p": "payload"
                     },
                     {
                         "p": "topic",
                         "vt": "str"
                     }
                 ],
                 "repeat": "",
                 "crontab": "",
                 "once": false,
                 "onceDelay": 0.1,
                 "topic": "",
                 "payload": "{\"operation\":\"CONTROL\",\"action\":\"SET_EVENT_MODE\",\"value\":\"event-dp-refresh\"}",
                 "payloadType": "json",
                 "x": 280,
                 "y": 500,
                 "wires": [
                     [
                         "e63245d0.e6cdc8"
                     ]
                 ]
             },
             {
                 "id": "4df579385b195b55",
                 "type": "inject",
                 "z": "b2e04683.825318",
                 "name": "Update Find Timeout",
                 "props": [
                     {
                         "p": "payload"
                     },
                     {
                         "p": "topic",
                         "vt": "str"
                     }
                 ],
                 "repeat": "",
                 "crontab": "",
                 "once": false,
                 "onceDelay": 0.1,
                 "topic": "",
                 "payload": "{\"operation\":\"CONTROL\",\"action\":\"SET_FIND_TIMEOUT\",\"value\":1234}",
                 "payloadType": "json",
                 "x": 230,
                 "y": 540,
                 "wires": [
                     [
                         "e63245d0.e6cdc8"
                     ]
                 ]
             },
             {
                 "id": "65ab15b279337d86",
                 "type": "inject",
                 "z": "b2e04683.825318",
                 "name": "Update  Retry Timeout",
                 "props": [
                     {
                         "p": "payload"
                     },
                     {
                         "p": "topic",
                         "vt": "str"
                     }
                 ],
                 "repeat": "",
                 "crontab": "",
                 "once": false,
                 "onceDelay": 0.1,
                 "topic": "",
                 "payload": "{\"operation\":\"CONTROL\",\"action\":\"SET_RETRY_TIMEOUT\",\"value\":1234}",
                 "payloadType": "json",
                 "x": 240,
                 "y": 580,
                 "wires": [
                     [
                         "e63245d0.e6cdc8"
                     ]
                 ]
             },
             {
                 "id": "51d98c1b9e3ce54b",
                 "type": "inject",
                 "z": "b2e04683.825318",
                 "name": "CONNECT ACTION",
                 "props": [
                     {
                         "p": "payload"
                     },
                     {
                         "p": "topic",
                         "vt": "str"
                     }
                 ],
                 "repeat": "",
                 "crontab": "",
                 "once": false,
                 "onceDelay": 0.1,
                 "topic": "",
                 "payload": "{\"operation\":\"CONTROL\",\"action\":\"CONNECT\"}",
                 "payloadType": "json",
                 "x": 330,
                 "y": 160,
                 "wires": [
                     [
                         "e63245d0.e6cdc8"
                     ]
                 ]
             }
          ]
          

          Da siehst Du doch, welche Kommandos Du in die Node schicken musst um was zu erreichen:

          cbcca203-5892-4817-8994-ff71fa301daf-image.png

          Jedenfalls wenn man da nur einen timestamp reinschickt, dann kommt auch nichts Richtiges raus.

          Schau mal, um den Status des dps auszulesen, musst Du folgende payload in die tuya Node speisen:

          96648813-d522-4359-8887-2dabb0d701a7-image.png

          Welches dps oder keine Ahnung Du auslesen willst, weiß ich nicht.

          [
             {
                 "id": "7b416b83a6edfd2b",
                 "type": "inject",
                 "z": "b2e04683.825318",
                 "name": "Get Status of dps 1",
                 "props": [
                     {
                         "p": "payload"
                     },
                     {
                         "p": "topic",
                         "vt": "str"
                     }
                 ],
                 "repeat": "",
                 "crontab": "",
                 "once": false,
                 "onceDelay": 0.1,
                 "topic": "",
                 "payload": "{\"operation\":\"GET\" , \"dps\": 1}",
                 "payloadType": "json",
                 "x": 330,
                 "y": 40,
                 "wires": [
                     [
                         "e63245d0.e6cdc8"
                     ]
                 ]
             }
          ]
          

          Also die payload muss ein Objekt mit folgendem Inhalt sein:

          {"operation":"GET" , "dps": 1}
          
          F 1 Reply Last reply Reply Quote 0
          • F
            Frieder @mickym last edited by

            @mickym Ich wollte nur rückmelden, dass ich es geschafft habe. Alles funktioniert wie gewünscht. Ursache war wirklich dieses veraltete Nodes.
            Vielen Dank für die Hilfe. Bildschirmfoto 2024-06-01 um 10.22.45.png

            H T 2 Replies Last reply Reply Quote 0
            • H
              hevilp @Frieder last edited by hevilp

              @frieder würdest du den Flow zur Verfügung stellen? Bei mir ist das Ding auch gerade angekommen.

              Ich nutze ioBroker und hab ihn bereits im Netzwerk

              1 Reply Last reply Reply Quote 0
              • T
                thommythekid @Frieder last edited by

                Hallo,

                ich habe auch gerade den W2839 erhalten und checke gerade mal aus, wie ich die Werte auch als Historie in Node Red bekomme. Am Anfang des Thread wurde über die Auswertung der gelieferten Daten diskutiert, aber soweit komme ich gar nicht.
                Ich hab node-red-contrib-tuya-devices in node red installiert und habe jetzt die Node Types Tuya Manager und Tuya Device.
                Ebenso hab ich den W2839 an und über die Tuya APP ins lokale Wifi eingebunden.
                Und ab da bin ich aufgeschmissen. Ich hätte erwartet, dass man in dem Node Red Node auf den Tuya Account, mit dem die APP und damit der Device registriert ist, referenziert, aber das scheint nicht so zu sein.
                Leider wurde in dem Thread nicht auf die allgemeine Konfiguration eingegangen.
                Ich hab in der Tuya APP, in der das Gerät eingebunden ist, eine virtuelle ID, eine IP (die ich aber komisch finde, da sie nicht im lokalenNetzwerk steht), und eine MAC Adresse gefunden.
                In dem Tuya Device Node wird zwar nach der ID gefragt und der MAC Adresse gefragt, aber noch nach einem Local Key, den ich nicht habe.
                Wenn ich den Node mal einbinde, kommt "Cloud devcie for PH/ORP Detector, id:XXXXXXXXXXXXXXXXXXXX not found"
                Auch die Anleitung von node-red-contrib-tuya-devices kapier ich irgendwie nicht.
                Da steht wie selbstverständlich: set the AccessID, AccessKey and Any deviceId (woher soll ich die herbekommen).

                Vielleicht kann mir jemand auf die Sprünge helfen ?

                viele Grüße
                ThommyTheKid

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

                  @mickym: ich sprech dich einfach mal direkt an, denn ich sehe dich gerade online und hoffe, dass du durch die gezielte Ansprache auf mich und diesen alten Thread aufmerksam wirst. Vielleicht kannst du mir helfen ...

                  Also ich hab durch stundenlanges rumprobieren gestern geschafft, meinen w2839 mit der Tuya developer Platform zu verbinden. Mein device taucht unter Devices auf und wenn ich es an den Strom stecke ändert sich der Zustand auch
                  von offline zu online. Auch hab ich es geschafft, die Device ID und den local key zu ermittleln sowie die lokale IP zu ermitteln.

                  Wenn ich den Tuya Manager in node red einbinde, und das cloud projekt, das mit meinem Device verbunden ist referenziere, findet er mein Device als "WiFi Online Control Monitor"

                  tuya1.jpg

                  Aber wenn ich dann wie von dir oben beschrieben, als payload das Get für den Datenpunkt reingebe, kommt nichts zurück.

                  Der Tuya Device Knoten sieht aber eigentlich gut aus:

                  tuya2.jpg

                  Wenn ich hier Datenpunkte abwähle, bekommt der Node weniger Ausgänge und wenn ich über einen Ausgang im Editor hovere, steht eine Beschreibung da. Aber es kommen einfach keine Werte...

                  Eine Idee ??

                  Gruß
                  ThommyTheKid

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

                    hallo,
                    ich hab jetzt noch etwas weiter gewurschtelt und bekomme nun sowas, wenn ich an den
                    general node vom Typ node-red-contrib-tuya-local eine Debug node dranhänge.

                    tuya3.jpg

                    Es kommt also wieder Datenmüll an, Copilot sagt, man soll es mit tuya-local-decoder machen,
                    aber der ist bei mit in node-red-contrib-tuya-local nicht dabei.

                    Ich steig nicht durch ...

                    Gruß
                    ThommyTheKid

                    Marc Berg 1 Reply Last reply Reply Quote 0
                    • Marc Berg
                      Marc Berg Most Active @thommythekid last edited by

                      @thommythekid

                      Zu diesen Nodes gibt es eine ausführliche Dokumentation mit Step-by-Step Anleitung

                      https://github.com/simeonovp/node-red-contrib-tuya-devices/blob/main/doc/step_by_step.md

                      Funktioniert diese Anleitung nicht?

                      T 1 Reply Last reply Reply Quote 0
                      • T
                        thommythekid @Marc Berg last edited by

                        @marc-berg Nein, leider nicht.
                        Ich hatte ja geschrieben, dass im Prinzip das Gerät gefunden wird.
                        Man kann sogar die Liste der Sensorwerte aufrufen. (Screenshot hatte ich oben gepostet). Das ist soweit auch alles plausibel.

                        Im Vergleich zu der Anleitung ist bei mir der Manager vom Status her Offline,
                        allerdings wird das Gerät ja discovered (Screenshot oben).
                        Allerdings ist der Device Node im Status Connected.

                        tuya4.jpg

                        Nun geht die Anleitung ja nicht über das Einrichten des Managers hinaus.
                        Die Frage ist aber bei mir, was ich genau in den Device Node reingeben muss,
                        damit was rauskommt. Bei mir kommt nichts raus, egal, was ich reingebe.

                        Ich kann den Device Node auf die Ausgabe des Status einstellen, das ist das einzige was funktioniert und plausible Werte liefert.

                        tuya5.jpg

                        Das Ergebnis kommt allerdings nicht beim Antriggern durch einen Eject Node sondern schon bei Deploy.

                        Gruß
                        ThommyTheKid

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

                        Support us

                        ioBroker
                        Community Adapters
                        Donate

                        611
                        Online

                        32.0k
                        Users

                        80.5k
                        Topics

                        1.3m
                        Posts

                        5
                        21
                        1178
                        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