Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. JavaScript
    5. Anleitung: history.0 to sql.0 -> custom richtig setzen

    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

    Anleitung: history.0 to sql.0 -> custom richtig setzen

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

      Hi Ihr,
      aus eigener Erfahrung, hier mein Ansatz...

      Konfiguration komplett ersetzen:

      var newCustomDict = {
              "sql.0": {
                "enabled": true,
                "storageType": "",
                "counter": false,
                "aliasId": "",
                "changesOnly": true,
                "debounce": 1000,
                "changesRelogInterval": 1,
                "changesMinDelta": 0,
                "retention": 0
              },
      // WICHTIG !!! die anderen Adapter müssen aufgeführt werden, weil sonst automatisch alle aktiviert und defaults gesetzt werden
             "history.0": {"enabled": false},
             "iqontrol.9": {"enabled": false},
             [...]
          };
      
      sendTo('history.0', 'getEnabledDPs', {}, function (result) {
          for(const histObjId of Object.keys(result)) {
              var dataObj = getObject(histObjId);
              dataObj.common.custom = newCustomDict;
              setObject(histObjId, dataObj);
          }
      });
      

      Konfiguration erweitern mit sql.0:

      var newCustomDict = {
              "sql.0": {
                "enabled": true,
                "storageType": "",
                "counter": false,
                "aliasId": "",
                "changesOnly": true,
                "debounce": 1000,
                "changesRelogInterval": 1,
                "changesMinDelta": 0,
                "retention": 0
              }
          };
      
      sendTo('history.0', 'getEnabledDPs', {}, function (result) {
          for(const histObjId of Object.keys(result)) {
              var dataObj = getObject(histObjId);
              const lodash = require('lodash')
              dataObj.common.custom = lodash.merge(dataObj.common.custom, newCustomDict);
              setObject(histObjId, dataObj);
          }
      });
      
      1 Reply Last reply Reply Quote 0
      • First post
        Last post

      Support us

      ioBroker
      Community Adapters
      Donate

      793
      Online

      31.8k
      Users

      80.0k
      Topics

      1.3m
      Posts

      1
      1
      152
      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