Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. JavaScript
    5. Ordner im Wurzelverzeichnis anlegen

    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

    Ordner im Wurzelverzeichnis anlegen

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

      @paul53 irgendwas mach ich noch falsch. Er bringt mir nur Fehler.

      IMG_20220102_112619_143.jpg

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

        @seiteballon74 sagte: irgendwas mach ich noch falsch.

        Nicht nur irgendwas, sondern setObject() ist völlig falsch angewendet. Man muss das komplette Objekt inkl. type, common, native übergeben. Hier eine Funktion, an die die ID und das common-Objekt übergeben wird:

        function createDp(id, common) {
            if(existsState(id)) log('Datenpunkt ' + id + ' existiert bereits !', 'warn');
            else {
                var obj = {};
                obj.type = 'state';
                obj.native = {};
                obj.common = common;
                setObject(id, obj, function (err) {
                    if (err) log('Cannot write object: ' + err)
                    else {
                        var init = null;
                        if(common.def === undefined) {
                            if(common.type === 'number') init = 0;
                            if(common.type === 'boolean') init = false;
                            if(common.type === 'string') init = '';
                        } else init = common.def;
                        setState(id, init, true);
                    }
                });
            }
        }
        

        Bitte Javascript-Code nicht als Screenshot, sondern als Text in Code tags posten!

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

          @paul53

          Danke dir. Aber jetzt hab ich keine Ahnung was ich wo und wie eintragen muss damit er meine zwei Ordner erstellt.

          control-own.0.ESPMatrix.Matrix und

          control-own.0.ESPMatrix.MatrixSetting

          Kannst du mir dabei vielleicht nochmal helfen?

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

            @seiteballon74 sagte: Kannst du mir dabei vielleicht nochmal helfen?

            Ja, wenn du den vorhanden Javascript-Code in Code tags postest, damit ich die IDs und die common-Objekte kopieren kann.

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

              @paul53

              Tut mir leid aber ich verstehe nicht was du meinst. Bisher hab ich nur mit Blockly gearbeitet.

              Das ist mein Code vom MQTT Objekt mit dem ich meine Nachrichten an die LED Leiste schicken kann. Meinst du das hier?

              {
                "common": {
                  "name": "jeedom/message",
                  "write": true,
                  "read": true,
                  "role": "variable",
                  "desc": "mqtt server variable",
                  "type": "string",
                  "custom": {
                    "history.0": {
                      "enabled": true,
                      "aliasId": "Laufleiste",
                      "changesOnly": false,
                      "debounce": 500,
                      "changesRelogInterval": 0,
                      "changesMinDelta": 0,
                      "maxLength": 10,
                      "retention": 31536000
                    }
                  }
                },
                "native": {
                  "topic": "jeedom/message"
                },
                "type": "state",
                "_id": "mqtt.0.jeedom.message",
                "acl": {
                  "owner": "system.user.admin",
                  "ownerGroup": "system.group.administrator",
                  "object": 1636,
                  "state": 1636
                },
                "from": "system.adapter.admin.0",
                "user": "system.user.admin",
                "ts": 1641076808334
              }
              paul53 1 Reply Last reply Reply Quote 0
              • paul53
                paul53 @SeiteBallon74 last edited by

                @seiteballon74 sagte: Meinst du das hier?

                Nein, ich meine den Javascript-Code den Du hier als Screenshot gepostet hast.

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

                  @paul53 So?

                  setObject("control-own.0.ESPMatrix.Matrix", false, {
                      read: true,
                      write: true,
                      name:  "Matrix",
                      type: "boolean",
                      def: false
                      });
                  
                  setObject("control-own.0.ESPMatrix.MatrixSetting", false, {
                      read: true,
                      write: true,
                      name:  "MatrixSetting",
                      type: "boolean",
                      def: false
                      });
                  
                  paul53 1 Reply Last reply Reply Quote 0
                  • paul53
                    paul53 @SeiteBallon74 last edited by paul53

                    @seiteballon74

                    function createDp(id, common) {
                        if(existsState(id)) log('Datenpunkt ' + id + ' existiert bereits !', 'warn');
                        else {
                            var obj = {};
                            obj.type = 'state';
                            obj.native = {};
                            obj.common = common;
                            setObject(id, obj, function (err) {
                                if (err) log('Cannot write object: ' + err)
                                else {
                                    var init = null;
                                    if(common.def === undefined) {
                                        if(common.type === 'number') init = 0;
                                        if(common.type === 'boolean') init = false;
                                        if(common.type === 'string') init = '';
                                    } else init = common.def;
                                    setState(id, init, true);
                                }
                            });
                        }
                    }
                    
                    const commonM = {
                        read: true,
                        write: true,
                        name:  "Matrix",
                        type: "boolean",
                        def: false
                    };
                    
                    const commonMS = {
                        read: true,
                        write: true,
                        name:  "MatrixSetting",
                        type: "boolean",
                        def: false
                    };
                    
                    createDp('control-own.0.ESPMatrix.Matrix', commonM);
                    createDp('control-own.0.ESPMatrix.MatrixSetting', commonMS);
                    
                    SeiteBallon74 1 Reply Last reply Reply Quote 0
                    • SeiteBallon74
                      SeiteBallon74 @paul53 last edited by

                      @paul53 Leider kommen jetzt Fehler.

                      IMG_20220102_124404_983.jpg

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

                        @seiteballon74 sagte: Leider kommen jetzt Fehler.

                        Sorry, ändere das untere createDp() (Zeile 40: Kleines "p").

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

                          @paul53 hat geklappt. Super danke für deine Zeit.
                          Noch eine Frage, wie kann ich jetzt mit einem Blockly und dem Textbaustein "erstelle Text aus" meine Werte bzw Datenpunkte anzeigen lassen? So muss nämlich das Format sein. Also wie bekomme ich meine Werte in den "My TEXT" Baustein?

                          {
                             "text": "My TEXT ",
                             "priorite": 1,
                             "lum": 15,
                             "pos": 2,
                             "eff_in": 1,
                             "eff_out": 1,
                             "speed": 25,
                             "pause": 1000
                          }
                          
                          SeiteBallon74 paul53 2 Replies Last reply Reply Quote 0
                          • SeiteBallon74
                            SeiteBallon74 @SeiteBallon74 last edited by

                            Das wäre zb ein Beispiel Blockly. Die anderen Punkte sind aktuell nur deaktiviert.

                            Bild_2022-01-02_133213.png

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

                              @seiteballon74 sagte: wie bekomme ich meine Werte in den "My TEXT" Baustein?

                              Das ist ein völlig anderes Thema.

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

                                @paul53

                                Alles klar. Danke dir für die Hilfe.

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

                                Support us

                                ioBroker
                                Community Adapters
                                Donate

                                942
                                Online

                                31.9k
                                Users

                                80.2k
                                Topics

                                1.3m
                                Posts

                                2
                                18
                                428
                                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