Before I will try my luck of implementing this into a node, I’d like to get the library itself running inside node red as a function.
It is possible to install the „tame“ library via npm (npm install tame4), which I did.
Then I added this to the settings.js:
functionGlobalContext: {
tamecon:require('ta...@4.3.0')
},In the help file of the tame library there is an example constructor for instancing the web service client:
var PLC = TAME.WebServiceClient.createClient({
serviceURL: "http://192.168.1.2/TcAdsWebService/TcAdsWebService.dll", configFileUrl: '' http://192.168.1.2/myproject.tpy'',
onReady: function() {
//Put your stuff here }
});
trying something like this in a function in red node didn’t yield any results:
var PLC = context.global.tamecon();
PLC.WebServiceClient.createClient({
serviceURL: "http://192.168.1.2/TcAdsWebService/TcAdsWebService.dll", amsNetId: "192.168.1.2.1.1",
onReady: function() {}
});
return msg;
I receive:
TypeError: context.global.tamecon is not a function
Could someone please point me in the right direction? I really would like to get this running and pick up all I need in the process…
It’s my missing link to use this great software and all it’s possibilities for my house…
Thanks!
Martin
/**
* Wrapper for console messages.
*
* @param {Mixed} message The message to be logged.
*/
function log(message) {
try {
window.console.log(message);
} catch (e) {
//fallback
alert(message);
}
}
//Log version
log('TAME library version: ' + TAME.version);