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. Aufzählungen und Abfragen von Parametern

    NEWS

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Aufzählungen und Abfragen von Parametern

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

      Hallo,

      ich mache meine ersten Gehversuche in Node Red und JavaScript. Ich habe noch ein paar Probleme den Iobroker anzusprechen. Normale Objekte sind dabei kein Problem. Ich würde gerne eigene Aufzählungen ansprechen um damit Gruppen zu realisieren.
      Im Flow übergebe ich die anzusprechenden Objekte als Workaround zur zeit als injectnode weil ich nicht weis wie ich die Aufzählungen ansprechen kann. Gibt es eine möglichkeit die Aufzählungen in Node-Red auszulesen.
      IOBroger_aufzaehlungen.png
      Die Links-Rechts Tasten soll die Lampe aus der Gruppe auswählen und einmal blinken lassen. Dann soll ein kurzer druck auf die Heller taste die Lampe einschalten wenn schon eingeschaltet über den Dimmer heller machen ein langer druck soll die Helligkeit kontinuierlich erhöhen(ist aber noch nicht implementiert).
      Da ich Zigbee-Lampen über Deconz und Shellies zusammen verwende unterscheiden sich die Parameter um das Dimmen zu steuern. Ich muss also irgendwie die MAX und MIN Werte für das gerät ermitteln. und kann dann ein Korrekturfaktor einbauen.

      Flow.png


      [
      {
      "id": "19261f56.3b1b51",
      "type": "tab",
      "label": "Test Wohnzimmer",
      "disabled": false,
      "info": ""
      },
      {
      "id": "ecf959a9.a71148",
      "type": "ioBroker in",
      "z": "19261f56.3b1b51",
      "name": "Remote Wohnzimmer",
      "topic": "deconz.0.Sensors.18.buttonevent",
      "payloadType": "value",
      "onlyack": false,
      "func": "all",
      "gap": "",
      "x": 180,
      "y": 220,
      "wires": [
      [
      "f3d9953.ddc2b68"
      ]
      ]
      },
      {
      "id": "f3d9953.ddc2b68",
      "type": "switch",
      "z": "19261f56.3b1b51",
      "name": "Tradfri Remote",
      "property": "payload",
      "propertyType": "msg",
      "rules": [
      {
      "t": "eq",
      "v": "1002",
      "vt": "str"
      },
      {
      "t": "eq",
      "v": "2002",
      "vt": "num"
      },
      {
      "t": "eq",
      "v": "2001",
      "vt": "num"
      },
      {
      "t": "eq",
      "v": "2003",
      "vt": "num"
      },
      {
      "t": "eq",
      "v": "3002",
      "vt": "num"
      },
      {
      "t": "eq",
      "v": "3001",
      "vt": "num"
      },
      {
      "t": "eq",
      "v": "3003",
      "vt": "num"
      },
      {
      "t": "eq",
      "v": "4002",
      "vt": "num"
      },
      {
      "t": "eq",
      "v": "5002",
      "vt": "num"
      }
      ],
      "checkall": "true",
      "repair": false,
      "outputs": 9,
      "x": 620,
      "y": 220,
      "wires": [
      [],
      [
      "1ab342df.6f2875"
      ],
      [],
      [],
      [
      "2401ca16.40ca9e"
      ],
      [],
      [],
      [
      "4953957a.5b6ff4"
      ],
      [
      "b8e3c2e4.3e2688"
      ]
      ]
      },
      {
      "id": "8eae6a5e.aa8fb8",
      "type": "function",
      "z": "19261f56.3b1b51",
      "name": "NächtesInGruppe",
      "func": "var status=flow.get('status');\nvar geraete=flow.get('geraete')||[];\nvar ActivesGeraet=flow.get('activesgeraet')||0;\n\nmsg.topic=geraete[ActivesGeraet];\nmsg.payload=status[ActivesGeraet];\nActivesGeraet++;\nif (ActivesGeraet>=geraete.length){\n ActivesGeraet=0;\n}\nflow.set('activesgeraet',ActivesGeraet);\nreturn msg;",
      "outputs": 1,
      "noerr": 0,
      "x": 950,
      "y": 300,
      "wires": [
      [
      "e0c4517.c04d33"
      ]
      ]
      },
      {
      "id": "b57d7a78.113df",
      "type": "function",
      "z": "19261f56.3b1b51",
      "name": "VorherigeInGruppe",
      "func": "var status=flow.get('status');\nvar geraete=flow.get('geraete')||[];\nvar ActivesGeraet=flow.get('activesgeraet')||0;\n\nmsg.topic=geraete[ActivesGeraet];\nmsg.payload=status[ActivesGeraet];\nActivesGeraet--;\nif (ActivesGeraet<0){\n ActivesGeraet=geraete.length-1;\n}\nflow.set('activesgeraet',ActivesGeraet);\nreturn msg;",
      "outputs": 1,
      "noerr": 0,
      "x": 950,
      "y": 260,
      "wires": [
      [
      "e0c4517.c04d33"
      ]
      ]
      },
      {
      "id": "555e95ec.f5dfac",
      "type": "trigger",
      "z": "19261f56.3b1b51",
      "op1": "true",
      "op2": "false",
      "op1type": "bool",
      "op2type": "bool",
      "duration": "250",
      "extend": false,
      "units": "ms",
      "reset": "",
      "bytopic": "all",
      "name": "",
      "x": 1420,
      "y": 300,
      "wires": [
      [
      "64485acf.76a1dc",
      "23d2eb6a.350774"
      ]
      ]
      },
      {
      "id": "64485acf.76a1dc",
      "type": "ioBroker out",
      "z": "19261f56.3b1b51",
      "name": "",
      "topic": "",
      "ack": "false",
      "autoCreate": "false",
      "stateName": "",
      "role": "",
      "payloadType": "",
      "readonly": "",
      "stateUnit": "",
      "stateMin": "",
      "stateMax": "",
      "x": 1800,
      "y": 220,
      "wires": []
      },
      {
      "id": "1311d3f0.8be68c",
      "type": "inject",
      "z": "19261f56.3b1b51",
      "name": "",
      "topic": "",
      "payload": "true",
      "payloadType": "bool",
      "repeat": "",
      "crontab": "",
      "once": true,
      "onceDelay": 0.1,
      "x": 130,
      "y": 540,
      "wires": [
      [
      "286f055b.fd062a"
      ]
      ]
      },
      {
      "id": "286f055b.fd062a",
      "type": "change",
      "z": "19261f56.3b1b51",
      "name": "GeräteSchaltbar",
      "rules": [
      {
      "t": "set",
      "p": "geraete",
      "pt": "flow",
      "to": "["shelly.0.SHDM-1#F3EA46#1.light.Switch","deconz.0.Lights.4.on","deconz.0.Lights.1.on","shelly.0.SHDM-1#D48032#1.light.Switch"]",
      "tot": "jsonata"
      }
      ],
      "action": "",
      "property": "",
      "from": "",
      "to": "",
      "reg": false,
      "x": 280,
      "y": 540,
      "wires": [
      []
      ]
      },
      {
      "id": "e0c4517.c04d33",
      "type": "switch",
      "z": "19261f56.3b1b51",
      "name": "Status An/Aus",
      "property": "payload",
      "propertyType": "msg",
      "rules": [
      {
      "t": "eq",
      "v": "true",
      "vt": "str"
      },
      {
      "t": "eq",
      "v": "false",
      "vt": "str"
      }
      ],
      "checkall": "true",
      "repair": false,
      "outputs": 2,
      "x": 1180,
      "y": 280,
      "wires": [
      [
      "982584c2.1890a"
      ],
      [
      "555e95ec.f5dfac"
      ]
      ]
      },
      {
      "id": "982584c2.1890a",
      "type": "trigger",
      "z": "19261f56.3b1b51",
      "op1": "false",
      "op2": "true",
      "op1type": "bool",
      "op2type": "bool",
      "duration": "250",
      "extend": false,
      "units": "ms",
      "reset": "",
      "bytopic": "all",
      "name": "",
      "x": 1420,
      "y": 260,
      "wires": [
      [
      "64485acf.76a1dc",
      "23d2eb6a.350774"
      ]
      ]
      },
      {
      "id": "fd2eaa7b.3cf95",
      "type": "inject",
      "z": "19261f56.3b1b51",
      "name": "",
      "topic": "",
      "payload": "true",
      "payloadType": "bool",
      "repeat": "",
      "crontab": "",
      "once": true,
      "onceDelay": "0.25",
      "x": 130,
      "y": 400,
      "wires": [
      [
      "1dfc3f0.68cf9c1"
      ]
      ]
      },
      {
      "id": "1dfc3f0.68cf9c1",
      "type": "function",
      "z": "19261f56.3b1b51",
      "name": "Gerät wählen",
      "func": "var geraete=flow.get('geraete');\nvar active=context.get('active')||0;\n\nif (active<geraete.length){\n if (active===0){\n flow.set('status',[]);\n}\n msg.topic=geraete[active];\n msg.payload=true;\n}\nelse{\n msg.payload=false;\n}\nactive++\ncontext.set('active',active);\nreturn msg;",
      "outputs": 1,
      "noerr": 0,
      "x": 290,
      "y": 400,
      "wires": [
      [
      "d3382b76.fdfe68"
      ]
      ]
      },
      {
      "id": "d3382b76.fdfe68",
      "type": "switch",
      "z": "19261f56.3b1b51",
      "name": "weiteres Gerät",
      "property": "payload",
      "propertyType": "msg",
      "rules": [
      {
      "t": "true"
      },
      {
      "t": "false"
      }
      ],
      "checkall": "true",
      "repair": false,
      "outputs": 2,
      "x": 480,
      "y": 400,
      "wires": [
      [
      "b741bed5.8b6048"
      ],
      []
      ]
      },
      {
      "id": "b741bed5.8b6048",
      "type": "ioBroker get",
      "z": "19261f56.3b1b51",
      "name": "Einlesen Status",
      "topic": "",
      "attrname": "payload",
      "payloadType": "value",
      "x": 680,
      "y": 400,
      "wires": [
      [
      "a74bb87e.8896a"
      ]
      ]
      },
      {
      "id": "a74bb87e.8896a",
      "type": "function",
      "z": "19261f56.3b1b51",
      "name": "Schreiben Status",
      "func": "var status=flow.get('status')||[];\nstatus.push(msg.payload)\nflow.set('status',status);\nmsg.payload=status\nreturn msg;",
      "outputs": 1,
      "noerr": 0,
      "x": 890,
      "y": 400,
      "wires": [
      [
      "1dfc3f0.68cf9c1"
      ]
      ]
      },
      {
      "id": "23d2eb6a.350774",
      "type": "debug",
      "z": "19261f56.3b1b51",
      "name": "",
      "active": true,
      "tosidebar": true,
      "console": false,
      "tostatus": false,
      "complete": "true",
      "targetType": "full",
      "x": 1770,
      "y": 180,
      "wires": []
      },
      {
      "id": "b8e3c2e4.3e2688",
      "type": "trigger",
      "z": "19261f56.3b1b51",
      "op1": "",
      "op2": "true",
      "op1type": "nul",
      "op2type": "bool",
      "duration": "250",
      "extend": false,
      "units": "ms",
      "reset": "",
      "bytopic": "all",
      "name": "entprellen",
      "x": 780,
      "y": 300,
      "wires": [
      [
      "8eae6a5e.aa8fb8"
      ]
      ]
      },
      {
      "id": "4953957a.5b6ff4",
      "type": "trigger",
      "z": "19261f56.3b1b51",
      "op1": "",
      "op2": "true",
      "op1type": "nul",
      "op2type": "bool",
      "duration": "250",
      "extend": false,
      "units": "ms",
      "reset": "",
      "bytopic": "all",
      "name": "entprellen",
      "x": 780,
      "y": 260,
      "wires": [
      [
      "b57d7a78.113df"
      ]
      ]
      },
      {
      "id": "2401ca16.40ca9e",
      "type": "trigger",
      "z": "19261f56.3b1b51",
      "op1": "",
      "op2": "true",
      "op1type": "nul",
      "op2type": "bool",
      "duration": "250",
      "extend": false,
      "units": "ms",
      "reset": "",
      "bytopic": "all",
      "name": "entprellen",
      "x": 780,
      "y": 200,
      "wires": [
      [
      "832523ce.271548"
      ]
      ]
      },
      {
      "id": "1ab342df.6f2875",
      "type": "trigger",
      "z": "19261f56.3b1b51",
      "op1": "",
      "op2": "true",
      "op1type": "nul",
      "op2type": "bool",
      "duration": "250",
      "extend": false,
      "units": "ms",
      "reset": "",
      "bytopic": "all",
      "name": "entprellen",
      "x": 780,
      "y": 160,
      "wires": [
      [
      "eba59844.1b4ae"
      ]
      ]
      },
      {
      "id": "eba59844.1b4ae",
      "type": "function",
      "z": "19261f56.3b1b51",
      "name": "Gerät wählen",
      "func": "var geraete=flow.get('geraete');\nvar active=flow.get('activesgeraet');\nvar status=flow.get('status');\nvar statusNeu;\nvar statusDimm;\n \n msg.topic=geraete[active];\n if (status[active]==="true"){\n statusDimm=true;\n statusNeu=true;\n }\n else{\n statusNeu=true; \n statusDimm=false;\n }\nstatus[active]=statusNeu;\nflow.set('status',status);\nmsg.dimm=statusDimm;\nmsg.payload=statusNeu;\nreturn msg;",
      "outputs": 1,
      "noerr": 0,
      "x": 950,
      "y": 160,
      "wires": [
      [
      "64485acf.76a1dc",
      "e6e9cd4a.fd4d18"
      ]
      ]
      },
      {
      "id": "832523ce.271548",
      "type": "function",
      "z": "19261f56.3b1b51",
      "name": "Gerät wählen",
      "func": "var geraete=flow.get('geraete');\nvar active=flow.get('activesgeraet');\nvar status=flow.get('status');\nvar statusNeu;\nvar statusDimm;\n \n msg.topic=geraete[active];\n if (status[active]==="false"){\n statusDimm=false;\n statusNeu=false;\n }\n else{\n statusNeu=false; \n statusDimm=false;\n }\nstatus[active]=statusNeu;\nflow.set('status',status);\nmsg.dimm=statusDimm;\nmsg.payload=statusNeu;\nreturn msg;",
      "outputs": 1,
      "noerr": 0,
      "x": 950,
      "y": 200,
      "wires": [
      [
      "64485acf.76a1dc",
      "23d2eb6a.350774"
      ]
      ]
      },
      {
      "id": "76edd8fe.e8ecb8",
      "type": "inject",
      "z": "19261f56.3b1b51",
      "name": "",
      "topic": "",
      "payload": "true",
      "payloadType": "bool",
      "repeat": "",
      "crontab": "",
      "once": true,
      "onceDelay": 0.1,
      "x": 130,
      "y": 500,
      "wires": [
      [
      "ddd22761.e2e068"
      ]
      ]
      },
      {
      "id": "ddd22761.e2e068",
      "type": "change",
      "z": "19261f56.3b1b51",
      "name": "GeräteDimbar",
      "rules": [
      {
      "t": "set",
      "p": "geraeteDimmUp",
      "pt": "flow",
      "to": "["shelly.0.SHDM-1#F3EA46#1.light.brightness","deconz.0.Lights.4.bri","deconz.0.Lights.1.on","shelly.0.SHDM-1#D48032#1.light.brightness"]",
      "tot": "jsonata"
      }
      ],
      "action": "",
      "property": "",
      "from": "",
      "to": "",
      "reg": false,
      "x": 280,
      "y": 500,
      "wires": [
      []
      ]
      },
      {
      "id": "e6e9cd4a.fd4d18",
      "type": "switch",
      "z": "19261f56.3b1b51",
      "name": "Dimmbar",
      "property": "dimm",
      "propertyType": "msg",
      "rules": [
      {
      "t": "true"
      },
      {
      "t": "false"
      }
      ],
      "checkall": "true",
      "repair": false,
      "outputs": 2,
      "x": 1220,
      "y": 160,
      "wires": [
      [
      "7a50fbf0.0cc934"
      ],
      [
      "23d2eb6a.350774"
      ]
      ]
      },
      {
      "id": "7a50fbf0.0cc934",
      "type": "ioBroker get",
      "z": "19261f56.3b1b51",
      "name": "",
      "topic": "deconz.0.Lights.4.bri.max",
      "attrname": "payload",
      "payloadType": "object",
      "x": 1470,
      "y": 140,
      "wires": [
      [
      "d7941b89.da903"
      ]
      ]
      },
      {
      "id": "d7941b89.da903",
      "type": "debug",
      "z": "19261f56.3b1b51",
      "name": "",
      "active": true,
      "tosidebar": true,
      "console": false,
      "tostatus": false,
      "complete": "true",
      "targetType": "full",
      "x": 1750,
      "y": 140,
      "wires": []
      }
      ]

      Für Tipps wäre ich sehr Dankbar

      VG
      Rainer

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

      Support us

      ioBroker
      Community Adapters
      Donate

      846
      Online

      31.7k
      Users

      79.7k
      Topics

      1.3m
      Posts

      1
      1
      215
      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