Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Problemen mit Typ

    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

    Problemen mit Typ

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

      javascript.0	2020-04-26 15:02:11.625	warn	(30281) at script.js.DEV.a2:40:13
      javascript.0	2020-04-26 15:02:11.625	warn	(30281) at setState (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1354:20)
      javascript.0	2020-04-26 15:02:11.625	warn	(30281) You are assigning a string to the state "javascript.0.Devices.ebus.currenterror.1.ErrorText" which expects a String. Please fix your code to use a String or change the state type to string. T
      javascript.0	2020-04-26 15:02:11.624	warn	(30281) at script.js.DEV.a2:39:13
      javascript.0	2020-04-26 15:02:11.624	warn	(30281) at setState (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1354:20)
      javascript.0	2020-04-26 15:02:11.624	warn	(30281) You are assigning a number to the state "javascript.0.Devices.ebus.currenterror.1.ErrorCode" which expects a Number. Please fix your code to use a Number or change the state type to number. T
      

      You are assigning a string to the state "javascript.0.Devices.ebus.currenterror.1.ErrorText" which expects a String. Please fix your code to use a String or change the state type to string.

      Was soll ich noch machen? Die gleiche Warnung erhalte ich bei number. Dabei spielt es keine Rolle ob ich ein number gebe oder sogar nach number konvertiere.

      Was mache ich falsch?

      for(var i=0; i<5; i++) {
          if (!getObject(storeDP + "." + i + ".ErrorCode")) {
              createState(storeDP + "." + i + ".ErrorCode", "", {
                  "desc": "ErrorCode",
                  "name": "ErrorCode",
                  "type": "number",
                  "role": "",
                  "unit": ""
              });
          }
          if (!getObject(storeDP + "." + i + ".ErrorText")) {
              createState(storeDP + "." + i + ".ErrorText", "", {
                  "desc": "ErrorText",
                  "name": "ErrorText",
                  "type": "string",
                  "role": "",
                  "unit": ""
              });
          }
      }
      
          for(i=0;i<5;i++) {
              stat = getState(id+"."+i+".value").val;
              if(stat){
                  setState(storeDP+"."+i+".ErrorCode", Number(stat));
                  setState(storeDP+"."+i+".ErrorText", meldungen.get(stat));
                  log(stat);
                  log(meldungen.get(stat));
              }
          }
      
      Homoran paul53 3 Replies Last reply Reply Quote 0
      • Homoran
        Homoran Global Moderator Administrators @a200 last edited by

        @a200 sagte in Problemen mit Typ:

        or change the state type to string.

        ich habe da irgendwie den Verdacht, dass die bisherige sehr kryptische Fehlermeldung jetzt zwar länger ist, aber so nicht passt.

        Welchen Typ hat denn der Datenpunkt?

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

          @a200 sagte:

          Was mache ich falsch?

          Groß-/Kleinschreibung: "Number" und "String" sind unzulässig.

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

            @paul53 wie man in der Datenpunktdefinition sieht nutze ich klein-geschriebenes string und number.

            bei der Javascriptfunktion dachte ich immer das sie Number() heißt. Aber die Änderung auf number() hat geholfen. Danke.

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

              @a200 sagte:

              "javascript.0.Devices.ebus.currenterror.1.ErrorText" which expects a String
              "javascript.0.Devices.ebus.currenterror.1.ErrorCode" which expects a Number

              Diese beiden Datenpunkte enthalten offenbar einen falsch geschriebenen common.type.

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

              Support us

              ioBroker
              Community Adapters
              Donate

              849
              Online

              31.9k
              Users

              80.1k
              Topics

              1.3m
              Posts

              javascript
              3
              5
              908
              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