Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. numereiche Variable enthält "null" anstelle von "0"

    NEWS

    • Wir empfehlen: Node.js 22.x

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker goes Matter ... Matter Adapter in Stable

    numereiche Variable enthält "null" anstelle von "0"

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

      Hallo,

      ich habe bei der Ausgabe einer Variablen das Problem, dass wenn Sie den Wert "0" enthalten sollte dort "null" drinsteht.
      Die anderen Werte wie z.B. "-5" oder "88" werden richtig ausgegeben.

      Kann mir da jemand einen Tipp geben?

      Definiert ist sie wie folgt:

      {
        "type": "state",
        "native": {},
        "common": {
          "name": "Luftfeuchte_delta",
          "type": "number",
          "read": true,
          "write": true,
          "role": "info",
          "def": "50",
          "min": "-500",
          "max": "500",
          "custom": {
            "history.0": {
              "enabled": true,
              "aliasId": "",
              "changesOnly": true,
              "debounce": 1000,
              "changesRelogInterval": 0,
              "changesMinDelta": 0,
              "maxLength": 960,
              "retention": 31536000
            }
          }
        },
        "from": "system.adapter.javascript.0",
        "user": "system.user.admin",
        "ts": 1632145034211,
        "_id": "0_userdata.0.Sensoren_Diverse.Luftfeuchte_delta",
        "acl": {
          "object": 1636,
          "state": 1636,
          "owner": "system.user.admin",
          "ownerGroup": "system.group.administrator"
        }
      }
      

      ich ahbe eine Variable definieret

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

        @heinzie sagte in numereiche Variable enthält "null" anstelle von "0":

        wenn Sie den Wert "0" enthalten sollte dort "null" drinsteht.

        wer schreibt das da rein?

        H 1 Reply Last reply Reply Quote 0
        • H
          heinzie @Homoran last edited by

          @homoran das sieht so aus:

          eeac5e6a-1e2a-4b40-9135-5ebc5d057786-grafik.png

          Die code Zeile sieht so aus:

          setState("0_userdata.0.Sensoren_Diverse.Luftfeuchte_delta"/*Luftfeuchte_delta*/, (parseFloat(getState("zigbee.0.00158d000232277b.humidity").val) - Luffeuchtre_Vorzyklus), true);
          
          Homoran paul53 2 Replies Last reply Reply Quote 0
          • Homoran
            Homoran Global Moderator Administrators @heinzie last edited by

            @heinzie sagte in numereiche Variable enthält "null" anstelle von "0":

            das sieht so aus:

            was ist Badezimmer_humidity?
            wo kommt der Wert her?

            ggf. mal in Zahl wandeln.

            Gibt es entsprechende Meldungen im log?

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

              @heinzie
              Wo wird Luffeuchtre_Vorzyklus gesetzt?

              Homoran H 2 Replies Last reply Reply Quote 0
              • Homoran
                Homoran Global Moderator Administrators @paul53 last edited by

                @paul53 sagte in numereiche Variable enthält "null" anstelle von "0":

                Wo wird Luftfeuchte_Vorzyklus gesetzt?

                Achtung r

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

                  @paul53
                  156117ea-b650-4daf-a6a4-b9d4490345df-grafik.png

                  der Code:

                  Luffeuchtre_Vorzyklus = getState("zigbee.0.00158d000232277b.humidity").val;
                  
                  Homoran paul53 2 Replies Last reply Reply Quote 0
                  • Homoran
                    Homoran Global Moderator Administrators @heinzie last edited by

                    @heinzie sagte in numereiche Variable enthält "null" anstelle von "0":

                    "zigbee.0.00158d000232277b.humidity"

                    und der Wert ist vom Typ number?

                    1 Reply Last reply Reply Quote 0
                    • H
                      heinzie @Homoran last edited by

                      @homoran der Wert kommt von einem Sensor:

                      Definition:

                      {
                        "type": "state",
                        "common": {
                          "name": "Badezimmer Humidity",
                          "type": "number",
                          "unit": "%",
                          "read": true,
                          "write": false,
                          "role": "value.humidity",
                          "min": 0,
                          "max": 100,
                          "custom": {
                            "history.0": {
                              "enabled": true,
                              "changesOnly": true,
                              "debounce": "1000",
                              "maxLength": "960",
                              "retention": "31536000",
                              "changesRelogInterval": 0,
                              "changesMinDelta": 0,
                              "aliasId": ""
                            }
                          }
                        },
                        "from": "system.adapter.zigbee.0",
                        "user": "system.user.admin",
                        "ts": 1593873022524,
                        "_id": "zigbee.0.00158d000232277b.humidity",
                        "acl": {
                          "object": 1636,
                          "state": 1636,
                          "owner": "system.user.admin",
                          "ownerGroup": "system.group.administrator"
                        }
                      }
                      
                      1 Reply Last reply Reply Quote 0
                      • paul53
                        paul53 @heinzie last edited by paul53

                        @heinzie sagte: der Code:

                        Die Variable wurde nicht bei Skriptstart initialisiert und enthält deshalb undefined nach dem Start. Einfacher ist es so:

                        Bild_2021-09-20_174854.png

                        Blockly_DP_Props.JPG

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

                          @paul53 Danke, habe es hinbekommen

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

                          Support us

                          ioBroker
                          Community Adapters
                          Donate

                          772
                          Online

                          32.0k
                          Users

                          80.5k
                          Topics

                          1.3m
                          Posts

                          3
                          11
                          342
                          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