Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. Java Script Engine v.4.1.3 - Blockly - Timeout - timeout is not defined

    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

    Java Script Engine v.4.1.3 - Blockly - Timeout - timeout is not defined

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

      Hi,
      ich nutze aktuell die JS Engine 4.1.3.
      Wenn ich dort in einem Blockly Script Timeout nutze, so "fehlt" am Anfang eine Definition für Timeout, das wiederum führt zum Fehler "Error in callback: ReferenceError: timeout is not defined".
      So sieht das Blockly Script aus:
      d35bb941-bdbe-4d29-9b7e-67c624ac3ae8-grafik.png

      Der entsprechende js Code sieht wie folgt aus:

      on({id: 'shelly.0.SHSW-1#32786F#1.Relay0.Switch', change: "ne"}, function (obj) {
        var value = obj.state.val;
        var oldValue = obj.oldState.val;
        if (getState("shelly.0.SHSW-1#32786F#1.Relay0.Switch").val == true && getState("zigbee.0.00158d0001ad6a7d.occupancy").val == true) {
          (function () {if (timeout) {clearTimeout(timeout); timeout = null;}})();
        } else if (getState("zigbee.0.00158d0001ad6a7d.occupancy").val == false) {
          (function () {if (timeout) {clearTimeout(timeout); timeout = null;}})();
          timeout = setTimeout(function () {
            setState("shelly.0.SHSW-1#32786F#1.Relay0.Switch"/*Switch*/, false);
          }, 60000);
        }
      });
      code_text
      

      Das stop Timeout kommt vor der eigentlichen Tiemout Definition. Ich habe den code in JS umgewandelt und vorab die Variable definiert:

      var timeout;
      

      Dann läuft es.
      Ist das ein Problem der JS Engine 4.1.3 ?

      1 Reply Last reply Reply Quote 0
      • apollon77
        apollon77 last edited by

        Bitte Github issue auf machen

        1 Reply Last reply Reply Quote 0
        • R
          reelfan last edited by

          @reelfan sagte in Java Script Engine v.4.1.3 - Blockly - Timeout - timeout is not defined:

          on({id: 'shelly.0.SHSW-1#32786F#1.Relay0.Switch', change: "ne"}, function (obj) {

          Erledigt:
          https://github.com/ioBroker/ioBroker.javascript/issues/334

          Reelfan created this issue in ioBroker/ioBroker.javascript

          closed Java Script Engine v.4.1.3 - Blockly - Timeout - timeout is not defined #334

          1 Reply Last reply Reply Quote 0
          • R
            reelfan last edited by

            In Version 4.1.4 ist das u.a. das Problem mit dem Timeout behoben, danke.

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

            Support us

            ioBroker
            Community Adapters
            Donate

            431
            Online

            31.9k
            Users

            80.2k
            Topics

            1.3m
            Posts

            communication
            2
            4
            894
            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