NEWS
ARTNET DMX Script "...has an invalid value (int)"
-
Hi Leute,
ich hätte heute wieder mal versucht das ARTNET DMX Script in Betrieb zu nehmen:
Hier das Script:
//################## Hier IP Adresse des Artnet Gateways eintragen #################// var options = { host : '192.168.0.1', // Hier die IP Adresse eintragen sendAll : true }; var artnet; //################ Hier Artnet Universe und Updatefrequenz anpassen ################// var universe = 0; // Default Universe ist 0! var updatesPerSecond = 25; // Je nachdem sind hier Werte ab 15 halbwegs flimmerfrei! var updateValueSkip = 1; // Hier können Werte übersprungen werden, default ist 0! // Standartmäßig wird mit jedem Update ein DMX Wert hoch/runter gezählt, mit updateValueSkip // kann ein Wert hinzuaddiert werden: Beispiel: updateValueSkip = 1 -> Es wird mit jedem Update // ein Wert + 1 (also 2 *g*) hoch/runter gezählt, somit wird schneller, aber ruppiger gefadet! //######################## Ab hier ist alles Programmcode! #########################// var dmx = []; var dmxNew = []; var dmxNewPending = []; var roundValue; var rounds; var isRunning = 0; var r; var pending; var stopExecution; function filterNull(noNull) { return noNull >= 0; } var initialize = function() { for (i = 0; i < '513'; i++) { dmx[i] = 'null'; dmxNew[i] = 'null'; dmxNewPending[i] = 'null'; try { if (getIdByName("DMX_Channel_" + i) !== undefined) { if (getState("artnet.universe" + universe + ".DMX_Channel_" + i).val > 0) { dmx[i] = getState("artnet.universe" + universe + ".DMX_Channel_" + i).val; } } else if (i > 0) { createState("artnet.universe" + universe + "." + "DMX_Channel_" + i , { name: 'DMX_Channel_' + i, type: 'int', role: 'value', def: 0, }); if (i == 512) { console.log("States wurden angelegt!"); } } } catch(e){} } return idle(); }; function idle() { var DMXAddress; var DMXNewValue; on({id: /^javascript\.\d\.artnet.universe/, change: "ne"}, function (obj) { DMXAddress = obj.name.match(/\d+/); DMXNewValue = parseInt(obj.state.val); dmxNewPending[DMXAddress] = DMXNewValue; clearTimeout(pending); updateValues(); }); } var updateValues = function() { pending = setTimeout(function () { if (dmxNew != dmxNewPending) { if (isRunning) { stopExecution = 1; clearTimeout(pending); return updateValues(); } if (!isRunning) { stopExecution = 0; dmxNew = dmxNewPending.slice(); for (i = 0; i < '513'; i++) { if (dmx[i] == 'null' && dmxNew[i] != 'null') { dmx[i] = 0; } } return executeArtnet(); } } },500); }; var executeArtnet = function() { isRunning = 1; artnet = require('artnet')(options); var dmxOldMinMax = []; var dmxNewMinMax = []; dmxOldMinMax = dmx.slice(1); dmxNewMinMax = dmxNew.slice(1); dmxNewMinValue = Math.min(...dmxNew.filter(filterNull)); dmxNewMaxValue = Math.max(...dmxNew.filter(filterNull)); dmxOldMinValue = Math.min(...dmx.filter(filterNull)); dmxOldMaxValue = Math.max(...dmx.filter(filterNull)); dmxMaxValue = Math.max(dmxNewMaxValue, dmxOldMaxValue); dmxMinValue = Math.min(dmxNewMinValue, dmxOldMinValue); roundsCalc = Math.round((dmxMaxValue - dmxMinValue)/(updateValueSkip + 1)); roundValue = 1 + updateValueSkip; rounds = Math.abs(roundsCalc); r = 0; return runArtnet(); }; var runArtnet = function() { setTimeout( function() { artnetStep(); r++; if (stopExecution) { return closeArtnet(); } if (r <= rounds + 1) { return runArtnet(); } if (r > rounds) { return closeArtnet(); } },(1000/updatesPerSecond)); }; function artnetStep() { for (i = 0; i < '513'; i++) { if (i > 0 && dmxNew != 'null') { if (dmx[i] < dmxNew[i]) { if (dmx[i] + roundValue > 255) { dmx[i] = 255; } else if (dmx[i] == dmxNew[i]) { dmx[i] = dmxNew[i]; //} else if (dmx[i] == 'null') { //dmx[i] = 1 + roundValue; } else { dmx[i] = dmx[i] + roundValue; } } if (dmx[i] > dmxNew[i]) { if (dmx[i] - roundValue <= 0) { dmx[i] = 0; //} else if (dmx[i] == dmxNew[i] || dmx[i] == 'null') { } else if (dmx[i] == dmxNew[i]) { dmx[i] = dmxNew[i]; } else { dmx[i] = dmx[i] - roundValue; } } } } return artnet.set(universe, 1 , dmx.slice(1)); } var closeArtnet = function() { artnet.close(); isRunning = 0; return; }; initialize();
aus folgendem Thread: https://forum.iobroker.net/topic/3575/art-net/114
Leider erhalte ich diese Fehlermeldungen im LOG, sobald ich das Script starte:
javascript.0 2021-01-07 11:00:53.200 warn (4588) This object will not be created in future versions. Please report this to the developer. javascript.0 2021-01-07 11:00:53.200 warn (4588) Object javascript.0.artnet.universe0.DMX_Channel_512 is invalid: obj.common.type has an invalid value (int) but has to be one of number, string, boolean, array, object, mixed, file, json javascript.0 2021-01-07 11:00:53.200 warn (4588) This object will not be created in future versions. Please report this to the developer. javascript.0 2021-01-07 11:00:53.200 warn (4588) Object javascript.0.artnet.universe0.DMX_Channel_511 is invalid: obj.common.type has an invalid value (int) but has to be one of number, string, boolean, array, object, mixed, file, json javascript.0 2021-01-07 11:00:53.200 warn (4588) This object will not be created in future versions. Please report this to the developer. javascript.0 2021-01-07 11:00:53.200 warn (4588) Object javascript.0.artnet.universe0.DMX_Channel_510 is invalid: obj.common.type has an invalid value (int) but has to be one of number, string, boolean, array, object, mixed, file, json javascript.0 2021-01-07 11:00:53.200 warn (4588) This object will not be created in future versions. Please report this to the developer. javascript.0 2021-01-07 11:00:53.200 warn (4588) Object javascript.0.artnet.universe0.DMX_Channel_509 is invalid: obj.common.type has an invalid value (int) but has to be one of number, string, boolean, array, object, mixed, file, json javascript.0 2021-01-07 11:00:53.200 warn (4588) This object will not be created in future versions. Please report this to the developer. javascript.0 2021-01-07 11:00:53.200 warn (4588) Object javascript.0.artnet.universe0.DMX_Channel_508 is invalid: obj.common.type has an invalid value (int) but has to be one of number, string, boolean, array, object, mixed, file, json javascript.0 2021-01-07 11:00:53.200 warn (4588) This object will not be created in future versions. Please report this to the developer. javascript.0 2021-01-07 11:00:53.200 warn (4588) Object javascript.0.artnet.universe0.DMX_Channel_507 is invalid: obj.common.type has an invalid value (int) but has to be one of number, string, boolean, array, object, mixed, file, json javascript.0 2021-01-07 11:00:53.200 warn (4588) This object will not be created in future versions. Please report this to the developer. javascript.0 2021-01-07 11:00:53.200 warn (4588) Object javascript.0.artnet.universe0.DMX_Channel_506 is invalid: obj.common.type has an invalid value (int) but has to be one of number, string, boolean, array, object, mixed, file, json javascript.0 2021-01-07 11:00:53.200 warn (4588) This object will not be created in future versions. Please report this to the developer. javascript.0 2021-01-07 11:00:53.200 warn (4588) Object javascript.0.artnet.universe0.DMX_Channel_505 is invalid: obj.common.type has an invalid value (int) but has to be one of number, string, boolean, array, object, mixed, file, json javascript.0 2021-01-07 11:00:53.200 warn (4588) This object will not be created in future versions. Please report this to the developer. javascript.0 2021-01-07 11:00:53.200 warn (4588) Object javascript.0.artnet.universe0.DMX_Channel_504 is invalid: obj.common.type has an invalid value (int) but has to be one of number, string, boolean, array, object, mixed, file, json javascript.0 2021-01-07 11:00:53.200 warn (4588) This object will not be created in future versions. Please report this to the developer. javascript.0 2021-01-07 11:00:53.200 warn (4588) Object javascript.0.artnet.universe0.DMX_Channel_503 is invalid: obj.common.type has an invalid value (int) but has to be one of number, string, boolean, array, object, mixed, file, json javascript.0 2021-01-07 11:00:53.200 warn (4588) This object will not be created in future versions. Please report this to the developer. javascript.0 2021-01-07 11:00:53.200 warn (4588) Object javascript.0.artnet.universe0.DMX_Channel_502 is invalid: obj.common.type has an invalid value (int) but has to be one of number, string, boolean, array, object, mixed, file, json javascript.0 2021-01-07 11:00:53.200 warn (4588) This object will not be created in future versions. Please report this to the developer. javascript.0 2021-01-07 11:00:53.200 warn (4588) Object javascript.0.artnet.universe0.DMX_Channel_501 is invalid: obj.common.type has an invalid value (int) but has to be one of number, string, boolean, array, object, mixed, file, json javascript.0 2021-01-07 11:00:53.200 warn (4588) This object will not be created in future versions. Please report this to the developer. javascript.0 2021-01-07 11:00:53.200 warn (4588) Object javascript.0.artnet.universe0.DMX_Channel_500 is invalid: obj.common.type has an invalid value (int) but has to be one of number, string, boolean, array, object, mixed, file, json javascript.0 2021-01-07 11:00:53.200 warn (4588) This object will not be created in future versions. Please report this to the developer.
Kann mir jemand sagen wo das Problem liegt bzw. helfen das Script zum Laufen zu bringen?
Danke.
Beste Grüße
-
@Qlink
Ändere Zeilen 49, 50 in:type: 'number', role: 'level',
-
Vielen Dank für die Hilfe. Jetzt läuft das Script wieder sauber ohne Fehlermeldung durch
Beste Grüße
-
Das Script funktioniert dank deiner Hilfe jetzt wie es soll und ich kann für jeden Farbkanal einen Wert von 0-255 vergeben.
Was allerdings noch fehlt ist die Möglichkeit für z.B. die Kanäle 1-4, oder 5-8 (RGBW) einen Hex Wert angeben zu können, damit man Mischfarben darstellen kann bzw. mit Colorpicker Widgets, welche nahezu alle die Eingabe eines Hexwerts brauchen eine beliebige Farbe direkt anwählen zu können.Es müsste also folgende Möglichkeiten im Script geben:
- Kanalgruppen angeben z.B. 1-4 oder 9-12 je nachdem ob RGBW oder RGB
- für diese Kanalgruppen müsste dann ein zusätzlicher Datenpunkt angelegt werden, welcher dann die einzelnen RGB(W) Werte in einen Hexwert umrechnet und vice versa, also ein eingebauter Konverter wie z.B. hier https://ncalculators.com/digital-computation/rgb-to-hex-converter.htm
Ähnlich wie beim artnet Adapter... der funktioniert allerdings leider nicht so gut, stabil und flüssig wie das Script
Leider ist der Macher des Scripts seit mehreren Jahren im Forum nicht mehr aktiv.
Lässt sich diese Funktionalität im Script entsprechend erweitern und falls ja, könntest du das eventuell machen ?
Beste Grüße