Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. CS486

    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

    C
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 1
    • Best 0
    • Groups 0

    CS486

    @CS486

    0
    Reputation
    44
    Profile views
    1
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    CS486 Follow

    Latest posts made by CS486

    • States können nicht in SQL geloggt werden.

      Hallo zusammen,

      ich habe ein Problem mit der Kombination von Javascript und SQL-Adapter.
      Datenpunkte, die ich in Blockly generiere, werden mir zwar im Objekte-Baum angezeigt und auch wie im Script programmiert aktualisiert, allerdings lassen sie sich nicht im SQL-Adapter loggen.
      Ich habe das ganze nun in zwei fällen beobachtet, im log finde ich folgendes:

      sql.0	2021-01-08 10:41:42.377	info	(14389) No Data
      sql.0	2021-01-08 10:41:42.376	warn	(14389) Cannot get index of "javascript.0.Teichpumpe.Energie": id not found
      

      bzw.

      sql.0	2021-01-08 09:40:10.978	warn	(14389) Cannot get index of "javascript.0.Teichpumpe.Energie": Error: ER_NO_DEFAULT_FOR_FIELD: Field 'id' doesn't have a default value
      sql.0	2021-01-08 09:40:10.977	error	(14389) Cannot insert INSERT INTO `ioBroker`.datapoints (name, type) VALUES('javascript.0.Teichpumpe.Energie', 0);: Error: ER_NO_DEFAULT_FOR_FIELD: Field 'id' doesn't have a default value
      

      Hat jemand eine Idee diebzgl.?

      Das Script sieht so aus:

      var Teichpumpe;
      
      
      createState("Teichpumpe.Strom", 0, async function () {
      });
      createState("Teichpumpe.Leistung", 0, async function () {
      });
      createState("Teichpumpe.Energie", 0, async function () {
      });
      on({id: 'mqtt.0.tele.teichpumpe.SENSOR', change: "any"}, async function (obj) {
        var value = obj.state.val;
        var oldValue = obj.oldState.val;
        Teichpumpe = (function () { try {return JSON.parse(getState("mqtt.0.tele.teichpumpe.SENSOR").val);} catch(e) {return {};}})();
        setState("javascript.0.Teichpumpe.Strom"/*Teichpumpe.Strom*/, getAttr(Teichpumpe, 'ENERGY.Current'));
        setState("javascript.0.Teichpumpe.Leistung"/*Teichpumpe.Leistung*/, getAttr(Teichpumpe, 'ENERGY.Power'));
        setState("javascript.0.Teichpumpe.Energie"/*Teichpumpe.Energie*/, getAttr(Teichpumpe, 'ENERGY.Today'));
      });
      

      Meine Konfiguration ist wie folgt, die Datenbank ist eine MariaDB10 auf Synology.


      {
      "uuid": "",
      "language": "de",
      "country": "Germany",
      "hosts": [
      {
      "version": "3.1.6",
      "platform": "Javascript/Node.js",
      "type": "linux"
      }
      ],
      "node": "v14.15.3",
      "arch": "arm",
      "adapters": {
      "admin": {
      "version": "4.1.12",
      "platform": "Javascript/Node.js"
      },
      "javascript": {
      "version": "4.10.8",
      "platform": "Javascript/Node.js"
      },
      "sql": {
      "version": "1.15.3",
      "platform": "Javascript/Node.js"
      }
      },
      "statesType": "file",
      "objectsType": "file",
      "model": "ARMv7 Processor rev 4 (v7l)",
      "cpus": 4,
      "mem": 969764864,
      "ostype": "Linux",
      "vis": 707
      }

      EDIT: Das Problem liegt offenbar nicht bei den durch den JS-Adapter generierten Zuständen. Ich habe zwischenzeitlich den device-reminder installiert und auch diese Zustände kann ich nicht in SQL speichern. Mit allen alten Zuständen gibt es keine Probleme.

      posted in Blockly
      C
      CS486
    Community
    Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
    The ioBroker Community 2014-2023
    logo