Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Tester
    4. Test Javascript-Adapter 5.0.7 - RULES

    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

    Test Javascript-Adapter 5.0.7 - RULES

    This topic has been deleted. Only users with topic management privileges can see it.
    • F
      firebowl @apollon77 last edited by firebowl

      @apollon77

      
      
      let cond0 = false;
      
      on({id: "zigbee.0.00158d0008ab3a82.temperature", change: "ne"}, async function (obj) {
          _sendToFrontEnd(1665724678070, {val: obj.state.val, ack: obj.state.ack, valOld: obj.oldState && obj.oldState.val, ackOld: obj.oldState && obj.oldState.ack});
          const subCondVar1665724734367 = obj.state.val;
          const subCond1665724734367 = subCondVar1665724734367 >= -18;
          const _cond = (subCond1665724734367);
          
          _sendToFrontEnd(1665724734367, {result: subCond1665724734367, value: subCondVar1665724734367, compareWith: -18});
          
          if (cond0 === false && _cond) {
              cond0 = true;    
      		// Pushover Hello
      		const subActionVar1665727500241 = "Hello".replace(/%s/g, obj.state.val).replace(/%id/g, obj.id).replace(/%name/g, obj.common && obj.common.name).replace(/%old/g, obj.oldState.val);
      		_sendToFrontEnd(1665727500241, {text: subActionVar1665727500241});`;            
      		sendTo("pushover.0", "send", {
      		    message: subActionVar1665727500241,
      		    title: "ioBroker".replace(/%s/g, obj.state.val).replace(/%id/g, obj.id).replace(/%name/g, obj.common && obj.common.name).replace(/%old/g, obj.oldState.val),
      		    sound: "magic",
      		    priority: -1
      		});
          } else if (cond0 === true && !_cond) {
              cond0 = false;    
      		
          }
      });
      /*const demo = {
        "triggers": [
          {
            "id": "TriggerState",
            "acceptedBy": "triggers",
            "_id": 1665724678070,
            "tagCard": "on change",
            "oid": "zigbee.0.00158d0008ab3a82.temperature",
            "oidRole": "value.temperature",
            "oidType": "number",
            "oidUnit": "°C",
            "oidWrite": false,
            "oidRead": true
          }
        ],
        "conditions": [
          [
            {
              "id": "ConditionState",
              "acceptedBy": "conditions",
              "_id": 1665724734367,
              "tagCard": ">=",
              "oid": "",
              "value": "-18",
              "useTrigger": true
            }
          ]
        ],
        "justCheck": false,
        "actions": {
          "then": [
            {
              "id": "ActionPushover",
              "acceptedBy": "actions",
              "_id": 1665727500241,
              "instance": "pushover.0",
              "text": "Hello",
              "title": "ioBroker",
              "sound": "magic",
              "priority": -1
            }
          ],
          "else": []
        }
      };*/
      
      //{"triggers":[{"id":"TriggerState","acceptedBy":"triggers","_id":1665724678070,"tagCard":"on change","oid":"zigbee.0.00158d0008ab3a82.temperature","oidRole":"value.temperature","oidType":"number","oidUnit":"°C","oidWrite":false,"oidRead":true}],"conditions":[[{"id":"ConditionState","acceptedBy":"conditions","_id":1665724734367,"tagCard":">=","oid":"","value":"-18","useTrigger":true}]],"justCheck":false,"actions":{"then":[{"id":"ActionPushover","acceptedBy":"actions","_id":1665727500241,"instance":"pushover.0","text":"Hello","title":"ioBroker","sound":"magic","priority":-1}],"else":[]}}
      

      Wenn ich anstatt Pushover einfach nen Logeintrag erzeugen lasse dann funktioniert das Script.
      Sorry für die späte Antwort, hab wohl die Benachrichtigung übersehen.

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

        @firebowl Bitte mit den Infos ein Issue im GitHub beim Telegram Adapter anlegen.

        F 1 Reply Last reply Reply Quote 0
        • F
          firebowl @apollon77 last edited by

          @apollon77 Warum Telegram? Meinst Du Pushover? Telegram hab ich überhaupt nicht installiert.

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

            @firebowl Jaaa ..sorry Typo 🙂 (zu viele Themen parallel)

            F 1 Reply Last reply Reply Quote 0
            • F
              firebowl @apollon77 last edited by

              @apollon77 Da gab es schon ein Issue, hab mich mal drangehängt. 🙂

              1 Reply Last reply Reply Quote 1
              • N
                niklasmader last edited by

                Hey,

                mag mir einer bei einem ganz einfachen Skript helfen? Ich möchte einfach nur bei Änderung von play' auf 'pause' die Lautstärke bei Sonos verstellen. Mit dem 'simple State' und dem Abgleich von 'true' und 'false' klappt das. Aber nicht mit dem String Value 'play' oder 'pause'. Ich habs schon mit Anführungszeichen doppelt oder einfach probiert.

                Danke euch!

                Screenshot 2022-11-19 at 20.39.13.png

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

                  @niklasmader Ist der Wert wirklich "pause"? wie Zeigt admin es an?

                  N 1 Reply Last reply Reply Quote 0
                  • N
                    niklasmader @apollon77 last edited by

                    @apollon77 Ich hab's hier heraus gelesen. Ist dort nicht richtig zu schauen? Ich komme von Fhem und das ist auch schon etwas her, daher muss ich mich noch etwas einfinden.

                    Screenshot 2022-11-19 at 20.47.00.png

                    Homoran 1 Reply Last reply Reply Quote 0
                    • Homoran
                      Homoran Global Moderator Administrators @niklasmader last edited by

                      @niklasmader sagte in Test Javascript-Adapter 5.0.7 - RULES:

                      Ist dort nicht richtig zu schauen

                      geh mal auf den Bleistift und poste die Objektdaten

                      N 1 Reply Last reply Reply Quote 0
                      • N
                        niklasmader @Homoran last edited by

                        @homoran Oh, interessant. Da gibt es ja sogar noch mehr. Aber "pause" müsste doch auch dabei sein, so wie ich das sehe.

                        Screenshot 2022-11-19 at 20.54.45.png

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

                          Dann zeig mal im Javascript das Javascript was er aus deiner Rule generiert ... oben rechts auf das "Rules/JS" Logo klicken

                          N 1 Reply Last reply Reply Quote 0
                          • N
                            niklasmader @apollon77 last edited by

                            @apollon77 Ist anbei. Wofür ist eigentlich die aaskommentierte Sektion? Für die Simulation?

                            Screenshot 2022-11-19 at 20.59.32.png

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

                              @niklasmader das sieht aber korrekt aus. Wenn „pause“ dann setze 10. was genau tut nicht?

                              N 1 Reply Last reply Reply Quote 0
                              • N
                                niklasmader @apollon77 last edited by

                                @apollon77 Leider genau das nicht. Hier auch nochmal der Fehler im Log "Pause is not defined". Der komplette rote Log Teil ist aus dem Skript. Wenn ich "pause" in einzelne Anführungszeichen setze, also so 'pause', dann kommt kein Fehler im Log, aber es passiert auch nichts.

                                Screenshot 2022-11-19 at 22.59.30.png

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

                                  @niklasmader Aahhhhbdas ist das Porblem ... dann hatte ich das falsch verstanden. Ja das hab ich im generieten code gesehen ...

                                  Bitte GitHub issue auf machen mit Rule Screenshot UND dem vom generierten JS Code. Alternativ manuell den generierten Code editieren, da ist eine stelle wo "pause" ohne Anführungszeichen steht ... da müssen welche drum rum. Ist ein Code-Generator Bug

                                  N 1 Reply Last reply Reply Quote 0
                                  • N
                                    niklasmader @apollon77 last edited by

                                    @apollon77 Ich habe erst jetzt geschafft mich weiter damit zu beschäftigen. Das habe ich mir auch schon gedacht, aber man kann den Code doch gar nicht manuell editieren, oder? Auch, wenn ich im 'Expert Mode' bin und dann auf den Debug Button oben links neben dem 'Rules/JS' Logo klicke, kann ich nichts ändern, obwohl das ja eigentlich dafür da sein sollte. Auch die 'verbose' und 'debug' Buttons oben rechts neben dem 'Rules/JS' Logo haben bei mir keine Funktion. Ich bin immer im 'read-only mode'.

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

                                      @niklasmader hm … Mist. Ich dachte das geht. Der meets workaround wäre das Skript Objekt direkt zu bearbeiten. Da wäre über Objekte Tab. Dann expertenmodus aktivieren. Dann Script.Js.Name vom Skript raussuchen und auf das Stift Symbol gehen. Dann siehst du das Skript als json. Da die Stelle suchen und editieren (am besten vorher rauskopieren zur Sicherheit). Musst dann aber einfache Anführungszeichen nehmen und keine doppelten!

                                      Absoluter Hack aber so ginge es.

                                      1 Reply Last reply Reply Quote 0
                                      • M
                                        Mike Hellracer last edited by

                                        Hallo zusammen,
                                        wollte mich jetzt auch mal an ein paar Rules versuchen.
                                        Ich habe Javascript 6.0.3 installiert, kann auch eine "Rule" anlegen, aber leider erscheint bei mir der Editor nicht.
                                        Weder bei gestartetetem noch gestoppten Script.
                                        Hoffe jemand kann mir sagen, was ich da falsch mache, bzw. ob ich noch etwas nachinstallieren muss?
                                        Rules.PNG
                                        Danke zusammen

                                        apollon77 C M 3 Replies Last reply Reply Quote 0
                                        • apollon77
                                          apollon77 @Mike Hellracer last edited by

                                          @mike-hellracer Steht irgendwas in der Browser Fehlerkonsole?

                                          1 Reply Last reply Reply Quote 0
                                          • C
                                            conslinger @Mike Hellracer last edited by

                                            @mike-hellracer Bei mir das gleiche Problem, anbei was die Browser Console bei mir so sagt. Bin auf Stable, alle Adapter aktuell. Node.js: v16.18.0, NPM: 8.19.2.

                                            bootstrap.jsx:19 iobroker.admin@6.2.23
                                            instrument.ts:123 [2022-12-04T08:01:18.207Z] Try to connect
                                            instrument.ts:123 Stored version: , new version: 6.2.23
                                            instrument.ts:123 Connected: true
                                            bootstrap.jsx:26 iobroker.javascript@6.0.3 using theme "light"
                                            Prompt.js:15 
                                            ██╗ ██████╗ ██████╗ ██████╗  ██████╗ ██╗  ██╗███████╗██████╗ 
                                            ██║██╔═══██╗██╔══██╗██╔══██╗██╔═══██╗██║ ██╔╝██╔════╝██╔══██╗
                                            ██║██║   ██║██████╔╝██████╔╝██║   ██║█████╔╝ █████╗  ██████╔╝
                                            ██║██║   ██║██╔══██╗██╔══██╗██║   ██║██╔═██╗ ██╔══╝  ██╔══██╗
                                            ██║╚██████╔╝██████╔╝██║  ██║╚██████╔╝██║  ██╗███████╗██║  ██║
                                            ╚═╝ ╚═════╝ ╚═════╝ ╚═╝  ╚═╝ ╚═════╝ ╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝
                                            
                                            Prompt.js:16 Nice to see you here! :) Join our dev community here https://github.com/ioBroker/ioBroker or here https://github.com/iobroker-community-adapters
                                            Prompt.js:17 Help us to create open source project with reactJS!
                                            Prompt.js:18 See you :)
                                            socket.io.js:66 [2022-12-04T08:01:24.464Z] Try to connect
                                            sentry.iobroker.net/api/56/envelope/?sentry_key=504499a725eb4898930d3b9e9da95740&sentry_version=7&sentry_client=sentry.javascript.browser%2F7.12.1:1          Failed to load resource: the server responded with a status of 403 ()
                                            instrument.ts:123 Detected custom blockly: iot
                                            instrument.ts:123 Detected custom blockly: iqontrol
                                            instrument.ts:123 Detected custom blockly: telegram
                                            instrument.ts:123 Translation for word "Instance:" in "de" was ignored: existing = "Beispiel:", new = Instanz:
                                            (anonymous) @ instrument.ts:123
                                            instrument.ts:123 Translation for word "Sends message via telegram" in "de" was ignored: existing = "Sendet eine Nachricht per telegram", new = Sendet Nachricht per Telegramm
                                            (anonymous) @ instrument.ts:123
                                            19instrument.ts:123 Detected an editable field that was not serializable. Please define SERIALIZABLE property as true on all editable custom fields. Proceeding with serialization.
                                            (anonymous) @ instrument.ts:123
                                            :8081/adapter/telegr…stomRuleBlocks.js:1 Uncaught SyntaxError: Cannot use import statement outside a module
                                            index.jsx:37 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading '__initialized')
                                                at index.jsx:37:37
                                                at Generator.next (<anonymous>)
                                                at 62.c2f8b616.chunk.js:178:1797
                                                at new Promise (<anonymous>)
                                                at gs (62.c2f8b616.chunk.js:178:1617)
                                                at HTMLScriptElement.o (index.jsx:35:40)
                                            sentry.iobroker.net/api/56/envelope/?sentry_key=504499a725eb4898930d3b9e9da95740&sentry_version=7&sentry_client=sentry.javascript.browser%2F7.12.1:1          Failed to load resource: the server responded with a status of 403 ()
                                            sentry.iobroker.net/api/56/envelope/?sentry_key=504499a725eb4898930d3b9e9da95740&sentry_version=7&sentry_client=sentry.javascript.browser%2F7.12.1:1          Failed to load resource: the server responded with a status of 403 ()
                                            sentry.iobroker.net/api/56/envelope/?sentry_key=504499a725eb4898930d3b9e9da95740&sentry_version=7&sentry_client=sentry.javascript.browser%2F7.12.1:1          Failed to load resource: the server responded with a status of 403 ()
                                            19instrument.ts:123 Detected an editable field that was not serializable. Please define SERIALIZABLE property as true on all editable custom fields. Proceeding with serialization.
                                            (anonymous) @ instrument.ts:123
                                            DevTools failed to load source map: Could not load content for chrome-extension://gighmmpiobklfepjocnamgkkbiglidom/browser-polyfill.js.map: System error: net::ERR_FILE_NOT_FOUND
                                            DevTools failed to load source map: Could not load content for http://192.168.178.41:8081/adapter/min-maps/vs/loader.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
                                            DevTools failed to load source map: Could not load content for http://192.168.178.41:8081/adapter/min-maps/vs/editor/editor.main.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
                                            DevTools failed to load source map: Could not load content for http://192.168.178.41:8081/adapter/min-maps/vs/editor/editor.main.nls.de.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
                                            
                                            apollon77 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            910
                                            Online

                                            31.7k
                                            Users

                                            79.9k
                                            Topics

                                            1.3m
                                            Posts

                                            rules
                                            25
                                            113
                                            13302
                                            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