Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. JavaScript
    5. Script Influxdb Fehler timeout

    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

    Script Influxdb Fehler timeout

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

      Hallo, ich benutze diese Script um ein paar Werte in die influxDB zu schreiben:

      // v0.3
      const influxDbInstance = 'influxdb.0';
      const token = 'Mgu2aK3gyWInz7rWT6AuV-sDrDsKQkld7vk08z-V8TMenh67cH4zLYQLQiP35i4bBtCmjab6OPpPXEsnmethpA==';
      const measurement = 'power-stats';
      
      const loggingTemplate = {
          'alias.0.energy.electricity.meter.in': 'meterInW',
          'alias.0.energy.electricity.meter.out': 'meterOutW',
          'alias.0.energy.electricity.photovoltaic.power': 'generatorW',
          'alias.0.energy.electricity.wallbox.power': 'wallboxW',
          'alias.0.energy.electricity.meter.WPPower': 'WPW',
          'alias.0.energy.electricity.meter.housePow': 'houseW'
      };
      
      const loggingObj = {};
      
      async function start() {
          const influxDbInstanceConfig = await getObjectAsync(`system.adapter.${influxDbInstance}`);
      
          const protocol = influxDbInstanceConfig.native.protocol;
          const host = influxDbInstanceConfig.native.host;
          const port = influxDbInstanceConfig.native.port;
          const org = influxDbInstanceConfig.native.organization;
          const bucket = influxDbInstanceConfig.native.dbname;
      
          console.log(`Starting "${measurement}" logging to ${protocol}://${host}:${port} into bucket "${bucket}" by org ${org}`);
      
          // Init loggingObj with current values
          for (let [objId, key] of Object.entries(loggingTemplate)) {
              const state = await getStateAsync(objId);
              if (state && !isNaN(state.val)) {
                  loggingObj[key] = state.val;
              } else {
                  loggingObj[key] = 0;
              }
          }
      
          on({ id: Object.keys(loggingTemplate), change: 'ne' }, async (obj) => {
              // Update value in loggingObj
              const key = loggingTemplate[obj.id];
              loggingObj[key] = obj.state.val;
      
              // Save Data
              const data = `${measurement} ${Object.keys(loggingObj)
                  .filter(key => !isNaN(loggingObj[key]))
                  .map((key) => `${key}=${loggingObj[key]}`)
                  .join(',')}`;
      
              if (data) {
                  // console.log(`Saving "${data}" to InfluxDB @ ${protocol}://${host}:${port}/`);
      
                  httpPostAsync(`${protocol}://${host}:${port}/api/v2/write?bucket=${bucket}&org=${org}`, data, {
                      headers: {
                          'Content-Type': 'text/plain',
                          'Authorization': `Token ${token}`
                      }
                  }).catch(err => console.error(err));
              }
          });
      }
      start();
      

      Ich bekomme aber in gewissen Zeitabständen immer diese Fehlermeldung:

      javascript.0
      2024-12-26 15:43:26.291	error	script.js.Energie_Strom.Stromverbrauch.Strom_PV_PowerStats: Error: timeout of 2000ms exceeded at Object.<anonymous> (/opt/iobroker/node_modules/iobroker.javascript/lib/tools.js:87:43) at /opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1325:38
      
      javascript.0
      2024-12-26 15:43:26.290	error	script.js.Energie_Strom.Stromverbrauch.Strom_PV_PowerStats: httpPost(url=http://192.168.178.3:8086/api/v2/write?bucket=iobroker&org=openHAB, error=timeout of 2000ms exceeded)
      
      javascript.0
      2024-12-26 15:43:24.462	error	script.js.Energie_Strom.Stromverbrauch.Strom_PV_PowerStats: Error: timeout of 2000ms exceeded at Object.<anonymous> (/opt/iobroker/node_modules/iobroker.javascript/lib/tools.js:87:43) at /opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1325:38
      
      javascript.0
      2024-12-26 15:43:24.462	error	script.js.Energie_Strom.Stromverbrauch.Strom_PV_PowerStats: httpPost(url=http://192.168.178.3:8086/api/v2/write?bucket=iobroker&org=openHAB, error=timeout of 2000ms exceeded)
      
      javascript.0
      2024-12-26 15:43:24.413	error	script.js.Energie_Strom.Stromverbrauch.Strom_PV_PowerStats: Error: timeout of 2000ms exceeded at Object.<anonymous> (/opt/iobroker/node_modules/iobroker.javascript/lib/tools.js:87:43) at /opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1325:38
      
      javascript.0
      2024-12-26 15:43:24.412	error	script.js.Energie_Strom.Stromverbrauch.Strom_PV_PowerStats: httpPost(url=http://192.168.178.3:8086/api/v2/write?bucket=iobroker&org=openHAB, error=timeout of 2000ms exceeded)
      
      javascript.0
      2024-12-26 15:43:24.383	error	script.js.Energie_Strom.Stromverbrauch.Strom_PV_PowerStats: Error: timeout of 2000ms exceeded at Object.<anonymous> (/opt/iobroker/node_modules/iobroker.javascript/lib/tools.js:87:43) at /opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1325:38
      
      javascript.0
      2024-12-26 15:43:24.383	error	script.js.Energie_Strom.Stromverbrauch.Strom_PV_PowerStats: httpPost(url=http://192.168.178.3:8086/api/v2/write?bucket=iobroker&org=openHAB, error=timeout of 2000ms exceeded)
      
      javascript.0
      2024-12-26 15:43:22.168	error	script.js.Energie_Strom.Stromverbrauch.Strom_PV_PowerStats: Error: timeout of 2000ms exceeded at Object.<anonymous> (/opt/iobroker/node_modules/iobroker.javascript/lib/tools.js:87:43) at /opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1325:38 at runNextTicks (node:internal/process/task_queues:60:5) at listOnTimeout (node:internal/timers:545:9) at processTimers (node:internal/timers:519:7)
      
      javascript.0
      2024-12-26 15:43:22.168	error	script.js.Energie_Strom.Stromverbrauch.Strom_PV_PowerStats: httpPost(url=http://192.168.178.3:8086/api/v2/write?bucket=iobroker&org=openHAB, error=timeout of 2000ms exceeded)
      
      javascript.0
      2024-12-26 15:43:21.087	error	script.js.Energie_Strom.Stromverbrauch.Strom_PV_PowerStats: Error: timeout of 2000ms exceeded at Object.<anonymous> (/opt/iobroker/node_modules/iobroker.javascript/lib/tools.js:87:43) at /opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1325:38 at runNextTicks (node:internal/process/task_queues:60:5) at listOnTimeout (node:internal/timers:545:9) at processTimers (node:internal/timers:519:7)
      
      javascript.0
      2024-12-26 15:43:21.084	error	script.js.Energie_Strom.Stromverbrauch.Strom_PV_PowerStats: httpPost(url=http://192.168.178.3:8086/api/v2/write?bucket=iobroker&org=openHAB, error=timeout of 2000ms exceeded)
      

      Wo ist das Problem?

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

      Support us

      ioBroker
      Community Adapters
      Donate

      540
      Online

      31.8k
      Users

      80.0k
      Topics

      1.3m
      Posts

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