NEWS
Für viele Objekte InfluxDB inkl. Aliase aktivieren
-
Hi zusammen,
ich habe sehr viele Homematic-IP (hmip) Instanzen, mit ganz vielen Thermostate und Fenstersensoren und möchte gerne für bestimmte Merkmale (windowOpen, lowBat, ...) InfluxDB aktivieren.
Allerdings möchte ich auch Aliase nutzen, die natürlich jeweils individuell sind, also eigentlich immer Objekt-Name + "." + Merkmal.Wie bekomme ich sowas hin, ohne das für hunderte manuell durchzuführen?
Danke
Cedric -
Hi zusammen,
ich habe sehr viele Homematic-IP (hmip) Instanzen, mit ganz vielen Thermostate und Fenstersensoren und möchte gerne für bestimmte Merkmale (windowOpen, lowBat, ...) InfluxDB aktivieren.
Allerdings möchte ich auch Aliase nutzen, die natürlich jeweils individuell sind, also eigentlich immer Objekt-Name + "." + Merkmal.Wie bekomme ich sowas hin, ohne das für hunderte manuell durchzuführen?
Danke
CedricFalls es noch jemand anderes braucht, ich habe mir ein Script erstellt:
// returns device id of state, device or channel-id function getDeviceId(id) { return id.match(/(.+[a-zA-Z0-9]{24})/g); } // check if id has influx enabled function isInfluxEnabled(fullList, id, checkAliasToo) { if(fullList[id] != undefined && fullList[id].enabled && (checkAliasToo == null || checkAliasToo == fullList[id].aliasId)) { console.log("angeschaltet: " + getObject(getDeviceId(id)).common.name); return true; } // default return false; } // enable influxdb function enableInflux(id, alias) { sendTo('influxdb.0', 'enableHistory', { id: id, options: { changesOnly: true, debounceTime: 0, blockTime: 0, changesRelogInterval: 0, retention: 31536000, maxLength: 3, changesMinDelta: 0, aliasId: alias } }, function (result) { if (result.error) { console.log(result.error); } if (result.success) { // successfully enabled } }); } // disable infludb function disableInflux(id) { sendTo('influxdb.0', 'disableHistory', { id: id, }, function (result) { if (result.error) { console.log(result.error); } if (result.success) { // successfully disabled } }); } const deviceBase = "hmip.*.devices.*"; // hmip.0.devices.3014F711A000201D89AC42E3 const dataPoints = {".channels.1.valveActualTemperature" : 1, ".channels.1.temperatureOffset" : 0, ".channels.0.lowBat" : 0}; // 0=disable; 1=enable // get full list of enabled influx datapoints sendTo('influxdb.0', 'getEnabledDPs', {}, function (fullList) { //console.log(fullList); // loop through all datapoints for (const [dataPoint, enable] of Object.entries(dataPoints)) { // get all devices var devices = $('state[id=' +deviceBase+dataPoint+']'); console.log("Number of Devices found: " + devices.length); // loop through all devices devices.each(function (id, i){ // alias var aliasId = getObject(getDeviceId(id)).common.name + dataPoint; if( enable == 1) { // enable influx if( !isInfluxEnabled(fullList, id, aliasId)) { console.log("ENABLE: " + aliasId); enableInflux(id, aliasId) } } else { // disable influx console.log("DISABLE: " + aliasId); disableInflux(id); } }); // devices } // datapoints });
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login