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. Shelly Adapter command via nodered

    NEWS

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Shelly Adapter command via nodered

    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      S84 last edited by

      Hallo zusammen,

      wie kann über nodered ein custom command an meinen Shelly Dimmer senden?

      Z.B. diesen json Befehl:

      {
          "brightness": 100,  /* output brightness 1..100 */
          "turn": "on",       /* one of "on", "off", or "toggle" */
          "transition": 500   /* One-shot transition, `0..5000` [ms] */
      }
      

      Danke und Grüße
      Steffen

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

        @s84 Du erstellst einfach ein Objekt und machst mit der JSON Node einen String, bevor du es an den Datenpunkt schickst.

        Um es vielleicht etwas plastischer zu machen. Wenn Du also nur die Helligkeit ändern willst, aber alles andere mit in das Objekt geben willst, dann würde es so aussehen:

        2f4c028c-1c6e-4220-aa73-52ae5c678cc1-image.png

        [
           {
               "id": "bd08d95169c4cb7d",
               "type": "inject",
               "z": "289f539dcc33814e",
               "name": "",
               "props": [
                   {
                       "p": "payload"
                   },
                   {
                       "p": "topic",
                       "vt": "str"
                   }
               ],
               "repeat": "",
               "crontab": "",
               "once": false,
               "onceDelay": 0.1,
               "topic": "Helligkeit",
               "payload": "20",
               "payloadType": "num",
               "x": 3910,
               "y": 140,
               "wires": [
                   [
                       "f128698ef305a957"
                   ]
               ]
           },
           {
               "id": "4981a5c949e60d10",
               "type": "inject",
               "z": "289f539dcc33814e",
               "name": "",
               "props": [
                   {
                       "p": "payload"
                   },
                   {
                       "p": "topic",
                       "vt": "str"
                   }
               ],
               "repeat": "",
               "crontab": "",
               "once": false,
               "onceDelay": 0.1,
               "topic": "Helligkeit",
               "payload": "50",
               "payloadType": "num",
               "x": 3910,
               "y": 200,
               "wires": [
                   [
                       "f128698ef305a957"
                   ]
               ]
           },
           {
               "id": "4acd95c916c8cc19",
               "type": "inject",
               "z": "289f539dcc33814e",
               "name": "",
               "props": [
                   {
                       "p": "payload"
                   },
                   {
                       "p": "topic",
                       "vt": "str"
                   }
               ],
               "repeat": "",
               "crontab": "",
               "once": false,
               "onceDelay": 0.1,
               "topic": "Helligkeit",
               "payload": "100",
               "payloadType": "num",
               "x": 3910,
               "y": 260,
               "wires": [
                   [
                       "f128698ef305a957"
                   ]
               ]
           },
           {
               "id": "f128698ef305a957",
               "type": "change",
               "z": "289f539dcc33814e",
               "name": "",
               "rules": [
                   {
                       "t": "set",
                       "p": "payload",
                       "pt": "msg",
                       "to": "{\t    \"brightness\": payload,  /* output brightness 1..100 */\t    \"turn\": \"on\",       /* one of \"on\", \"off\", or \"toggle\" */\t    \"transition\": 500   /* One-shot transition, `0..5000` [ms] */\t}",
                       "tot": "jsonata"
                   }
               ],
               "action": "",
               "property": "",
               "from": "",
               "to": "",
               "reg": false,
               "x": 4170,
               "y": 200,
               "wires": [
                   [
                       "0fe290f2014716bf",
                       "18e24366718a11af"
                   ]
               ]
           },
           {
               "id": "0fe290f2014716bf",
               "type": "debug",
               "z": "289f539dcc33814e",
               "name": "Objekt",
               "active": true,
               "tosidebar": true,
               "console": false,
               "tostatus": false,
               "complete": "payload",
               "targetType": "msg",
               "statusVal": "",
               "statusType": "auto",
               "x": 4370,
               "y": 260,
               "wires": []
           },
           {
               "id": "18e24366718a11af",
               "type": "json",
               "z": "289f539dcc33814e",
               "name": "",
               "property": "payload",
               "action": "",
               "pretty": false,
               "x": 4370,
               "y": 200,
               "wires": [
                   [
                       "adca4bb4cdae4557"
                   ]
               ]
           },
           {
               "id": "adca4bb4cdae4557",
               "type": "debug",
               "z": "289f539dcc33814e",
               "name": "JSON String zum Datenpunkt",
               "active": true,
               "tosidebar": true,
               "console": false,
               "tostatus": false,
               "complete": "payload",
               "targetType": "msg",
               "statusVal": "",
               "statusType": "auto",
               "x": 4590,
               "y": 200,
               "wires": []
           }
        ]
        

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

          Wenn Du sowas mehrfach variabel halten möchtest, dann musst du halt mit einer JOIN Node alles in einem Objekt sammeln. Also um den unteren Flow noch zu erweitern. 😉

          Das turn = "on" lass ich mal fix, so dass nur die brightness und die transition time variabel gesetzt werden. Könnte man zwar auch variabel machen, macht aber logisch aus meiner Sicht keinen Sinn:

          Der Einfachheit halber habe ich auch das topic gleich den Eigenschaftsnamen genannt. Nachdem der Haken dann bei sende alle nachfolgenden gesetzt ist, wird immer das komplette Objekt geschickt, auch wenn sich nur noch ein Parameter ändert.

          a535702d-0fdb-4f8b-9575-1371d44d45cb-image.png

          [
             {
                 "id": "bd08d95169c4cb7d",
                 "type": "inject",
                 "z": "289f539dcc33814e",
                 "name": "",
                 "props": [
                     {
                         "p": "payload"
                     },
                     {
                         "p": "topic",
                         "vt": "str"
                     }
                 ],
                 "repeat": "",
                 "crontab": "",
                 "once": false,
                 "onceDelay": 0.1,
                 "topic": "brightness",
                 "payload": "20",
                 "payloadType": "num",
                 "x": 2390,
                 "y": 3600,
                 "wires": [
                     [
                         "73442e33512059b0"
                     ]
                 ]
             },
             {
                 "id": "4981a5c949e60d10",
                 "type": "inject",
                 "z": "289f539dcc33814e",
                 "name": "",
                 "props": [
                     {
                         "p": "payload"
                     },
                     {
                         "p": "topic",
                         "vt": "str"
                     }
                 ],
                 "repeat": "",
                 "crontab": "",
                 "once": false,
                 "onceDelay": 0.1,
                 "topic": "brightness",
                 "payload": "50",
                 "payloadType": "num",
                 "x": 2390,
                 "y": 3660,
                 "wires": [
                     [
                         "73442e33512059b0"
                     ]
                 ]
             },
             {
                 "id": "4acd95c916c8cc19",
                 "type": "inject",
                 "z": "289f539dcc33814e",
                 "name": "",
                 "props": [
                     {
                         "p": "payload"
                     },
                     {
                         "p": "topic",
                         "vt": "str"
                     }
                 ],
                 "repeat": "",
                 "crontab": "",
                 "once": false,
                 "onceDelay": 0.1,
                 "topic": "brightness",
                 "payload": "100",
                 "payloadType": "num",
                 "x": 2380,
                 "y": 3720,
                 "wires": [
                     [
                         "73442e33512059b0"
                     ]
                 ]
             },
             {
                 "id": "f128698ef305a957",
                 "type": "change",
                 "z": "289f539dcc33814e",
                 "name": "",
                 "rules": [
                     {
                         "t": "set",
                         "p": "payload.turn",
                         "pt": "msg",
                         "to": "on",
                         "tot": "str"
                     }
                 ],
                 "action": "",
                 "property": "",
                 "from": "",
                 "to": "",
                 "reg": false,
                 "x": 2850,
                 "y": 3760,
                 "wires": [
                     [
                         "0fe290f2014716bf",
                         "18e24366718a11af"
                     ]
                 ]
             },
             {
                 "id": "0fe290f2014716bf",
                 "type": "debug",
                 "z": "289f539dcc33814e",
                 "name": "Objekt um turn ergänzt",
                 "active": true,
                 "tosidebar": true,
                 "console": false,
                 "tostatus": false,
                 "complete": "payload",
                 "targetType": "msg",
                 "statusVal": "",
                 "statusType": "auto",
                 "x": 3080,
                 "y": 3820,
                 "wires": []
             },
             {
                 "id": "18e24366718a11af",
                 "type": "json",
                 "z": "289f539dcc33814e",
                 "name": "",
                 "property": "payload",
                 "action": "",
                 "pretty": false,
                 "x": 3070,
                 "y": 3760,
                 "wires": [
                     [
                         "adca4bb4cdae4557"
                     ]
                 ]
             },
             {
                 "id": "adca4bb4cdae4557",
                 "type": "debug",
                 "z": "289f539dcc33814e",
                 "name": "JSON String zum Datenpunkt",
                 "active": true,
                 "tosidebar": true,
                 "console": false,
                 "tostatus": false,
                 "complete": "payload",
                 "targetType": "msg",
                 "statusVal": "",
                 "statusType": "auto",
                 "x": 3290,
                 "y": 3760,
                 "wires": []
             },
             {
                 "id": "e06a553e3d2ef929",
                 "type": "inject",
                 "z": "289f539dcc33814e",
                 "name": "",
                 "props": [
                     {
                         "p": "payload"
                     },
                     {
                         "p": "topic",
                         "vt": "str"
                     }
                 ],
                 "repeat": "",
                 "crontab": "",
                 "once": false,
                 "onceDelay": 0.1,
                 "topic": "transition",
                 "payload": "500",
                 "payloadType": "num",
                 "x": 2390,
                 "y": 3800,
                 "wires": [
                     [
                         "73442e33512059b0"
                     ]
                 ]
             },
             {
                 "id": "ad667579b8593bc8",
                 "type": "inject",
                 "z": "289f539dcc33814e",
                 "name": "",
                 "props": [
                     {
                         "p": "payload"
                     },
                     {
                         "p": "topic",
                         "vt": "str"
                     }
                 ],
                 "repeat": "",
                 "crontab": "",
                 "once": false,
                 "onceDelay": 0.1,
                 "topic": "transition",
                 "payload": "1000",
                 "payloadType": "num",
                 "x": 2380,
                 "y": 3860,
                 "wires": [
                     [
                         "73442e33512059b0"
                     ]
                 ]
             },
             {
                 "id": "92804285f50de019",
                 "type": "inject",
                 "z": "289f539dcc33814e",
                 "name": "",
                 "props": [
                     {
                         "p": "payload"
                     },
                     {
                         "p": "topic",
                         "vt": "str"
                     }
                 ],
                 "repeat": "",
                 "crontab": "",
                 "once": false,
                 "onceDelay": 0.1,
                 "topic": "transition",
                 "payload": "2000",
                 "payloadType": "num",
                 "x": 2380,
                 "y": 3920,
                 "wires": [
                     [
                         "73442e33512059b0"
                     ]
                 ]
             },
             {
                 "id": "73442e33512059b0",
                 "type": "join",
                 "z": "289f539dcc33814e",
                 "name": "",
                 "mode": "custom",
                 "build": "object",
                 "property": "payload",
                 "propertyType": "msg",
                 "key": "topic",
                 "joiner": "\\n",
                 "joinerType": "str",
                 "accumulate": true,
                 "timeout": "",
                 "count": "2",
                 "reduceRight": false,
                 "reduceExp": "",
                 "reduceInit": "",
                 "reduceInitType": "",
                 "reduceFixup": "",
                 "x": 2570,
                 "y": 3760,
                 "wires": [
                     [
                         "4ba3ceab018fb93d",
                         "f128698ef305a957"
                     ]
                 ]
             },
             {
                 "id": "4ba3ceab018fb93d",
                 "type": "debug",
                 "z": "289f539dcc33814e",
                 "name": "Objekt aus Variablen",
                 "active": true,
                 "tosidebar": true,
                 "console": false,
                 "tostatus": false,
                 "complete": "payload",
                 "targetType": "msg",
                 "statusVal": "",
                 "statusType": "auto",
                 "x": 2780,
                 "y": 3820,
                 "wires": []
             }
          ]
          

          Du kannst das mit dem turn on und turn off auch variabel machen. Da es dem Shelly egal ist, wenn Du bei turn off auch noch brightness und transition mitschickst.

          S 1 Reply Last reply Reply Quote 0
          • S
            S84 @mickym last edited by

            @mickym vielen Dank dir.

            Momentan steuere ich den Shelly Datenpunkt xxx und setze ihn auf on.
            Diesem kann ich doch aber nicht das json übergeben, oder? An welchen shelly Datenpunkt schick ich also den Befehl?

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

              @s84 Ich habe Keine Ahnung vom Shelly Adapter - da ich das alles via mqtt mache. Ich denke, dass der Shelly alle Datenpunkt in skalare Werte zerlegt und keine JSONs aufnimmt.

              Vielleicht kann hier @haus-automatisierung, der meiner Kenntnis nach, diesen Adapter betreut was dazu sagen.

              Oder @da_Woody ist glaub auch ein Fan des Shelly Adapters.

              Wie gesagt, diesen JSON ist dafür gedacht, den an den command Datenpunkt via mqtt zu schicken,

              da_Woody haus-automatisierung 2 Replies Last reply Reply Quote 0
              • da_Woody
                da_Woody @mickym last edited by

                @mickym sagte in Shelly Adapter command via nodered:

                Oder @da_Woody ist glaub auch ein Fan des Shelly Adapters.

                das ja, allerdings hab ich 0 ahnung von nodered und was ihr da vor habt.

                @S84

                An welchen shelly Datenpunkt schick ich also den Befehl?

                ich denk mal, das wird so nicht funzen. du wirst die DPs einzeln ansprechen müssen.

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

                  @S84

                  @da_woody sagte in Shelly Adapter command via nodered:

                  @mickym sagte in Shelly Adapter command via nodered:

                  Oder @da_Woody ist glaub auch ein Fan des Shelly Adapters.

                  das ja, allerdings hab ich 0 ahnung von nodered und was ihr da vor habt.

                  @S84

                  An welchen shelly Datenpunkt schick ich also den Befehl?

                  ich denk mal, das wird so nicht funzen. du wirst die DPs einzeln ansprechen müssen.

                  Ja ich denke auch, dass man in dem Adapter wohl alle Parameter einzeln einstellen muss. Das ist halt der Nachteil solcher Adapter, dass man da nicht mehrere Befehle aufeinmal schicken kann. 😉

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

                    @mickym nuja, über eine visu, oder alexa kann ich schon mehrere DPs ansprechen. sonst könnte ich ja bei einem rgbw device nicht gleichzeitig einschalten und eine gewünschte farbe gleichzeitig machen.
                    aber wie gesagt, ich les zwar manchmal nodered, kann damit aber nix anfangen. 🙂

                    1 Reply Last reply Reply Quote 0
                    • haus-automatisierung
                      haus-automatisierung Developer Most Active @mickym last edited by

                      @mickym sagte in Shelly Adapter command via nodered:

                      Ich denke, dass der Shelly alle Datenpunkt in skalare Werte zerlegt und keine JSONs aufnimmt.

                      Genau - am Ende das gleiche, was ein Sonoff-Adapter mit Tasmota-Geräten macht. Nur wahlweise über CoAP oder MQTT.

                      1 Reply Last reply Reply Quote 0
                      • S
                        S84 last edited by

                        Vielen Dank an alle!

                        Gibt es alternativ die Möglichkeit den shelly nicht über den Shelly Adapter mit dem Befehl zu steuern sondern über einen nodered Node der einen mqtt „Befehl“ schickt? Sorry, vielleicht stell ich mir das zu einfach vor. So in etwa: Angabe der ip des Shelly im Node und entgegennahme/Versand des jsons.

                        haus-automatisierung 1 Reply Last reply Reply Quote 0
                        • haus-automatisierung
                          haus-automatisierung Developer Most Active @S84 last edited by haus-automatisierung

                          @s84 Klar, schau einfach in die Shelly-Dokumentation, was die Geräte können und erwarten: https://shelly-api-docs.shelly.cloud

                          Eine IP-Adresse des Shellies brauchst Du bei MQTT aber nicht... das läuft ja alles über die jeweiligen Topics. Du musst nur den Shelly und auch Node-Red mit deinem MQTT-Broker verbinden (z.B. Mosquitto).

                          Also einfach dein JSON an das richtige Topic publishen, welches der Shelly kennt. Aber ich frage mich, warum man sich die Arbeit machen möchte... Ist ja nicht so, als ob der Adapter das nicht auch kann?!

                          Beispiele dafür hatte @mickym ja schon geteilt.

                          1 Reply Last reply Reply Quote 0
                          • S
                            S84 last edited by

                            Vielleicht denke ich auch zu kompliziert.
                            Eigentlich will ich dem Shelly ja nur sagen: schalte dich jetzt ein, Dimme dabei auf 30% und das mit 5 sek Transition. Wenn ich das über die einzelnen Datenpunkte mache und nacheinander setze, sehe ich, wie die Lampe nach dem Einschalten nachregelt.

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

                              @s84 vielleicht erst die Parameter setzen und den Einschaltbefehl zum Schluss absetzen.

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

                              Support us

                              ioBroker
                              Community Adapters
                              Donate

                              997
                              Online

                              31.7k
                              Users

                              79.8k
                              Topics

                              1.3m
                              Posts

                              4
                              13
                              769
                              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