Skip to content
  • Home
  • Aktuell
  • Tags
  • 0 Ungelesen 0
  • Kategorien
  • Unreplied
  • Beliebt
  • GitHub
  • Docu
  • Hilfe
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Standard: (Kein Skin)
  • Kein Skin
Einklappen
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. Deutsch
  3. Skripten / Logik
  4. Blockly
  5. Wo kommt der String her

NEWS

  • Jahresrückblick 2025 – unser neuer Blogbeitrag ist online! ✨
    BluefoxB
    Bluefox
    17
    1
    3.5k

  • Neuer Blogbeitrag: Monatsrückblick - Dezember 2025 🎄
    BluefoxB
    Bluefox
    13
    1
    1.1k

  • Weihnachtsangebot 2025! 🎄
    BluefoxB
    Bluefox
    25
    1
    2.5k

Wo kommt der String her

Geplant Angeheftet Gesperrt Verschoben Blockly
3 Beiträge 2 Kommentatoren 329 Aufrufe
  • Älteste zuerst
  • Neuste zuerst
  • Meiste Stimmen
Antworten
  • In einem neuen Thema antworten
Anmelden zum Antworten
Dieses Thema wurde gelöscht. Nur Nutzer mit entsprechenden Rechten können es sehen.
  • B Offline
    B Offline
    bommel_030
    schrieb am zuletzt editiert von
    #1

    Ich versuche mich gerade daran meinen Stromverbrauch aus diversen Quellen geordnet in kWh zu bringen.
    Sinngemäß, bzw. das was ich in dem Blockly erreichen will:
    Ließ den Zählerstand in Wh aus, vergleiche ihn mit dem alten Wert, rechne die Erhöhung aus und addiere sie zum Zähler. Klappt alles, sicherlich nicht elegant gelöst, aber Java gibt mir folgenden Fehler aus:

    warn: javascript.0 You are assigning a string to the state "javascript.0.Own.Berechnungsvariablen.Verbrauch.Elektro.Desktopvariable" which expects a number. Please fix your code to use a number or change the state type to string. This warning might become an error in future versions.
    

    Blockly Export


    <xml xmlns="http://www.w3.org/1999/xhtml">
    <block type="on_ext" id="A]8VM$ovm+gy:;fOq%9" x="12" y="-51"> <mutation items="1"></mutation> <field name="CONDITION">ne</field> <field name="ACK_CONDITION"></field> <value name="OID0"> <shadow type="field_oid" id="_L8Q^7L1WFQkuJebXKx}"> <field name="oid">fritzdect.0.DECT200_087610114581.energy</field> </shadow> </value> <statement name="STATEMENT"> <block type="controls_if" id="io$S+3:RCT5V*/os3oKT"> <mutation elseif="1"></mutation> <value name="IF0"> <block type="logic_compare" id="H?,NFX10V@gR0NNWi-[8"> <field name="OP">GT</field> <value name="A"> <block type="get_value" id="K!q003MPHp|)(pt8U@3c"> <field name="ATTR">val</field> <field name="OID">fritzdect.0.DECT200_087610114581.energy</field> </block> </value> <value name="B"> <block type="get_value" id="q;1LV~zsb:xZrhB5|i5$"> <field name="ATTR">val</field> <field name="OID">javascript.0.Own.Berechnungsvariablen.Verbrauch.Elektro.Desktopvariable</field> </block> </value> </block> </value> <statement name="DO0"> <block type="update" id="Gj=ViOWu*S=~|s(uSmk{"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Own.Berechnungsvariablen.Verbrauch.Elektro.DesktopWh</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="math_arithmetic" id="4EWP$.~r]dz$Zq)wP_*u"> <field name="OP">ADD</field> <value name="A"> <shadow type="math_number" id="L(YySAa=x#p9]Zy$KJfq"> <field name="NUM">1</field> </shadow> <block type="get_value" id="zBeX%bBc^.HA8ZS~DLJ5"> <field name="ATTR">val</field> <field name="OID">javascript.0.Own.Berechnungsvariablen.Verbrauch.Elektro.DesktopWh</field> </block> </value> <value name="B"> <shadow type="math_number" id="toF|[j$MR|/LY5cL$Xt,"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id=",@^X)xgi^i{9BaawM|O">
    <field name="OP">MINUS</field>
    <value name="A">
    <shadow type="math_number" id="H$a2]QigtUvI6hs}c6Co">
    <field name="NUM">1</field>
    </shadow>
    <block type="get_value" id="NmcfYwqIA@_87t-g3=4J">
    <field name="ATTR">val</field>
    <field name="OID">fritzdect.0.DECT200_087610114581.energy</field>
    </block>
    </value>
    <value name="B">
    <shadow type="math_number" id="P]+;TKxdvsYpq;}HIUR$">
    <field name="NUM">1</field>
    </shadow>
    <block type="get_value" id="Ib|m%qw(vt[2NFnnr/S"> <field name="ATTR">val</field> <field name="OID">javascript.0.Own.Berechnungsvariablen.Verbrauch.Elektro.Desktopvariable</field> </block> </value> </block> </value> </block> </value> <next> <block type="update" id="A1!]80mB7+|/{Jb@ON8N"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Own.Berechnungsvariablen.Verbrauch.Elektro.Desktopvariable</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="get_value" id="H~$H3:;VK7BIdvJ1b*i]"> <field name="ATTR">val</field> <field name="OID">fritzdect.0.DECT200_087610114581.energy</field> </block> </value> </block> </next> </block> </statement> <value name="IF1"> <block type="logic_compare" id="60Me2gh84YGDJ0)nI9P3"> <field name="OP">LT</field> <value name="A"> <block type="get_value" id="utEmQIL89b2Z-tQOmnX,"> <field name="ATTR">val</field> <field name="OID">fritzdect.0.DECT200_087610114581.energy</field> </block> </value> <value name="B"> <block type="get_value" id="}BbI6#5hB_zwQzzD8hGX"> <field name="ATTR">val</field> <field name="OID">javascript.0.Own.Berechnungsvariablen.Verbrauch.Elektro.Desktopvariable</field> </block> </value> </block> </value> <statement name="DO1"> <block type="update" id="jd,;YR0hOIp(4L=:*N3">
    <mutation delay_input="false"></mutation>
    <field name="OID">javascript.0.Own.Berechnungsvariablen.Verbrauch.Elektro.Desktopvariable</field>
    <field name="WITH_DELAY">FALSE</field>
    <value name="VALUE">
    <block type="get_value" id="PpTi}KpAp#fi}89Vc=ni">
    <field name="ATTR">val</field>
    <field name="OID">fritzdect.0.DECT200_087610114581.energy</field>
    </block>
    </value>
    </block>
    </statement>
    </block>
    </statement>
    </block>
    </xml>

    Und Bild in schlechter Auflösung...
    536143bc-d26c-4e86-a920-60acbbbbd6cb-image.png
    Nach meinem Verständnis ist hier nichts mehr als String.

    paul53P 1 Antwort Letzte Antwort
    0
    • B bommel_030

      Ich versuche mich gerade daran meinen Stromverbrauch aus diversen Quellen geordnet in kWh zu bringen.
      Sinngemäß, bzw. das was ich in dem Blockly erreichen will:
      Ließ den Zählerstand in Wh aus, vergleiche ihn mit dem alten Wert, rechne die Erhöhung aus und addiere sie zum Zähler. Klappt alles, sicherlich nicht elegant gelöst, aber Java gibt mir folgenden Fehler aus:

      warn: javascript.0 You are assigning a string to the state "javascript.0.Own.Berechnungsvariablen.Verbrauch.Elektro.Desktopvariable" which expects a number. Please fix your code to use a number or change the state type to string. This warning might become an error in future versions.
      

      Blockly Export


      <xml xmlns="http://www.w3.org/1999/xhtml">
      <block type="on_ext" id="A]8VM$ovm+gy:;fOq%9" x="12" y="-51"> <mutation items="1"></mutation> <field name="CONDITION">ne</field> <field name="ACK_CONDITION"></field> <value name="OID0"> <shadow type="field_oid" id="_L8Q^7L1WFQkuJebXKx}"> <field name="oid">fritzdect.0.DECT200_087610114581.energy</field> </shadow> </value> <statement name="STATEMENT"> <block type="controls_if" id="io$S+3:RCT5V*/os3oKT"> <mutation elseif="1"></mutation> <value name="IF0"> <block type="logic_compare" id="H?,NFX10V@gR0NNWi-[8"> <field name="OP">GT</field> <value name="A"> <block type="get_value" id="K!q003MPHp|)(pt8U@3c"> <field name="ATTR">val</field> <field name="OID">fritzdect.0.DECT200_087610114581.energy</field> </block> </value> <value name="B"> <block type="get_value" id="q;1LV~zsb:xZrhB5|i5$"> <field name="ATTR">val</field> <field name="OID">javascript.0.Own.Berechnungsvariablen.Verbrauch.Elektro.Desktopvariable</field> </block> </value> </block> </value> <statement name="DO0"> <block type="update" id="Gj=ViOWu*S=~|s(uSmk{"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Own.Berechnungsvariablen.Verbrauch.Elektro.DesktopWh</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="math_arithmetic" id="4EWP$.~r]dz$Zq)wP_*u"> <field name="OP">ADD</field> <value name="A"> <shadow type="math_number" id="L(YySAa=x#p9]Zy$KJfq"> <field name="NUM">1</field> </shadow> <block type="get_value" id="zBeX%bBc^.HA8ZS~DLJ5"> <field name="ATTR">val</field> <field name="OID">javascript.0.Own.Berechnungsvariablen.Verbrauch.Elektro.DesktopWh</field> </block> </value> <value name="B"> <shadow type="math_number" id="toF|[j$MR|/LY5cL$Xt,"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id=",@^X)xgi^i{9BaawM|O">
      <field name="OP">MINUS</field>
      <value name="A">
      <shadow type="math_number" id="H$a2]QigtUvI6hs}c6Co">
      <field name="NUM">1</field>
      </shadow>
      <block type="get_value" id="NmcfYwqIA@_87t-g3=4J">
      <field name="ATTR">val</field>
      <field name="OID">fritzdect.0.DECT200_087610114581.energy</field>
      </block>
      </value>
      <value name="B">
      <shadow type="math_number" id="P]+;TKxdvsYpq;}HIUR$">
      <field name="NUM">1</field>
      </shadow>
      <block type="get_value" id="Ib|m%qw(vt[2NFnnr/S"> <field name="ATTR">val</field> <field name="OID">javascript.0.Own.Berechnungsvariablen.Verbrauch.Elektro.Desktopvariable</field> </block> </value> </block> </value> </block> </value> <next> <block type="update" id="A1!]80mB7+|/{Jb@ON8N"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Own.Berechnungsvariablen.Verbrauch.Elektro.Desktopvariable</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="get_value" id="H~$H3:;VK7BIdvJ1b*i]"> <field name="ATTR">val</field> <field name="OID">fritzdect.0.DECT200_087610114581.energy</field> </block> </value> </block> </next> </block> </statement> <value name="IF1"> <block type="logic_compare" id="60Me2gh84YGDJ0)nI9P3"> <field name="OP">LT</field> <value name="A"> <block type="get_value" id="utEmQIL89b2Z-tQOmnX,"> <field name="ATTR">val</field> <field name="OID">fritzdect.0.DECT200_087610114581.energy</field> </block> </value> <value name="B"> <block type="get_value" id="}BbI6#5hB_zwQzzD8hGX"> <field name="ATTR">val</field> <field name="OID">javascript.0.Own.Berechnungsvariablen.Verbrauch.Elektro.Desktopvariable</field> </block> </value> </block> </value> <statement name="DO1"> <block type="update" id="jd,;YR0hOIp(4L=:*N3">
      <mutation delay_input="false"></mutation>
      <field name="OID">javascript.0.Own.Berechnungsvariablen.Verbrauch.Elektro.Desktopvariable</field>
      <field name="WITH_DELAY">FALSE</field>
      <value name="VALUE">
      <block type="get_value" id="PpTi}KpAp#fi}89Vc=ni">
      <field name="ATTR">val</field>
      <field name="OID">fritzdect.0.DECT200_087610114581.energy</field>
      </block>
      </value>
      </block>
      </statement>
      </block>
      </statement>
      </block>
      </xml>

      Und Bild in schlechter Auflösung...
      536143bc-d26c-4e86-a920-60acbbbbd6cb-image.png
      Nach meinem Verständnis ist hier nichts mehr als String.

      paul53P Offline
      paul53P Offline
      paul53
      schrieb am zuletzt editiert von paul53
      #2

      @bommel_030:Wo kommt der String her
      Aus einem der Datenpunkte, wahrscheinlich "Switch total energy".

      Test es mal außerhalb des Triggers bei Skriptstart:

      debug output  Typ von  Wert vom Objekt Switch total energy
      

      Bitte verzichtet auf Chat-Nachrichten, denn die Handhabung ist grauenhaft !
      Produktiv: RPi 2 mit S.USV, HM-MOD-RPI und SLC-USB-Stick mit root fs

      B 1 Antwort Letzte Antwort
      0
      • paul53P paul53

        @bommel_030:Wo kommt der String her
        Aus einem der Datenpunkte, wahrscheinlich "Switch total energy".

        Test es mal außerhalb des Triggers bei Skriptstart:

        debug output  Typ von  Wert vom Objekt Switch total energy
        
        B Offline
        B Offline
        bommel_030
        schrieb am zuletzt editiert von
        #3

        @paul53 said in Wo kommt der String her:

        debug output Typ von Wert vom Objekt Switch total energy

        javascript.0 script.js.Eigene.Verbruachstest: string

        Danke für den Tip, obwohl ich es nicht verstehe... Der Datenpunkt ist als Zahl definiert... D.h. ich setze einfach ein "konvertiere in Zahl davor"...


        {
        "from": "system.adapter.fritzdect.0",
        "ts": 1542029430318,
        "user": "system.user.admin",
        "common": {
        "name": "Switch total energy",
        "type": "number",
        "unit": "Wh",
        "role": "value.power.consumption",
        "desc": "Switch total energy",
        "min": 0,
        "read": true,
        "write": false,
        "custom": {
        "sql.0": {
        "enabled": true,
        "changesOnly": true,
        "debounce": "1000",
        "retention": 0,
        "changesRelogInterval": "",
        "changesMinDelta": 0,
        "storageType": "",
        "aliasId": ""
        },
        "statistics.0": {
        "enabled": true,
        "logName": "Switch total energy",
        "count": false,
        "sumCount": false,
        "timeCount": false,
        "fiveMin": false,
        "groupFactor": 0.001,
        "impUnit": "",
        "impUnitPerImpulse": "",
        "sumIgnoreMinus": true,
        "sumDelta": true,
        "avg": true,
        "minmax": true,
        "sumGroup": "energy"
        }
        }
        },
        "native": {},
        "acl": {
        "object": 1636,
        "owner": "system.user.admin",
        "ownerGroup": "system.group.administrator",
        "state": 1636
        },
        "_id": "fritzdect.0.DECT200_087610114581.energy",
        "type": "state"
        }

        1 Antwort Letzte Antwort
        0
        Antworten
        • In einem neuen Thema antworten
        Anmelden zum Antworten
        • Älteste zuerst
        • Neuste zuerst
        • Meiste Stimmen


        Support us

        ioBroker
        Community Adapters
        Donate

        642

        Online

        32.7k

        Benutzer

        82.4k

        Themen

        1.3m

        Beiträge
        Community
        Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
        ioBroker Community 2014-2025
        logo
        • Anmelden

        • Du hast noch kein Konto? Registrieren

        • Anmelden oder registrieren, um zu suchen
        • Erster Beitrag
          Letzter Beitrag
        0
        • Home
        • Aktuell
        • Tags
        • Ungelesen 0
        • Kategorien
        • Unreplied
        • Beliebt
        • GitHub
        • Docu
        • Hilfe