Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. Yahka und Zeitsteuerung ESPeasy

    NEWS

    • Wir empfehlen: Node.js 22.x

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker goes Matter ... Matter Adapter in Stable

    Yahka und Zeitsteuerung ESPeasy

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

      Hallo zusammen,

      folgendes Problem: Ich steuere eine Pumpe mit einem Relais, welches ich an einen Wemos mini d1 angeschlossen habe. Auf dem Wemos läuft eine Regel, die die Pumpe steuert. Jetzt möchte ich aber die Pumpe gegebenenfalls auch per Smartphone an und ausschalten, was an sich auch super per Yahka funktioniert. Wenn die Pumpe allerdings per Regel an oder aus geht, ändert sich der Status am Smartphone nicht. Wie bekomme ich das hin, dass der Status in dem Fall auch aktualisiert wird?

      Hier die Regel am Wemos (einfache Zeitschaltuhr)

      //**********Pumpe Vormittag
      On Clock#Time=All,08:00 do  // Pumpe schaltet um 08:00 an
       gpio,14,0
      endon
      On Clock#Time=All,10:00 do // Pumpe schaltet um 10:00 aus
       gpio,14,1
      endon
      //**********
      
      //**********Pumpe Abend
      On Clock#Time=All,18:00 do  // Pumpe schaltet um 18:00 an
       gpio,14,0
      endon
      On Clock#Time=All,20:00 do // Pumpe schaltet um 20:00 aus
       gpio,14,1
      endon
      //**********
      
      
      //**********Beleuchtung
      On Clock#Time=All,%sunset% do  // Beleuchtung schaltet bei Sonnenuntergang an
       gpio,2,0
      endon
      On Clock#Time=All,23:00 do // Beleuchtung schaltet um 23:00 aus
       gpio,2,1
      endon
      //**********
      

      Das Skript, im ioBroker für die manuelle Steuerung sieht so aus...

      9f858908-73f0-4a95-aa66-aa29b750d4ca-image.png

      Und die Struktur der Objekte so...

      7a0b1a04-386d-4bc8-b49c-e4702164ad9e-image.png

      Hat da jemand ne Idee, wie man das realisieren kann?

      Danke!

      paul53 1 Reply Last reply Reply Quote 0
      • paul53
        paul53 @xxx_turbo_xxx last edited by

        @xxx_turbo_xxx
        Du steuerst die Pumpe per URL. Lässt sich die Pumpe nicht auch über den Datenpunkt "ESP_Easy_pro_11.Pumpe.State" steuern ?

        xxx_turbo_xxx 1 Reply Last reply Reply Quote 0
        • xxx_turbo_xxx
          xxx_turbo_xxx @paul53 last edited by

          @paul53 Ich denke nicht. Zumindest wüsste ich nicht wie! Der Wemos sendet ja nur 0 und 1 und Yahka setzt den Status auf wahr oder falsch...

          paul53 1 Reply Last reply Reply Quote 0
          • paul53
            paul53 @xxx_turbo_xxx last edited by

            @xxx_turbo_xxx sagte:

            Der Wemos sendet ja nur 0 und 1

            Wird die Pumpe nicht geschaltet, wenn der Wert im Objekt-Tab geändert wird (0 --> 1 / 1 --> 0) ?

            xxx_turbo_xxx 1 Reply Last reply Reply Quote 0
            • xxx_turbo_xxx
              xxx_turbo_xxx @paul53 last edited by

              @paul53 Nein, ioBroker empfängt den Wert nur, wenn ich das richtig sehe

              paul53 1 Reply Last reply Reply Quote 0
              • paul53
                paul53 @xxx_turbo_xxx last edited by paul53

                @xxx_turbo_xxx sagte:

                ioBroker empfängt den Wert nur

                Dann benötigst Du einen Alias-Datenpunkt mit getrenntem Kommando / Status.

                • alias.id.write: "0_userdata.0.Pool.Pumpe"
                • alias.id.read: "mqtt.0.ESP_Easy_pro_11.Pumpe.State"
                • alias.read: "!!val"
                xxx_turbo_xxx 1 Reply Last reply Reply Quote 0
                • xxx_turbo_xxx
                  xxx_turbo_xxx @paul53 last edited by

                  @paul53 Ok. Kannst du mir das bitte etwas genauer darstellen? Wo trage ich die Werte ein?

                  paul53 1 Reply Last reply Reply Quote 0
                  • paul53
                    paul53 @xxx_turbo_xxx last edited by

                    @xxx_turbo_xxx
                    Kopiere folgendes Script und starte es kurz einmal:

                    // Original-Datenpunkt
                    const idOrigin = '0_userdata.0.Pool.Pumpe'; 
                    // Optional: Status-Datenpunkt, wenn Kommando und Status getrennt.
                    // Bei Nicht-Verwendung Leerstring '' zuweisen
                    const idRead = 'mqtt.0.ESP_Easy_pro_11.Pumpe.State';
                     
                    // Alias-Datenpunkt
                    const idAlias = 'Pool.Pumpe';
                    var typeAlias, read, write, nameAlias, role, desc, min, max, unit, states, custom, raum, gewerk;
                    // Folgende kommentieren, wenn keine Änderung der Eigenschaft erforderlich
                    nameAlias = 'Pool Pumpe';
                    desc = 'per Script erstellt';
                    typeAlias = 'boolean'; // oder 'number'
                    read = "!!val";   
                    // write = "val ? true : true";
                    role = 'switch';
                    // min = 0; // nur Zahlen
                    // max = 100; // nur Zahlen
                    // unit = '%'; // nur für Zahlen
                    // states = {0: 'Aus', 1: 'Auto', 2: 'Ein'}; // Zahlen (Multistate) oder Logikwert (z.B. Aus/Ein)
                    // custom = []; // verhindert doppelte Ausführung von history, ...
                    // raum = 'EG_Flur'; // Groß-/Kleinschreibung in der ID beachten !
                    // gewerk = 'Licht'; // Groß-/Kleinschreibung in der ID beachten !
                    
                    // Ab hier nichts ändern !!
                    function createAlias(idDst, idSrc, idRd) {
                       if(existsState(idDst)) log(idDst + ' schon vorhanden !', 'warn');
                       else {
                          var obj = {};
                          obj.type = 'state';
                          obj.common = getObject(idSrc).common;
                          obj.common.alias = {};
                          if(idRd) {
                              obj.common.alias.id = {};
                              obj.common.alias.id.read = idRd;
                              obj.common.alias.id.write = idSrc;
                              obj.common.read = true;
                          } else obj.common.alias.id = idSrc;
                          if(typeAlias) obj.common.type = typeAlias;
                          if(obj.common.read !== false && read) obj.common.alias.read = read;
                          if(obj.common.write !== false && write) obj.common.alias.write = write;
                          if(nameAlias) obj.common.name = nameAlias;
                          if(role) obj.common.role = role;
                          if(desc) obj.common.desc = desc;
                          if(min !== undefined) obj.common.min = min;
                          if(max !== undefined) obj.common.max = max;
                          if(unit) obj.common.unit = unit;
                          if(states) obj.common.states = states;
                          if(custom && obj.common.custom) obj.common.custom = custom;
                          obj.native = {};
                          setObject(idDst, obj);
                          if(raum && existsObject('enum.rooms.' + raum)) {
                             let obj = getObject('enum.rooms.' + raum)
                             obj.common.members.push(idDst);
                             setObject('enum.rooms.' + raum, obj);
                          }
                          if(gewerk && existsObject('enum.functions.' + gewerk)) {
                             let obj = getObject('enum.functions.' + gewerk)
                             obj.common.members.push(idDst);
                             setObject('enum.functions.' + gewerk, obj);
                          }
                       } 
                    }
                     
                    createAlias('alias.0.' + idAlias, idOrigin, idRead);
                    
                    xxx_turbo_xxx 1 Reply Last reply Reply Quote 0
                    • xxx_turbo_xxx
                      xxx_turbo_xxx @paul53 last edited by

                      @paul53 ok... hab ich

                      paul53 xxx_turbo_xxx 2 Replies Last reply Reply Quote 0
                      • paul53
                        paul53 @xxx_turbo_xxx last edited by

                        @xxx_turbo_xxx sagte:

                        hab ich

                        Dann sollte ein Datenpunkt "alias.0.Pool.Pumpe" vorhanden sein, den Du mit Yahka verwenden kannst.

                        xxx_turbo_xxx 2 Replies Last reply Reply Quote 0
                        • xxx_turbo_xxx
                          xxx_turbo_xxx @xxx_turbo_xxx last edited by

                          @xxx_turbo_xxx Wenn ich das richtig verstehe legt das Script nur den Datenpunkt unter alias an, richtig?

                          1 Reply Last reply Reply Quote 0
                          • xxx_turbo_xxx
                            xxx_turbo_xxx @paul53 last edited by

                            @paul53 Läuft! Danke!!! Dann kann ich das Skript theoretisch wieder löschen bzw. deaktivieren? Jetzt muss ich nur noch verstehen, was da im Hintergrund läuft 🙂

                            paul53 1 Reply Last reply Reply Quote 0
                            • xxx_turbo_xxx
                              xxx_turbo_xxx @paul53 last edited by

                              @paul53 eines ist mir allerdings noch aufgefallen. Wenn ich die Pumpe manuell per Browserkommando starte kann ich sie nicht per Homekit deaktivieren...

                              1 Reply Last reply Reply Quote 0
                              • paul53
                                paul53 @xxx_turbo_xxx last edited by paul53

                                @xxx_turbo_xxx sagte:

                                Dann kann ich das Skript theoretisch wieder löschen bzw. deaktivieren?

                                Nein, das Skript wandelt das Kommando (false/true) vom Datenpunkt in eine gesendete URL, wird also weiterhin benötigt.

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

                                Support us

                                ioBroker
                                Community Adapters
                                Donate

                                894
                                Online

                                32.0k
                                Users

                                80.4k
                                Topics

                                1.3m
                                Posts

                                blockly monitoring
                                2
                                14
                                634
                                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