Closed JefersonBigheti closed 1 year ago
Hi, thank you for your appreciation. we have the feature planned but our resources are currently limited.
there is a functionality to configure via a environment variable DEVICES the webapi get to read tag properties and post to write values
The post method or a webhook-like method can make a lot of work easier. I will eagerly await this.
I'm having trouble implementing it. Would you have an example of how to implement post using your suggestion "environment variable DEVICES"
node main.js --env=test
The tags must be in an array (flat structure) as you can see in the following example
var tags = [
{
id: 'tempA', // UUID
name: 'tempA',
value: 0,
type: 'number' // number|boolean|string,`
},
{
id: 'tempB', // UUID
name: 'tempB',
value: 0,
type: 'number' // number|boolean|string,`
}
]
apiApp.get('/api/tags', function (req, res) {
res.json(tags);
});
apiApp.post('/api/tags', function (req, res) {
if (req.body && Array.isArray(req.body)) {
for(let i = 0; i < req.body.length; i++) {
for (let y = 0; y < tags.length; y++) {
if (req.body[i].id === tags[y].id) {
tags[y].value = parseFloat(req.body[i].value);
y = tags.length;
}
}
}
}
res.end();
});
The example shown worked very well. Thanks a lot for the help!
Hi actually I have a opcua client running in fuxa. From a standalone opcua server I am able to get the opcua variables in fuxa. Now these opcua variables I want to expose to the application layer (upper layer) so that the application can read write the opcua variables. can you kindly guide me how to do that ?
@RajatDas2020 Hi, I will use mqtt, install a broker (mosquitto) and export the opcua values
Hi @unocelli I am trying to use this application but seems like the WebAPI properties only works on GET ?
Am I missing something here? or the Post method already removed?
First of all congratulations for the excellent project. I would like to know if there is a possibility to include the "post" method in the webapi plugin.