Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. markusn78

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    M
    • Profile
    • Following 0
    • Followers 0
    • Topics 4
    • Posts 8
    • Best 0
    • Groups 1

    markusn78

    @markusn78

    Starter

    0
    Reputation
    4
    Profile views
    8
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    markusn78 Follow
    Starter

    Latest posts made by markusn78

    • Datenstruktur in iobroker Verständnissfrage

      Hi, wenn das Topic hier falsch ist, bitte verschieben.
      Ich bin noch Neuling im Bereich von iobroker.

      Aktuell versuche ich die Daten aus meinem Haus von einer Wago SPS in eine Visu zu überführen.
      Daten aus der Wago lese ich auch schon, Temperaturen sind da kein Problem, mit den Raum-Stati habe ich so meine Probleme.

      Das auslesen geschieht pro Raum in einem Word (Unsigned 16 bit (little endian), welches ich dann in Node-Red in die 16 Einzelbits splitte.

      Screenshot 2022-01-11 090115.png

      Auf der SPS Seite arbeite ich dabei mit einer Struktur, dabei gebe ich an, welches Bit für was verwendet wird. Bit0 ist in dem Fall einfach nur, dass die Heizungsventile für diesen Raum angesteuert sind, Bit1 dann dass das Licht an ist usw.
      Zugreifen kann ich auf der SPS Seite einfach über einen Datentyp. Das sieht dann so aus: MODB_OG_Stat_Kind2.Heizung oder MODB_OG_Stat_Kind2.Licht.

      Meine erste Frage: Ich habe ja jetzt 16 Einzelne Bools aus meinem Word kommen, und die halt als 16 Ausgänge an meinem Flow hängen. Gibt es auf Seiten iobroker die Möglichkeit eine Art Datentyp "Raum" festzulegen, welcher dann die einzelnen Zustände als einzelne Datenpunkte hat? So dass ich nicht für jeden Raum diese Datenpunkte einzeln anlegen muss, und einzeln verschalten muss?

      Ich hoffe ihr versteht was ich meine.

      posted in Skripten / Logik
      M
      markusn78
    • RE: Modbus Wert zu Boolean splitten

      @paul53
      Danke für den Hinweis,
      ich habe mir jetzt einen passenden Flow bei Node-Red angelegt. Habe den aber nicht selber erfunden sondern nur auf meine Bedürfnisse angepasst.

      [
          {
              "id": "7b93b0c.402c65",
              "type": "tab",
              "label": "Flow 2",
              "disabled": false,
              "info": ""
          },
          {
              "id": "df41c583.24ff58",
              "type": "function",
              "z": "7b93b0c.402c65",
              "name": "word to binary",
              "func": "// initialize bit array to 0s\nvar bits0thru31 = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];\n\nfor (i = 0; i < 32; i++){\n bits0thru31[i] = (msg.payload >> i) & 0x1;\n}\n\nvar bit0 = {payload: bits0thru31[0]};\nvar bit1 = {payload: bits0thru31[1]};\nvar bit2 = {payload: bits0thru31[2]};\nvar bit3 = {payload: bits0thru31[3]};\nvar bit4 = {payload: bits0thru31[4]};\nvar bit5 = {payload: bits0thru31[5]};\nvar bit6 = {payload: bits0thru31[6]};\nvar bit7 = {payload: bits0thru31[7]};\nvar bit8 = {payload: bits0thru31[8]};\nvar bit9 = {payload: bits0thru31[9]};\nvar bit10 = {payload: bits0thru31[10]};\nvar bit11 = {payload: bits0thru31[11]};\nvar bit12 = {payload: bits0thru31[12]};\nvar bit13 = {payload: bits0thru31[13]};\nvar bit14 = {payload: bits0thru31[14]};\nvar bit15 = {payload: bits0thru31[15]};\n\nreturn[ bit0, bit1, bit2, bit3, bit4, bit5, bit6, bit7, bit8, bit9, bit10, bit11, bit12, bit13, bit14, bit15 ];\n",
              "outputs": 16,
              "noerr": 0,
              "initialize": "",
              "finalize": "",
              "libs": [],
              "x": 640,
              "y": 400,
              "wires": [
                  [
                      "aa201119.796068"
                  ],
                  [
                      "8756f456.0d6bf"
                  ],
                  [
                      "6d516811.372178"
                  ],
                  [
                      "948f3ad4.183b88"
                  ],
                  [
                      "8f435811.a4be68"
                  ],
                  [
                      "cdb17f80.fac8e8"
                  ],
                  [
                      "75ff10d8.fba63"
                  ],
                  [
                      "e5d55421.de459"
                  ],
                  [
                      "86b811c3.0ac84"
                  ],
                  [
                      "e45a7d02.79caa"
                  ],
                  [
                      "b2aefbfc.aa2338"
                  ],
                  [
                      "2617a6bb.218c8a"
                  ],
                  [
                      "97ee1c07.1628"
                  ],
                  [
                      "79b46191.21538"
                  ],
                  [
                      "7e37e721.5da318"
                  ],
                  [
                      "3b04cc79.d38d54"
                  ]
              ]
          },
          {
              "id": "aa201119.796068",
              "type": "debug",
              "z": "7b93b0c.402c65",
              "name": "",
              "active": true,
              "console": "false",
              "complete": "payload",
              "x": 850,
              "y": 260,
              "wires": []
          },
          {
              "id": "8756f456.0d6bf",
              "type": "debug",
              "z": "7b93b0c.402c65",
              "name": "",
              "active": true,
              "console": "false",
              "complete": "false",
              "x": 850,
              "y": 300,
              "wires": []
          },
          {
              "id": "6d516811.372178",
              "type": "debug",
              "z": "7b93b0c.402c65",
              "name": "",
              "active": true,
              "console": "false",
              "complete": "false",
              "x": 850,
              "y": 340,
              "wires": []
          },
          {
              "id": "948f3ad4.183b88",
              "type": "debug",
              "z": "7b93b0c.402c65",
              "name": "",
              "active": true,
              "console": "false",
              "complete": "payload",
              "x": 850,
              "y": 380,
              "wires": []
          },
          {
              "id": "8f435811.a4be68",
              "type": "debug",
              "z": "7b93b0c.402c65",
              "name": "",
              "active": true,
              "console": "false",
              "complete": "payload",
              "x": 850,
              "y": 420,
              "wires": []
          },
          {
              "id": "cdb17f80.fac8e8",
              "type": "debug",
              "z": "7b93b0c.402c65",
              "name": "",
              "active": true,
              "console": "false",
              "complete": "payload",
              "x": 850,
              "y": 460,
              "wires": []
          },
          {
              "id": "75ff10d8.fba63",
              "type": "debug",
              "z": "7b93b0c.402c65",
              "name": "",
              "active": true,
              "console": "false",
              "complete": "payload",
              "x": 850,
              "y": 500,
              "wires": []
          },
          {
              "id": "e5d55421.de459",
              "type": "debug",
              "z": "7b93b0c.402c65",
              "name": "",
              "active": true,
              "tosidebar": true,
              "console": false,
              "tostatus": false,
              "complete": "payload",
              "targetType": "msg",
              "statusVal": "",
              "statusType": "auto",
              "x": 850,
              "y": 540,
              "wires": []
          },
          {
              "id": "e3ba4514.dd9e88",
              "type": "ioBroker in",
              "z": "7b93b0c.402c65",
              "name": "",
              "topic": "modbus.0.holdingRegisters.1.12326_MW38_OG_Stat_Kind2",
              "payloadType": "value",
              "onlyack": "",
              "func": "all",
              "gap": "",
              "fireOnStart": "true",
              "x": 280,
              "y": 400,
              "wires": [
                  [
                      "df41c583.24ff58"
                  ]
              ]
          },
          {
              "id": "86b811c3.0ac84",
              "type": "debug",
              "z": "7b93b0c.402c65",
              "name": "",
              "active": true,
              "tosidebar": true,
              "console": false,
              "tostatus": false,
              "complete": "payload",
              "targetType": "msg",
              "statusVal": "",
              "statusType": "auto",
              "x": 850,
              "y": 580,
              "wires": []
          },
          {
              "id": "e45a7d02.79caa",
              "type": "debug",
              "z": "7b93b0c.402c65",
              "name": "",
              "active": true,
              "console": "false",
              "complete": "payload",
              "x": 850,
              "y": 620,
              "wires": []
          },
          {
              "id": "b2aefbfc.aa2338",
              "type": "debug",
              "z": "7b93b0c.402c65",
              "name": "",
              "active": true,
              "console": "false",
              "complete": "payload",
              "x": 850,
              "y": 660,
              "wires": []
          },
          {
              "id": "2617a6bb.218c8a",
              "type": "debug",
              "z": "7b93b0c.402c65",
              "name": "",
              "active": true,
              "console": "false",
              "complete": "payload",
              "x": 850,
              "y": 700,
              "wires": []
          },
          {
              "id": "97ee1c07.1628",
              "type": "debug",
              "z": "7b93b0c.402c65",
              "name": "",
              "active": true,
              "console": "false",
              "complete": "payload",
              "x": 850,
              "y": 740,
              "wires": []
          },
          {
              "id": "79b46191.21538",
              "type": "debug",
              "z": "7b93b0c.402c65",
              "name": "",
              "active": true,
              "console": "false",
              "complete": "payload",
              "x": 850,
              "y": 780,
              "wires": []
          },
          {
              "id": "7e37e721.5da318",
              "type": "debug",
              "z": "7b93b0c.402c65",
              "name": "",
              "active": true,
              "console": "false",
              "complete": "payload",
              "x": 850,
              "y": 820,
              "wires": []
          },
          {
              "id": "3b04cc79.d38d54",
              "type": "debug",
              "z": "7b93b0c.402c65",
              "name": "",
              "active": true,
              "console": "false",
              "complete": "payload",
              "x": 850,
              "y": 860,
              "wires": []
          }
      ]
      

      Screenshot 2022-01-11 090115.png

      Im Modbus-Adapter habe ich dann Unsigned 16bit (Little Endian) verwendet. In der Wago SPS schreibe ich auf ein %MW.

      Falls mal jemand diese Informationen brauchen sollte.

      posted in Skripten / Logik
      M
      markusn78
    • Modbus Wert zu Boolean splitten

      Hallo zusammen,
      ich vermute das wurde schon mal behandelt, ich finde gerade nur nicht die richtigen Suchbegriffe.

      Worum gehts: Ich empfange über meinen Modbus-Adapter aus meiner Wago Steuerung ein Word, in diesem sind halt 16 Bits also Booleans die ich gerne aufsplitten würde. Wonach müsste ich jetzt suchen um mich dort ein zu lesen?

      gruss Markus

      posted in Skripten / Logik
      M
      markusn78
    • RE: Einzelwerte extrahieren aus MQTT-Datenpunkt

      @fastfoot danke, das funktioniert super

      posted in Skripten / Logik
      M
      markusn78
    • Einzelwerte extrahieren aus MQTT-Datenpunkt

      Hallo Freunde,
      ich bin relativ neu hier, und habe ein Problem.
      Ich frage einen Datenpunkt ab und bekomme folgenden Value geliefert:

      {
        "level": 100,
        "deviceId": "35aa0dfa-e0b18e47",
        "event": "onBatteryLevelChanged"
      }
      

      Jetzt würde ich gerne aus diesen Daten den Wert des "level" als Value in eine eigene nummerische Variable extrahieren.
      Wie muss ich das machen?

      posted in Skripten / Logik
      M
      markusn78
    • RE: Telegram wenn Bedingung eine bestimmte Zeit wahr

      @homoran
      Danke, das ist auf jedenfall schon mal richtig.
      Ich habe das nun wie folgt geändert:

      var Spuelmaschine_aktiv, Timeout_laeuft, timeout;
      
      
      Spuelmaschine_aktiv = false;
      on({id: 'alias.0.Steckdosen.Spuelmaschine.ENERGY_Power', change: "ne"}, async function (obj) {
        var value = obj.state.val;
        var oldValue = obj.oldState.val;
        if ((obj.state ? obj.state.val : "") > 10 && Spuelmaschine_aktiv == false) {
          Spuelmaschine_aktiv = true;
        } else if ((obj.state ? obj.state.val : "") < 5 && Spuelmaschine_aktiv == true && Timeout_laeuft == false) {
          Timeout_laeuft = true;
          timeout = setTimeout(async function () {
            sendTo("telegram", "send", {
                text: 'Die Spülmaschine ist fertig!'
            });
            Spuelmaschine_aktiv = false;
          }, 300000);
        } else if ((obj.state ? obj.state.val : "") >= 5 && Timeout_laeuft == true) {
          (function () {if (timeout) {clearTimeout(timeout); timeout = null;}})();
          Timeout_laeuft = false;
        }
      });
      

      Screenshot 2021-12-14 164432.png

      Damit startet der Timeout nur einmalig.

      Mal schauen ob es dass jetzt war... erstmal die Spülmaschine voll bekommen 🙂

      posted in Blockly
      M
      markusn78
    • RE: Telegram wenn Bedingung eine bestimmte Zeit wahr

      @badsnoopy667
      Ich dachte eigentlich der else if block, der auf >5 abfragt, würde den Timeout wieder löschen, und er würde dann wieder von neuem starten, solange bis halt irgendwann der Time-out mal abgelaufen ist?

      posted in Blockly
      M
      markusn78
    • Telegram wenn Bedingung eine bestimmte Zeit wahr

      Hallo zusammen,
      ich habe da ein kleines Verständnissproblem bei den Verzögerungen:

      Folgende Situation:
      Ich messe per Steckdose die Leistung meiner Spülmaschine, wenn die >10W ist dann setze ich mir
      eine Variable: Spuelmaschine_aktiv
      Nun möchte ich, dass wenn die Spülmaschine 10 Minuten <5W ist, mir eine Telegramnachricht geschickt wird.

      Der einfache Part ist der mit <5W, nun meine Frage: Wie setze ich das mit den 10 Minuten um?
      Mein Ansatz ist folgender, ich bin mir aber nicht sicher ob das so richtig ist:

      var Spuelmaschine_aktiv, timeout;
      
      
      Spuelmaschine_aktiv = false;
      on({id: 'alias.0.Steckdosen.Spuelmaschine.ENERGY_Power', change: "ne"}, async function (obj) {
        var value = obj.state.val;
        var oldValue = obj.oldState.val;
        if ((obj.state ? obj.state.val : "") > 10 && Spuelmaschine_aktiv == false) {
          Spuelmaschine_aktiv = true;
        } else if ((obj.state ? obj.state.val : "") < 5 && Spuelmaschine_aktiv == true) {
          timeout = setTimeout(async function () {
            sendTo("telegram", "send", {
                text: 'Die Spülmaschine ist fertig!'
            });
            Spuelmaschine_aktiv = false;
          }, 300000);
        } else if ((obj.state ? obj.state.val : "") >= 5) {
          (function () {if (timeout) {clearTimeout(timeout); timeout = null;}})();
        }
      });
      

      Screenshot 2021-12-14 155612.png

      Mein Problem aktuell ist, dass ich Mehrfachmeldungen bekomme, und da könnten es halt zwei Verursacher sein:

      1. Die Timeoutzeit ist zu kurz gewählt
      2. Ein Denkfehler im Script

      Vielleicht habt ihr ja eine Idee?

      posted in Blockly
      M
      markusn78
    Community
    Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
    The ioBroker Community 2014-2023
    logo