NEWS
Script Influxdb Fehler timeout
-
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?