Skip to content
  • Home
  • Recent
  • Tags
  • 0 Unread 0
  • Categories
  • Unreplied
  • Popular
  • GitHub
  • Docu
  • Hilfe
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. Deutsch
  3. Skripten / Logik
  4. Blockly
  5. Java Script Engine v.4.1.3 - Blockly - Timeout - timeout is not defined

NEWS

  • Weihnachtsangebot 2025! 🎄
    BluefoxB
    Bluefox
    23
    1
    1.3k

  • UPDATE 31.10.: Amazon Alexa - ioBroker Skill läuft aus ?
    apollon77A
    apollon77
    48
    3
    9.3k

  • Monatsrückblick – September 2025
    BluefoxB
    Bluefox
    14
    1
    2.5k

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

Scheduled Pinned Locked Moved Blockly
communication
4 Posts 2 Posters 1.0k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    reelfan
    wrote on last edited by
    #1

    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
    0
    • apollon77A Offline
      apollon77A Offline
      apollon77
      wrote on last edited by
      #2

      Bitte Github issue auf machen

      Beitrag hat geholfen? Votet rechts unten im Beitrag :-) https://paypal.me/Apollon77 / https://github.com/sponsors/Apollon77

      • Debug-Log für Instanz einschalten? Admin -> Instanzen -> Expertenmodus -> Instanz aufklappen - Loglevel ändern
      • Logfiles auf Platte /opt/iobroker/log/… nutzen, Admin schneidet Zeilen ab
      1 Reply Last reply
      0
      • R Offline
        R Offline
        reelfan
        wrote on last edited by
        #3

        @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

        1 Reply Last reply
        0
        • R Offline
          R Offline
          reelfan
          wrote on last edited by
          #4

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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          Support us

          ioBroker
          Community Adapters
          Donate

          698

          Online

          32.5k

          Users

          81.7k

          Topics

          1.3m

          Posts
          Community
          Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
          ioBroker Community 2014-2025
          logo
          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Home
          • Recent
          • Tags
          • Unread 0
          • Categories
          • Unreplied
          • Popular
          • GitHub
          • Docu
          • Hilfe