I’am wondering if it is possible to pass an additional parameter to a JS transform.
I have the following items:
Switch TL300A00A01 "Generalbefehl [%s]" { http="<[AC40CacheRaw:30000:JS(AC40_TL300A00A01_GetVal.js)] >[ON:POST:http://192.168.1.200/cgi-fga/fga/fgacmd/TL300A00A01?pw=0123456789&nv=ON1] >[OFF:POST:http://192.168.1.200/cgi-fga/fga/fgacmd/TL300A00A01?pw=0123456789&nv=OFF]"}
Switch TL300A00A02 "Sommerbetrieb [%s]" { http="<[AC40CacheRaw:30000:JS(AC40_TL300A00A02_GetVal.js)] >[ON:POST:http://192.168.1.200/cgi-fga/fga/fgacmd/TL300A00A02?pw=0123456789&nv=ON1] >[OFF:POST:http://192.168.1.200/cgi-fga/fga/fgacmd/TL300A00A02?pw=0123456789&nv=OFF]"}
For each item I need now one specialized javascript
(function(i) {
var re = new RegExp('TL300A00A01.*blank.[>](.*)[<]');
var out = i.match(re)[1];
var ret;
if (out.trim() == "EIN1") {
ret = 'ON';
} else {
ret = 'OFF';
}
return ret;
})(input)
Where I just have to change the string “TL300A00A01”, which luckily corresponds to my itemname.
Is there a possiblity to pass:
- Additionaly to the AC40CacheRaw also the itemname
or - Additionaly to the AC40CacheRaw also a string
If yes, what would the syntax in the item-file and javascript be?