Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. [GELÖST]Warning: Boolean anstatt Number

    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

    [GELÖST]Warning: Boolean anstatt Number

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

      Moin, ich habe mir ein kleines Blockly Script erstellt, um die Rohwerte meines Sensors in einen Datenpunkt zu schreiben. Es funktioniert auch soweit. Allerdings bekomme ich immer eine Warnung, dass ich eine Nummer sende, aber ein Boolean-Wert erwartet wird. Der Datenpunkt wird per Script erstellt und dort habe ich auch als "Zustandstyp" Zahl(number) angegeben. Was habe ich hier falsch gemacht?
      Gruß
      Hans-J.
      Blockly.jpg

      
      
      javascript.0
      2025-01-07 10:42:50.515	warn	at Immediate._onImmediate (/opt/iobroker/node_modules/@iobroker/js-controller-adapter/src/lib/adapter/adapter.ts:11048:62)
      
      javascript.0
      2025-01-07 10:42:50.515	warn	at Object.stateChange (/opt/iobroker/node_modules/iobroker.javascript/main.js:645:29)
      
      javascript.0
      2025-01-07 10:42:50.515	warn	at Object.callback (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1452:38)
      
      javascript.0
      2025-01-07 10:42:50.515	warn	at Object.<anonymous> (script.js.Meine_Scripte.Wasseruhr_Tasmota:9:3)
      
      javascript.0
      2025-01-07 10:42:50.515	warn	at setState (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:2090:20)
      
      javascript.0
      2025-01-07 10:42:50.514	warn	You are assigning a number to the state "0_userdata.0.Wasser_Zaehlerstand" which expects a boolean. Please fix your code to use a boolean or change the state type to number. This warning might become an error in future versions.
      
      
      {
        "common": {
          "type": "boolean",
          "read": false,
          "write": false,
          "name": "0_userdata.0.Wasser_Zaehlerstand",
          "unit": "m³",
          "role": "state",
          "custom": {
            "influxdb.0": {
              "enabled": true,
              "storageType": "Number",
              "aliasId": "Wasser_Zaehler_aktuell",
              "debounceTime": 0,
              "blockTime": 0,
              "changesOnly": false,
              "changesRelogInterval": 0,
              "changesMinDelta": 0,
              "ignoreBelowNumber": "",
              "disableSkippedValueLogging": false,
              "enableDebugLogs": false,
              "debounce": 0
            },
            "sourceanalytix.0": {
              "enabled": true,
              "selectedUnit": "m³",
              "deviceResetLogicEnabled": true,
              "threshold": 1,
              "start_day": 0.28400000000000003,
              "start_week": 0,
              "start_month": 0,
              "start_quarter": 0,
              "start_year": 0,
              "selectedPrice": "Water",
              "alias": "Wasserverbrauch",
              "consumption": true,
              "meter_values": true,
              "valueAtDeviceReset": 0,
              "valueAtDeviceInit": null,
              "cumulativeValue": 0.28400000000000003
            }
          }
        },
        "native": {},
        "type": "state",
        "_id": "0_userdata.0.Wasser_Zaehlerstand",
        "acl": {
          "object": 1636,
          "state": 1636,
          "owner": "system.user.admin",
          "ownerGroup": "system.group.administrator"
        },
        "from": "system.adapter.sourceanalytix.0",
        "user": "system.user.admin",
        "ts": 1736204400033
      }
      
      haus-automatisierung 1 Reply Last reply Reply Quote 0
      • haus-automatisierung
        haus-automatisierung Developer Most Active @Jack01 last edited by

        @jack01 sagte in Warning: Boolean anstatt Number:

        Der Datenpunkt wird per Script erstellt und dort habe ich auch als "Zustandstyp" Zahl(number) angegeben. Was habe ich hier falsch gemacht?

        Eventuell hast Du das Script ja 1x ausgeführt, als der Datentyp noch auf Boolean stand. Der Baustein "Datenpunkt erzeugen" ändert diesen nicht ab, falls er schon existiert. Also am besten manuell den Datentyp ändern.

        J 1 Reply Last reply Reply Quote 0
        • J
          Jack01 @haus-automatisierung last edited by

          @haus-automatisierung Vielen Dank für Deine schnelle Antwort. Also einfach bei "Objekt bearbeiten" den Zustandstyp auf "Zahl" stellen?
          Gruß
          Hans-J.
          Datentyp.jpg

          haus-automatisierung paul53 2 Replies Last reply Reply Quote 0
          • haus-automatisierung
            haus-automatisierung Developer Most Active @Jack01 last edited by

            @jack01 sagte in Warning: Boolean anstatt Number:

            Also einfach bei "Objekt bearbeiten" den Zustandstyp auf "Zahl" stellen?

            Ja, Du schreibst ja einen numerischen Wert, ...

            1 Reply Last reply Reply Quote 1
            • paul53
              paul53 @Jack01 last edited by paul53

              @jack01 sagte: Zustandstyp auf "Zahl" stellen?

              Ja. Besser noch weitere Korrekturen:

                  "type": "number",
                  "read": true,
                  "write": false,
                  "name": "Wasser Zählerstand",
                  "unit": "m³",
                  "role": "value",
              
              1 Reply Last reply Reply Quote 2
              • First post
                Last post

              Support us

              ioBroker
              Community Adapters
              Donate

              413
              Online

              31.8k
              Users

              80.0k
              Topics

              1.3m
              Posts

              3
              5
              243
              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