Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. warum wird dieses einfache Rules Script nicht getriggert

    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

    warum wird dieses einfache Rules Script nicht getriggert

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

      Hi Leute,

      ich habe mir vor ca. einem Monat zwei einfache Rules Scripte erstellt:
      33d243f9-4d8d-48a1-acdb-9200df629eb3-image.png
      Hier umgewandelt in JS:

      let cond0 = false;
      
      on({id: "hm-rpc.0.MEQ1534614.15.STATE", change: "any"}, async function (obj) {
         const _cond = ((await getStateAsync("hm-rpc.0.MEQ1534614.15.STATE")).val == true);
         if (cond0 === false && _cond) {
             cond0 = true;    
         	setStateDelayed("system.adapter.tuya.0.alive", true, false, 60000, true);
         	console.log("Wärmepumpe ein -> Tuya Adapter start ".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));
         } else if (cond0 === true && !_cond) {
             cond0 = false;    
         	
         }
      });
      /*const demo = {
       "triggers": [
         {
           "id": "TriggerState",
           "acceptedBy": "triggers",
           "_id": 1617428055062,
           "tagCard": "on update",
           "oid": "hm-rpc.0.MEQ1534614.15.STATE",
           "oidRole": "switch",
           "oidType": "boolean",
           "oidDef": false,
           "oidWrite": true,
           "oidRead": true
         }
       ],
       "conditions": [
         [
           {
             "id": "ConditionState",
             "acceptedBy": "conditions",
             "_id": 1617428193108,
             "tagCard": "=",
             "oid": "hm-rpc.0.MEQ1534614.15.STATE",
             "value": true,
             "oidRole": "switch",
             "oidType": "boolean",
             "oidDef": false,
             "oidWrite": true,
             "oidRead": true
           }
         ]
       ],
       "justCheck": false,
       "actions": {
         "then": [
           {
             "id": "ActionSetStateDelayed",
             "acceptedBy": "actions",
             "_id": 1617430645664,
             "tagCard": "control",
             "oid": "system.adapter.tuya.0.alive",
             "value": true,
             "delay": "60000",
             "clearRunning": true,
             "oidRole": "indicator.state",
             "oidType": "boolean",
             "oidWrite": true,
             "oidRead": true,
             "toggle": false
           },
           {
             "id": "ActionPrintText",
             "acceptedBy": "actions",
             "_id": 1617798437406,
             "text": "Wärmepumpe ein -> Tuya Adapter start "
           }
         ],
         "else": []
       }
      };*/
      

      6ec7e513-b8a6-466a-9483-45d067128350-image.png
      Hier umgewandelt in JS:

      let cond0 = false;
      
      on({id: "hm-rpc.0.MEQ1534614.15.STATE", change: "any"}, async function (obj) {
         const _cond = ((await getStateAsync("hm-rpc.0.MEQ1534614.15.STATE")).val == false);
         if (cond0 === false && _cond) {
             cond0 = true;    
         	setStateDelayed("system.adapter.tuya.0.alive", false, false, 3000, true);
         	console.log("Wärmepumpe aus -> Tuya Adapter stop ".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));
         } else if (cond0 === true && !_cond) {
             cond0 = false;    
         	
         }
      });
      /*const demo = {
       "triggers": [
         {
           "id": "TriggerState",
           "acceptedBy": "triggers",
           "_id": 1617428055062,
           "tagCard": "on update",
           "oid": "hm-rpc.0.MEQ1534614.15.STATE",
           "oidRole": "switch",
           "oidType": "boolean",
           "oidDef": false,
           "oidWrite": true,
           "oidRead": true
         }
       ],
       "conditions": [
         [
           {
             "id": "ConditionState",
             "acceptedBy": "conditions",
             "_id": 1617428193108,
             "tagCard": "=",
             "oid": "hm-rpc.0.MEQ1534614.15.STATE",
             "value": false,
             "oidRole": "switch",
             "oidType": "boolean",
             "oidDef": false,
             "oidWrite": true,
             "oidRead": true
           }
         ]
       ],
       "justCheck": false,
       "actions": {
         "then": [
           {
             "id": "ActionSetStateDelayed",
             "acceptedBy": "actions",
             "_id": 1617430645664,
             "tagCard": "control",
             "oid": "system.adapter.tuya.0.alive",
             "value": false,
             "delay": "3000",
             "clearRunning": true,
             "oidRole": "indicator.state",
             "oidType": "boolean",
             "oidWrite": true,
             "oidRead": true,
             "toggle": false
           },
           {
             "id": "ActionPrintText",
             "acceptedBy": "actions",
             "_id": 1617798372342,
             "text": "Wärmepumpe aus -> Tuya Adapter stop "
           }
         ],
         "else": []
       }
      };*/
      

      Das erste Script soll den Tuya Adapter starten, sobald meine Poolpumpe eingeschaltet wurde und das zweite soll ihn wieder stoppen, sobald die Pumpe ausgeschaltet wurde.

      Das hat auch einige Tage problemlos funktioniert, aber seit ein paar Tagen werden beide Scripte nicht mehr getriggert, obwohl ich daran nichts verändert habe...

      Hat jemand eine Idee woran das liegen könnte ?
      Hab alle Adapter auf den latest stable Releases...

      Beste Grüße

      Fabio 1 Reply Last reply Reply Quote 0
      • Fabio
        Fabio @Qlink last edited by

        @qlink ich kenne mich damit nicht gut aus, aber evtl. muss man im zweiten Feld use trigger value wählen.

        Q 1 Reply Last reply Reply Quote 1
        • Q
          Qlink @Fabio last edited by

          @fa-bio

          Danke, das war tatsächlich der Fehler.

          Beste Grüße

          Fabio 1 Reply Last reply Reply Quote 0
          • Fabio
            Fabio @Qlink last edited by

            @qlink gerne.👍

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

            Support us

            ioBroker
            Community Adapters
            Donate

            563
            Online

            31.8k
            Users

            80.0k
            Topics

            1.3m
            Posts

            2
            4
            358
            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