Skip to content

Commit

Permalink
minors on provisioning + pressures attribute in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
walterwootz committed Feb 16, 2024
1 parent 0825b8b commit 18b6da7
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
10 changes: 10 additions & 0 deletions conf/config-ld.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ config.iota = {
{
name: 'Engine_Oxigen',
type: 'Number'
},
{
name: 'Engine_Pressures',
type: 'Text'
}
],
lazy: [
Expand Down Expand Up @@ -247,6 +251,12 @@ config.iota = {
opcua_id: 'ns=3;s=Oxigen',
object_id: 'ns=3;s=Oxigen',
inputArguments: []
},
{
ocb_id: 'Engine_Pressures',
opcua_id: 'ns=3;s=Pressures',
object_id: 'ns=3;s=Pressures',
inputArguments: []
}
]
}
Expand Down
10 changes: 10 additions & 0 deletions conf/config-v2.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ config.iota = {
{
name: 'Engine_Oxigen',
type: 'Number'
},
{
name: 'Engine_Pressures',
type: 'Text'
}
],
lazy: [
Expand Down Expand Up @@ -247,6 +251,12 @@ config.iota = {
opcua_id: 'ns=3;s=Oxigen',
object_id: 'ns=3;s=Oxigen',
inputArguments: []
},
{
ocb_id: 'Engine_Pressures',
opcua_id: 'ns=3;s=Pressures',
object_id: 'ns=3;s=Pressures',
inputArguments: []
}
]
}
Expand Down
6 changes: 4 additions & 2 deletions lib/commonBindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,13 @@ function manageConfigurationRequest(apiKey, deviceId, device, objMessage) {
function singleMeasure(apiKey, deviceId, attribute, device, parsedMessage) {
config.getLogger().debug(context, 'Processing single measure for device [%s] with apiKey [%s]', deviceId, apiKey);

const messageType = guessType(attribute, device);

const values = [
{
name: attribute,
type: guessType(attribute, device),
value: parsedMessage[0]
type: messageType,
value: messageType === constants.OPCUA_NGSI_BINDING_STRING ? JSON.stringify(parsedMessage) : parsedMessage[0]
}
];
config.getLogger().debug(context, 'values updates [%s]', JSON.stringify(values));
Expand Down
4 changes: 2 additions & 2 deletions lib/metaBindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function createGroup() {
}
]
};
const q = url.parse(config.getConfig().iota.providerUrl, true);
const q = url.parse(`http://localhost:${config.getConfig().iota.server.port}`, true);
const options = {
host: q.hostname,
port: q.port,
Expand Down Expand Up @@ -96,7 +96,7 @@ function createDevices() {
const body = {
devices
};
const q = url.parse(config.getConfig().iota.providerUrl, true);
const q = url.parse(`http://localhost:${config.getConfig().iota.server.port}`, true);
const options = {
host: q.hostname,
port: q.port,
Expand Down

0 comments on commit 18b6da7

Please sign in to comment.