Giter VIP home page Giter VIP logo

mindsphere / node-red-contrib-mindconnect Goto Github PK

View Code? Open in Web Editor NEW
47.0 12.0 1.0 10.41 MB

Node-RED Agent for the MindConnect API (community driven project)

Home Page: https://opensource.mindsphere.io/docs/node-red-contrib-mindconnect/index.html

License: MIT License

HTML 48.66% TypeScript 49.83% CSS 1.29% Dockerfile 0.22%
mindconnect nodejs node-red node-red-contrib siemens insights-hub siemens-xcelerator industrial-iot

node-red-contrib-mindconnect's Introduction

node-red-contrib-mindconnect

Node-RED Agent for the MindConnect API

@mindconnect/node-red-contrib-mindconnect

This node enables the Node-RED users to upload timeseries, files and events to MindSphere. This project has started as a community effort at Siemens AG and is now available for general use.

Build The MIT License npm downloads Documentation Forum Demo Flows

The node is written in typescript/javascript without any native dependencies so it should work beside x86 also on other platforms (e.g. on raspberry pi, IoT2000 etc, you just have to have Node-RED installed).

Installing the node

# change to your ~./node-red/ folder
cd ~/.node-red/
npm install @mindconnect/node-red-contrib-mindconnect

Node-RED - Manage Palette Installation

You can install the node also via the Manage palette feature in the Node-RED administration UI.

palette

FAQ

  • install to the .node-red folder if you have installed node-red globally
  • install to the userDir directory if you have custom userDir
  • make sure that your nodejs version is relatively current

How to use the Node-RED node

Since version 3.9.0 it is possible to completely configure the agent from Node-RED. You will only need the initial Boarding configuration from the MindSphere UI.

Step 0: Create (at least) one asset and one agent in MindSphere

  • Create an asset in Asset Manager for your data
  • Create an agent of the type MindConnectLib [core.mclib] and store the agent.

Step 1: Get the initial agent configuration from Mindsphere Asset Manager

You can choose between:

  • RSA_3072 public/private key pair (3072bit) for enhanced security which requires more computing power on the devices and
  • SHARED_SECRET shared key (256bit) for lightweight devices.

If you want to use RSA_3072 you will have to create a 3072bit key for your device, eg. with openssl:

openssl genrsa -out private.key 3072

There is no additional configuration required for SHARED_SECRET security profile.

boarding configuration

Step 2: Copy the agent onboarding information (and if necessary the RSA 3072 private key) to the node and deploy the flow

Copy the agent onboarding information and optionally the RSA_3072 private key to the node and deploy the flow.

implementation

Step 3: Press the agent configuration button and select the target asset

The most common agent configuration setup is to have a 1:1 mapping between the Node-RED agent which is delivering the data and your target MindSphere Asset. If this type of configuration is sufficient for your use case you just have to click on the asset to which you want to map the data in the asset list. (you can use the filter asset listbox to quickly find your asset)

implementation

The node will automatically configure all necessary data sources and mapping for you. If you need a more complex setup, just click on the MindSphere Configuration Dialog button which will lead you to the configuration dialog in the MindSphere, where you can create more complex configurations and mappings.

implementation

Step 4: Create and deploy the flow and send data

You can use the node to send timeseries, bulk timeseries, events and files to MindSphere. The templates for the input messages are listed below, but you can also just use the Agent Information button which will let you copy the corresponding template to clipboard.

implementation

Send data points

The node requires json objects as input in following format (e.g. from a function node)

const values = [
    { dataPointId: "1000000000", qualityCode: "1", value: "42" },
    { dataPointId: "1000000001", qualityCode: "1", value: "33.7" },
    { dataPointId: "1000000003", qualityCode: "1", value: "45.76" }
];

msg._time = new Date();
msg.payload = values;
return msg;

The node will validate if the data is valid for your agent configuration. his feature can be switched off in the settings but it is not recommended to do so.

Send data points in bulk

The node requires json objects as input in following format (e.g. from a function node if you want to use bulk upload)

const values = [
    {
        timestamp: "2018-11-09T07:46:36.699Z",
        values: [
            { dataPointId: "1000000000", qualityCode: "1", value: "42" },
            { dataPointId: "1000000001", qualityCode: "1", value: "33.7" },
            { dataPointId: "1000000003", qualityCode: "1", value: "45.76" }
        ]
    },
    {
        timestamp: "2018-11-08T07:46:36.699Z",
        values: [
            { dataPointId: "1000000000", qualityCode: "1", value: "12" },
            { dataPointId: "1000000001", qualityCode: "1", value: "13.7" },
            { dataPointId: "1000000003", qualityCode: "1", value: "15.76" }
        ]
    }
];

msg.payload = values;
return msg;

Note: All MindSphere timestamps must be in the ISO format (use toISOString() function).

Send events

The node requires json objects as input in following format (e.g. from a function node). You can send an event to any asset you have access to in your tenant. Just use the asset id in the entityid.

msg.payload = {
    entityId: "d72262e71ea0470eb9f880176b888938", // optional, use assetid if you want to send event somewhere else :)
    sourceType: "Agent",
    sourceId: "application",
    source: "Meowz",
    severity: 30, // 0-99 : 20:error, 30:warning, 40: information
    description: "Event sent at " + new Date().toISOString(),
    timestamp: new Date().toISOString(),
    additionalproperty1: "123",
    additionalproperty2: "456"
};
return msg;

If you are using the custom events instead of MindSphere Standard Events please include the following switch in the message.

msg._customEvent=true;

File Upload

The node requires json objects as input in following format (e.g. from a function node). You can upload file to any asset you have access to in your tenant. Just use the asset id in the entityid.

msg.payload = {
    entityId: "d72262e71ea0470eb9f880176b888938", //optional (per default files are uploaded to the agent)
    fileName: "digitaltwin.png", // you can also pass an instance of a Buffer
    fileType: "image/png", //optional, it is automatically determined if there is no fileType specified
    filePath: "images/digitaltwin.png", // required if you are using buffer instead of the file name
    description: "testfile"
};
return msg;

If the experimental chunking feature is on, the files which are larger than 8MB will be uploaded in 8 MB Chunks.

Data Lake File Upload

Precondition for data lake upload is that MindSphere Integrated Data Lake is purchased and write-enabled. The node requires json objects as input in following format (e.g. from a function node).

// take a look at the flow examples at https://playground.mindconnect.rocks 
//
// Preconditions : data-lake is purchased and enabled for writing (see mc data-lake --mode write  CLI command)
//
// Agents can only upload files to a path which is prefixed with their agent id
// The MindConnect Node will apply this prefix automatically to the dataLakeFileUpload Path
// You can pass either a javascript buffer or path to file in the dataLakeFile property for upload
// The subTenantId can be optionally added to the messsage

const dataLakeFileInfo = {
  "dataLakeFile": "my/path/to/file.txt",
  "dataLakeFilePath": "uploads/file.txt"
};

// Uncomment the next code line if you just want to generate an upload url (in msg._signedUrl) 
// without actually uploading the file
// msg._ignorePayload = true;

msg.payload = dataLakeFileInfo;
return msg;

Please note:

  • Agents can only upload files to a path which is prefixed with their agent id
  • The MindConnect Node will apply this prefix automatically to the dataLakeFileUpload Path
  • You can pass either a javascript buffer or path to file in the dataLakeFile property for upload
  • The subTenantId can be optionally added to the messsage

Reading Asset Information

You can read the data (e.g. static asset variables, or full asset information) from MindSphere using the following message. This can be used to implement a "digital shadow/digital twin" pattern, where the change in the MindSphere variables is reflected to the real world asset. See bidirectional communication example flow on playground for a full example.

msg.payload = {
  "assetId": "{assetId}",
  "includeShared": false,
  "propertyNames": []
};

return msg;

You can reduce the number of items in payload by specifying list of properties to include in the message: e.g. propertyNames: ["variables"] or ["location"]

Executing custom functions using MindSphere javascript/typescript SDK

The node can be used to execute a complex script which uses MindSphere javascript/typescript SDK. The node will create an asyncronous function with one parameter (sdk) and the specified function body and execute it. You can only call the MindSphere APIs which allow agent authorization.

msg.payload = {
    function: `
const assetManagement = sdk.GetAssetManagementClient();
const asset = await assetManagement.GetAsset('{assetId}');
return asset;
`};
           
return msg;

Error handling in the flows

The node can be configured to retry all mindsphere operations (1-10 times, with delay of time * 300ms before the next try) If you need more complex flows, the node also returns the

msg._mindsphereStatus; // OK on success othervise error
msg._error; // The timestamped error message

properties which can be used to create more complex flows. (e.g. in the flow below, the unrecoverable errors are written in error.log file and the failed data is stored in backupdata.log file)

errorhandling

JWT Token Generation for SouthBound APIs

The node can be used to generate authentication tokens which you can use to call your own custom southbound APIs. The msg.headers will have a Mindsphere Authorization JWT.

msg._includeMindSphereToken=true;

if you just want to get the token without sending any data to MindSphere

msg._ignorePayload=true;

Treat tokens as you would any other credentials.

Control Topic and Status Messages

The version 3.11.0 introduces two new features - the status message which is displayed on the node (and/or emited on the control topic dependent on the Emit Control topic) after either:

  • the maximal number of parallel requests (Async Requests) has been exceeded or
  • the maximal wait time (Async Duration) has been reached.

The following image illustrates the function of the new settings:

image

The payload on the control topic with the status information looks like this:

{
    requests: number;
    success: number;
    pending: number;
    errors: number;
}

This information can be used to manage for example a queue node before the mindconnect node to regulate the flow of the messages. See example #HighDataVolume on https://playground.mindconnect.rocks

Demo flows

Demo Flows

MindConnect Node-RED playground provides following demo flows importing following data points to MindSphere

  • CPU-Usage
  • Batched MQTT Data
  • OPC-UA Data
  • Real Weather Data to MindSphere
  • Simulated Water Pump Data
  • Custom SouthBound API Calls

The simulated water pump data can be inspected at

https://dreamforce.mindconnect.rocks

This application can be used without mindsphere credentials.

This data is also used as an example for the KPI-Calculation and Trend prediction with help of MindSphere APIs. https://github.com/mindsphere/analytics-examples

Securing API Endpoints

The corresponding API calls for reading the data source configuration and mappings in Agent Configuration and Agent Information dialog require that the user has:

mindconnect.read

permission. The automatic configuration requires

mindconnect.write

permission.

Troubleshooting

If you have problems with your agent:

  1. Stop the agent.
  2. Move or delete the content of the .mc folder (the json files with configuration and authentication settings).
  3. Offboard the agent.
  4. Create new settings for the mindconnect library.
  5. copy the new settings to the node.

Reseting the agent settings from version 3.7.0

Since version 3.7.0. it is possible to delete the content of the .mc/agentconfig.json file and the agent settings directly from the node.

Press on the "delete local configuration" :wastebucket: button on the node, confirm the dialog and redeploy the node.

delete local settings

If you are having problems, it is a good idea to restart the Node-RED runtime completely.

Diagnostic in MindSphere

If the data is not arriving in your configured asset you should take a look if the data is beeing dropped in MindSphere because of a misconfiguration. The agent diagnostic button will lead you directly to the agent diagnostic application in the MindSphere.

diagnostic

Generating the documentation

You can always generate the current HTML documentation by running the command below.

#this generates a docs/ folder the with full documentation of the library.
npm run doc

Proxy support

Set the http_proxy or HTTP_PROXY environment variable if you need to connect via proxy.

# set http proxy environment variable if you are using e.g. fiddler on the localhost.

export HTTP_PROXY=http://localhost:8888

How to setup development environment

# create a directory ../devnodes
cd ..
mkdir devnodes
cd devnodes
# this registers your development directory with node red
npm link ../node-red-contrib-mindconnect

# after that in you can start developing with
cd ../node-red-contrib-mindconnect

npm run start-dev

# your node red flows will be stored in the ../devnodes directory

Legal

This project has been released under an Open Source license. The release may include and/or use APIs to Siemens’ or third parties’ products or services. In no event shall the project’s Open Source license grant any rights in or to these APIs, products or services that would alter, expand, be inconsistent with, or supersede any terms of separate license agreements applicable to those APIs. “API” means application programming interfaces and their specifications and implementing code that allows other software to communicate with or call on Siemens’ or third parties’ products or services and may be made available through Siemens’ or third parties’ products, documentations or otherwise.

node-red-contrib-mindconnect's People

Contributors

dependabot[bot] avatar goko avatar greenkeeper[bot] avatar imgbot[bot] avatar imgbotapp avatar mindsphere-bot avatar sn0wcat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

lgtm-migrator

node-red-contrib-mindconnect's Issues

An in-range update of node-red is breaking the build 🚨

The devDependency node-red was updated from 0.20.5 to 0.20.6.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

node-red is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/jenkins/branch: This commit cannot be built (Details).

Release Notes for 0.20.6: Maintenance Release
  • Revealing node position needs to account for zoom level Fixes #2172
  • stop join tripping up if last message of buffer is blank.
  • Improve handling of file upload in request node
  • Handle subflow internal node wired to a non-existant node Fixes #2202
  • Do not save subflow env vars with blank names
  • Don't allow a link node virtual wire to connect to normal port
  • Clear HTTP Request node authType when auth disabled Fixes #2215
  • Fix parsing of content-type header Fixes #2216
  • Fix join node reset issue with merging objects
  • Copy data-i18n attribute on TypedInput Fixes #2211
FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

WS-2019-0043 (Medium) detected in dot-1.1.2.tgz

WS-2019-0043 - Medium Severity Vulnerability

Vulnerable Library - dot-1.1.2.tgz

Concise and fast javascript templating compatible with nodejs and other javascript environments

Library home page: https://registry.npmjs.org/dot/-/dot-1.1.2.tgz

Path to dependency file: /node-red-contrib-mindconnect/package.json

Path to vulnerable library: /tmp/git/node-red-contrib-mindconnect/node_modules/dot/package.json

Dependency Hierarchy:

  • compodoc-1.1.9.tgz (Root Library)
    • ngd-transformer-2.0.0.tgz
      • dot-1.1.2.tgz (Vulnerable Library)

Found in HEAD commit: 85b02ec7a66d7230ed9a124637a0b257964a7168

Vulnerability Details

All versions of dot are vulnerable to Command Injection. The template compilation may execute arbitrary commands if an attacker can inject code in the template or if a Prototype Pollution-like vulnerability can be exploited to alter an Object's prototype.

Publish Date: 2019-04-05

URL: WS-2019-0043

CVSS 2 Score Details (5.0)

Base Score Metrics not available


Step up your Open Source Security Game with WhiteSource here

An in-range update of @types/node-fetch is breaking the build 🚨

The devDependency @types/node-fetch was updated from 2.5.2 to 2.5.3.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/node-fetch is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/jenkins/branch: This commit cannot be built (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of mocha is breaking the build 🚨

The devDependency mocha was updated from 6.2.1 to 6.2.2.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

mocha is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/jenkins/branch: This commit cannot be built (Details).

Release Notes for v6.2.2

6.2.2 / 2019-10-18

🐛 Fixes

📖 Documentation

Commits

The new version differs by 12 commits.

  • 843a322 6.2.2
  • aec8b02 update CHANGELOG for v6.2.2 [ci skip]
  • 7a8b95a npm audit fixes
  • cebddf2 Improve reporter documentation for mocha in browser. (#4026)
  • 3f7b987 uncaughtException: report more than one exception per test (#4033)
  • ee82d38 modify alt text of image from Backers to Sponsors inside Sponsors section in Readme (#4046)
  • e9c036c special-case parsing of "require" in unparseNodeArgs(); closes #4035 (#4063)
  • 954cf0b Fix HTMLCollection iteration to make unhide function work as expected (#4051)
  • 816dc27 uncaughtException: fix double EVENT_RUN_END events (#4025)
  • 9650d3f add OpenJS Foundation logo to website (#4008)
  • f04b81d Adopt the OpenJSF Code of Conduct (#3971)
  • aca8895 Add link checking to docs build step (#3972)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

WS-2019-0063 (High) detected in multiple libraries

WS-2019-0063 - High Severity Vulnerability

Vulnerable Libraries - js-yaml-3.13.0.tgz, js-yaml-3.12.2.tgz, js-yaml-3.12.0.tgz

js-yaml-3.13.0.tgz

YAML 1.2 parser and serializer

Library home page: https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.0.tgz

Path to dependency file: /node-red-contrib-mindconnect/package.json

Path to vulnerable library: /tmp/git/node-red-contrib-mindconnect/node_modules/js-yaml/package.json

Dependency Hierarchy:

  • tslint-5.13.1.tgz (Root Library)
    • js-yaml-3.13.0.tgz (Vulnerable Library)
js-yaml-3.12.2.tgz

YAML 1.2 parser and serializer

Library home page: https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.2.tgz

Path to dependency file: /node-red-contrib-mindconnect/package.json

Path to vulnerable library: /tmp/git/node-red-contrib-mindconnect/node_modules/@node-red/nodes/node_modules/js-yaml/package.json

Dependency Hierarchy:

  • node-red-0.20.3.tgz (Root Library)
    • nodes-0.20.3.tgz
      • js-yaml-3.12.2.tgz (Vulnerable Library)
js-yaml-3.12.0.tgz

YAML 1.2 parser and serializer

Library home page: https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz

Path to dependency file: /node-red-contrib-mindconnect/package.json

Path to vulnerable library: /tmp/git/node-red-contrib-mindconnect/node_modules/mocha/node_modules/js-yaml/package.json

Dependency Hierarchy:

  • mocha-6.0.2.tgz (Root Library)
    • js-yaml-3.12.0.tgz (Vulnerable Library)

Vulnerability Details

Js-yaml prior to 3.13.1 are vulnerable to Code Injection. The load() function may execute arbitrary code injected through a malicious YAML file.

Publish Date: 2019-04-30

URL: WS-2019-0063

CVSS 2 Score Details (8.0)

Base Score Metrics not available

Suggested Fix

Type: Upgrade version

Origin: https://www.npmjs.com/advisories/813

Release Date: 2019-04-30

Fix Resolution: 3.13.1


Step up your Open Source Security Game with WhiteSource here

Error occurred during keep alive

Describe the bug
After a short time from on-boarding the MCnodes stop working giving the following message

"Error occurred during keep alive Error the device was not on-boarded or the response was deleted."

Same for SharedSecret and RSA_3072 tokens.

Oddly this only happens with newly on-boarded nodes as my older flows are still working.

To Reproduce
Steps to reproduce the behavior:
On board a new device and keep it pushing data for more than and hour.

This issue can be seen on the mindconnect playground as well. Specifically (WaterPump-EnvData)

https://playground.mindconnect.rocks/

Expected behavior
Expecting to push data to MindSphere

Screenshots
If applicable, add screenshots to help explain your problem.

An in-range update of @mindconnect/mindconnect-nodejs is breaking the build 🚨

The dependency @mindconnect/mindconnect-nodejs was updated from 3.6.1 to 3.7.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@mindconnect/mindconnect-nodejs is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • continuous-integration/jenkins/branch: This commit cannot be built (Details).

Release Notes for 3.7.0 - (Boysenberry Vienna) - February 2020
  • CLI: mc kpi-calculation command (calculate kpis and kpi states based on signal values)
  • CLI: mc trend-prediction command (perform linear and polynomial trend prediction on mindsphere aspects)
  • CLI: mc bulk-download command (download timeseries aspects from mindsphere)
  • CLI: mc delete-file command
  • CLI: mc delete-asset command
  • CLI: mc agent-token and mc service-token command print out the full token (including header in signature) in --verbose mode
  • SDK: Token rotation for agent credentials (#99)
  • SDK: added TrendPredictionClient to the SDK
  • SDK: added KPICalcuationClient to the SDK
  • AGENT: TryRecovery: new method which will try to recover from the sporadic errors which can happen when there is internet connection problem during key rotation.
  • Bumped all dependencies
  • Chore: Improved spelling
  • Upgraded https-proxy-agent to fix https://snyk.io/vuln/SNYK-JS-HTTPSPROXYAGENT-469131
  • Added stale issues bot watcher to github
FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @compodoc/compodoc is breaking the build 🚨

The devDependency @compodoc/compodoc was updated from 1.1.10 to 1.1.11.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@compodoc/compodoc is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/jenkins/branch: This commit cannot be built (Details).

Release Notes for 1.1.11

Features

Bug fixes

Commits

The new version differs by 110 commits.

  • 93f99c3 Finish 1.1.11
  • cfb798f Finish 1.1.11
  • 647fb3e 1.1.11
  • 22ea84e fix(app): refactoring npm ignore
  • 45ca8fa fix(app): refactoring / tsconfig file use-case
  • 2bbd4e6 fix(app): missing code in files for TSC
  • 7e1fa73 fix(app): refactoring tested with namespacing + serve use-case
  • d339d40 Update FUNDING.yml
  • abcaffb feat(github): stale bot config
  • 2eaf83c feat(github): lock bot config
  • 522d8e7 feat(app): bump dependencies, remove jest
  • 1788267 fix(app): refactoring tested with mocha
  • 36ee639 fix(app): refactoring code with TS errors
  • 848b025 feat(app): tslint to eslint
  • ae8b882 fix(app): refactoring

There are 110 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

WS-2019-0064 (High) detected in handlebars-4.1.0.tgz

WS-2019-0064 - High Severity Vulnerability

Vulnerable Library - handlebars-4.1.0.tgz

Handlebars provides the power necessary to let you build semantic templates effectively with no frustration

Library home page: https://registry.npmjs.org/handlebars/-/handlebars-4.1.0.tgz

Path to dependency file: /node-red-contrib-mindconnect/package.json

Path to vulnerable library: /tmp/git/node-red-contrib-mindconnect/node_modules/nyc/node_modules/handlebars/package.json

Dependency Hierarchy:

  • typedoc-0.14.2.tgz (Root Library)
    • handlebars-4.1.0.tgz (Vulnerable Library)

Vulnerability Details

Versions of handlebars prior to 4.0.14 are vulnerable to Prototype Pollution. Templates may alter an Objects' prototype, thus allowing an attacker to execute arbitrary code on the server.

Publish Date: 2019-04-30

URL: WS-2019-0064

CVSS 2 Score Details (8.0)

Base Score Metrics not available

Suggested Fix

Type: Upgrade version

Origin: https://www.npmjs.com/advisories/755/versions

Release Date: 2019-04-30

Fix Resolution: 1.0.6-2,4.0.14,4.1.2


Step up your Open Source Security Game with WhiteSource here

Not able to check "msg._mindsphereStatus" in version 3.9+

Dear Support,

As described in the main guide of this not, in order to check the upload status of my datapoints, i have an switch node to check if the attribute "msg._mindsphereStatus" is getting an "OK" or not "OK" value, in order to feed the offline buffer flow we designed if it doesn't uploaded right. (Mention to issue #20 )
This used to work fine for buffering the packages that either didn't upload consequence of instable internet connection, but also for making more stable the upload rate (for some reason, some packages didn't upload right, maybe because of saturation) catching the one that didn't uplaod right.
This is the logic: (If you have any suggestions to make it better, we are open to improve it and share it with the community)
image

The problem is, now that we downloaded the (almost?) lastest version of this node, we are not able to check the mentioned "msg._mindsphereStatus" attribute to either finish the execution of the succesful uploads, or feed the buffering flow when we are offline.
image

Mindconnect Node configuration:
image
image

Description of error:
If we disconnect the device from internet (disconnect cable) in which this Flow is running, we are accumulating a lot of request in the MindConnect Node, instead of "failing the upload", setting an "Not OK" state for every failed json and feeding the offline buffer flow.
image

Is the node already buffering on its own? If so, i tried it out and its not able to handle hours of buffering (in my test case, i can try again if you say so)
If not, why isn't the node outputting every package with the attribute "msg._mindsphereStatus = Error" as it used to do?

Thank you

An in-range update of @types/chai is breaking the build 🚨

The devDependency @types/chai was updated from 4.2.3 to 4.2.4.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/chai is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/jenkins/branch: This commit cannot be built (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Bulk upload not posting data - MC node says successful

The bug
When posting dynamic data using the bulk upload format, the MindConnect node returns "Posted last bulk message at {{current_time}}", however the data is not visible on MindSphere. Using APIs to query the respective asset I am returned "[]" which indicates no data was posted.
The original occurence came about as I was grabbing serial data at a 1 second polling rate, decoding it then posting it to MindSphere using a SimaticIOT2040. To reduce the CPU usage and to alleviate the stress on the device/node, I collected packets of data for about 20 seconds put them into the bulk format then passed on the payload to the MindConnect Node.
Strangely enough, when the bulk format is used with only one variable in each msg.payload.value object the data is visible on MindSphere. But when each msg.payload.value object carries multiple values they don't seem to get posted.

To Reproduce
I have attached simplified flows I've been using to debug (I've removed the shared secret from the MindConnect nodes).
One flow produces multiple values in the value object (flowFail.txt)
The other flow produces one value per value object (flowSuccess.txt)

flowFail.txt
flowSuccess.txt

Screenshots
In the following images you can see the flow (flowFail) displaying a successful post notification, but on FleetManager and through Postman (using the timeseries APIs on the relevant asset) you can see that no data ever made it to MindSphere.

flow

fleetManager

postman

Version Information
Node-Red Version 0.20.6
MindConnect Node Version 3.6.1

Additional context
I have also attached some output JSON named "msgFail.txt" and "msgSuccess.txt".

msgFail.txt
msgSuccess.txt

feat: dynamic Agent configuration

Automatic Agent configuration is a great tool. The limitation is that it maps to exactly one asset.

I sometimes encounter the situation that there are several identical assets that need to be feed depending on which physical asset the data is coming from.

It would be great, if I could trigger the Agent configuration from within a flow by giving an assetId or perhaps even better an asset name (if unique) and then automatically consume the data in the payload.
Even with the limitation, that the mapping must be assumed to be known, this would enhance the node for several use cases.

Alternatives would be to create one agent for each asset, which might not always work because they may be appear dynamic by some other process and also because it is probably considered waste.
Writing the same logic with direct API calls is obviously possible, but since we already have this great implementation with the Agent configuration, maybe an enhancement would be the more clean way.

Node incompatible with Node-RED 1.10?

After upgrading NR to 1.10 and the Mindconnect node to 3.7 it is not showing up in the node list anymore.

Flows that use the node show it as if it wasnt installed at all although it is.

Reinstalling the node, restarting node-RED wont't fix it. Starting from scratch with a fresh node-red install wont either. Tested on a raspi and a win10 installation.

MCISSUE1
MCISSUE2

TypeError: timestamp

I´m using "node-red-contrib-moment" to format date/time from a logfile. My output is:

_time: "2019-01-20T21:08:39.000Z"
This should be the same as in the example. But somhow I receive the following error:

"TypeError: timestamp.toISOString is not a function"

Any ideas?

Installed node will not show up in Node pallet when using Raspberry Chromium web browser

Describe the bug
After updating from 3.8.1 to 3.9.0 the installed does not show up in the pallet anymore. Accessing the same node-RED instance from another client running regular Chrome shows the node just fine.

To Reproduce
Steps to reproduce the behavior:

  • Open Node-RED in Raspberry Chromium
  • Try to use version 3.9.0

Screenshots
2020-09-16-134608_1024x768_scrot

Desktop (please complete the following information):
RaspberryOS 3B+

WS-2019-0047 (Medium) detected in tar-4.4.1.tgz

WS-2019-0047 - Medium Severity Vulnerability

Vulnerable Library - tar-4.4.1.tgz

tar for node

Library home page: https://registry.npmjs.org/tar/-/tar-4.4.1.tgz

Path to dependency file: /node-red-contrib-mindconnect/package.json

Path to vulnerable library: /tmp/git/node-red-contrib-mindconnect/node_modules/bcrypt/node_modules/tar/package.json

Dependency Hierarchy:

  • node-red-0.20.3.tgz (Root Library)
    • bcrypt-2.0.1.tgz
      • node-pre-gyp-0.9.1.tgz
        • tar-4.4.1.tgz (Vulnerable Library)

Vulnerability Details

Versions of node-tar prior to 4.4.2 are vulnerable to Arbitrary File Overwrite. Extracting tarballs containing a hardlink to a file that already exists in the system, and a file that matches the hardlink will overwrite the system's file with the contents of the extracted file.

Publish Date: 2019-04-05

URL: WS-2019-0047

CVSS 2 Score Details (5.0)

Base Score Metrics not available

Suggested Fix

Type: Upgrade version

Origin: https://www.npmjs.com/advisories/803

Release Date: 2019-04-05

Fix Resolution: 4.4.2


Step up your Open Source Security Game with WhiteSource here

feat: auto keep-alive

Is your feature request related to a problem? Please describe.
Implement an auto-keep alive function for the node which will make sure that the tokens are current even if the agent is not sending any data for over a week.

An in-range update of typescript-tslint-plugin is breaking the build 🚨

The devDependency typescript-tslint-plugin was updated from 0.5.4 to 0.5.5.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

typescript-tslint-plugin is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/jenkins/branch: This commit cannot be built (Details).

Commits

The new version differs by 5 commits.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Suspicious tsc calls in package.json

Not my domain, but these statements look strange, given that tsc requires some file to be compiled, no?

    "scripts": {
        "prepare": "tsc",
        ...
        "ts:build": "tsc",
        "ts:watch": "tsc -w",

Found while running "npm pack" on the package folder, which dumps the tsc help.

Mapping of multiple aspects

Describe the bug
If my target asset contain multiple aspects (of different type), only one of them receive correct mappings in the Agent after Configuration is complete.

image

WS-2019-0032 (Medium) detected in js-yaml-3.12.2.tgz, js-yaml-3.12.0.tgz

WS-2019-0032 - Medium Severity Vulnerability

Vulnerable Libraries - js-yaml-3.12.2.tgz, js-yaml-3.12.0.tgz

js-yaml-3.12.2.tgz

YAML 1.2 parser and serializer

Library home page: https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.2.tgz

Path to dependency file: /node-red-contrib-mindconnect/package.json

Path to vulnerable library: /tmp/git/node-red-contrib-mindconnect/node_modules/@node-red/nodes/node_modules/js-yaml/package.json

Dependency Hierarchy:

  • node-red-0.20.3.tgz (Root Library)
    • nodes-0.20.3.tgz
      • js-yaml-3.12.2.tgz (Vulnerable Library)
js-yaml-3.12.0.tgz

YAML 1.2 parser and serializer

Library home page: https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz

Path to dependency file: /node-red-contrib-mindconnect/package.json

Path to vulnerable library: /tmp/git/node-red-contrib-mindconnect/node_modules/mocha/node_modules/js-yaml/package.json

Dependency Hierarchy:

  • mocha-6.0.2.tgz (Root Library)
    • js-yaml-3.12.0.tgz (Vulnerable Library)

Vulnerability Details

Versions js-yaml prior to 3.13.0 are vulnerable to Denial of Service. By parsing a carefully-crafted YAML file, the node process stalls and may exhaust system resources leading to a Denial of Service.

Publish Date: 2019-03-26

URL: WS-2019-0032

CVSS 2 Score Details (5.0)

Base Score Metrics not available

Suggested Fix

Type: Upgrade version

Origin: https://www.npmjs.com/advisories/788/versions

Release Date: 2019-03-26

Fix Resolution: 3.13.0


Step up your Open Source Security Game with WhiteSource here

An in-range update of @types/node is breaking the build 🚨

The devDependency @types/node was updated from 12.7.11 to 12.7.12.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/jenkins/branch: This commit cannot be built (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

CVE-2018-3750 (High) detected in deep-extend-0.4.2.tgz

CVE-2018-3750 - High Severity Vulnerability

Vulnerable Library - deep-extend-0.4.2.tgz

Recursive object extending

Library home page: https://registry.npmjs.org/deep-extend/-/deep-extend-0.4.2.tgz

Path to dependency file: /node-red-contrib-mindconnect/package.json

Path to vulnerable library: /tmp/git/node-red-contrib-mindconnect/node_modules/bcrypt/node_modules/deep-extend/package.json

Dependency Hierarchy:

  • node-red-0.20.3.tgz (Root Library)
    • bcrypt-2.0.1.tgz
      • node-pre-gyp-0.9.1.tgz
        • rc-1.2.6.tgz
          • deep-extend-0.4.2.tgz (Vulnerable Library)

Vulnerability Details

The utilities function in all versions <= 0.5.0 of the deep-extend node module can be tricked into modifying the prototype of Object when the attacker can control part of the structure passed to this function. This can let an attacker add or modify existing properties that will exist on all objects.

Publish Date: 2018-07-03

URL: CVE-2018-3750

CVSS 3 Score Details (9.8)

Base Score Metrics:

  • Exploitability Metrics:
    • Attack Vector: Network
    • Attack Complexity: Low
    • Privileges Required: None
    • User Interaction: None
    • Scope: Unchanged
  • Impact Metrics:
    • Confidentiality Impact: High
    • Integrity Impact: High
    • Availability Impact: High

For more information on CVSS3 Scores, click here.

Suggested Fix

Type: Change files

Origin: RetireJS/retire.js@6a71696

Release Date: 2018-05-09

Fix Resolution: Replace or update the following file: npmrepository.json


Step up your Open Source Security Game with WhiteSource here

An in-range update of nodemon is breaking the build 🚨

The devDependency nodemon was updated from 1.19.3 to 1.19.4.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

nodemon is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/jenkins/branch: This commit cannot be built (Details).

Release Notes for v1.19.4

1.19.4 (2019-10-15)

Bug Fixes

Commits

The new version differs by 4 commits.

  • 7d6c1a8 fix: Replace jade references by pug
  • 74c8749 chore: test funding.yml change
  • c1a8b75 chore: update funding
  • d5b9891 test: ensure ignore relative paths

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Timestamp doesn't accept new Date()

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Token validation failed

We're connecting an IoT2040 to mindsphere with NodeRed and this node installed in it.
Onboarding and uploading data works fine. But after sometime occures an token validation error.
Does this node automatically refresh its token or should we do that logic in node red?
In that second case, how would you recommend us to to so?

Error: Network error occured Unauthorized {
"error": "token_validation_failed",
"error_description": "[335deceb801f48d1b49847f8bee61223]"
}

Error: Network error occured Unauthorized
{
"error": "token_validation_failed",
"error_description": "[96004b0a4fef4b3b847946eb1f2c03bb]"
}

Thank you 👍

feat: i18n support for the node

Is your feature request related to a problem? Please describe.
The node is available at the moment in the english language only.

Describe the solution you'd like
The node should implement the i18n support. Translation support for some languages would be great too. 😸 (e.g. german, japanese, hebrew, arabic, bosnian....)

https://nodered.org/docs/creating-nodes/i18n

Error after adding new datapoint to MindShpere and on the flow

I get an error after adding new datapoint to MindShpere and on the flow. The error can be seen on the screen 1. Error message is "Error: Data doesn't match the configuration! Errors: [{"keyword":"enum","dataPath":"[0].dataPointId","schemaPath":"#/items/properties/dataPointId/enum","params":{"allowedValues":["1603711984242","1604069980274","1604309224658","1604313647455"]},"message":"should be equal to one of the allowed values"}]".

Deploy was done after changes. And restart flows was done too. The value for the old datapoint (Line_1.MA35.AnalyticSystem.FeIII.AncolyzerData.Actual) was sent to MindSpere but for the new datapoint (Line_1.ComPart.LinePhaseShiftAnglele) the value was not sent. It can be seen on screen 2. Datapoint settings on MindSphere side can be seen on screen 3.

When I open and close only Agent Information dialog from RSA 3072 Agent(mindconnect) node the value for the new datapoint starts to send to MindSphere without this error. See 4 and 5 screens.

MindConnect Node-RED Agent v3.10.0 was used in this case.

To Reproduce
Steps to reproduce the behavior:

  1. Add datapoint, add variable to aspect and link them
  2. Add inject node for the new datapoint
  3. deploy flow
  4. See error on the screen 1

Expected behavior
Sending values of new datapoint to MindSphere after deploy flow without this error and without opening Agent Information dialog.

Screenshots
screen 1
image

screen 2
image

screen 3
image

screen 4
image

screen 5
image

Node-RED server runs:

  • OS: Windows 10 IoT Enterprise x64

For configuration flow were used:

  • safari and firefox

validation failure if more than one data source

If more than one data source is defined on the Mindsphere side and data is pushed for a data point that is not in the first data source, the "Validate datapoints before sending" fails claiming that the data point ID is not part of the list of valid IDs (and the list provided in the error message is the list of data point IDs from the first data source only). Diasbling this validation resolves the issue but is obviously not intended behaviour.

To Reproduce
Steps to reproduce the behavior:

  1. Create an agent in Mindsphere with at least two data sources and at least one variable in the second data source
  2. Creafe a flow in NodeRed connecting to the agent and enable the "Validate datapoints before sending" option
  3. Push a value to a variable in the second data source
  4. See error

Expected behavior
The validation should check for valid data point IDs from all available data sources in that agent.

Desktop (please complete the following information):

  • OS: Win10
  • Browser: Chromium Edge
  • Version: 83.0.478.61 64bit

Does not work on windows 10 IOT

I've tried this node on multiple devices/ platforms it worked well in all of them expect on win10 iot.

I installed it from node-red first, it did not copy the files to node_modules.After installing it from cmd the files were installed, but the node is still no displayed in node-red.
I tried to install it multiple ways with a lot of rehosting the server or restarting the pc. None of them worked.

Re-Onboard device after new created datapoints in mindsphere

We're connecting an IoT2040 to mindsphere with NodeRed and this node installed in it.
Onboarding and uploading data works fine.
Once we onboarded our device and create our datasources and datapoints in Mindsphere, we are able to send data from our mentioned IOT2040.
The problem is when we create new datapoints in Mindsphere and add those given datapointIDs to our to-send json. The mindconnect node only accepts these new datapoints if we cancel the mentioned onboarding that was already working and create a new SHARED SECRET to onboard the IoT2040 again. Then the new datasources/datapoints are updated correctlly.

Thank you 👍

feat: support custom event

I wasn’t successful in passing CustomEvents to MindSphere via the MindConnect node, it doesn’t seem to recognize “typeId”. I worked around this with a standard http request to MindSphere events endpoint. Is this normal behavior?

feat: better support for offline buffering

When the MindSphere is offline it would be nice to have a support for bulk-upload of the buffered data.

Describe alternatives you've considered
An alternative is to create a separate flow which will handle the buffered data.

Additional context
This feature requires the MindSphere to support bulk upload for performance assets.

Failed to load mindconnect node when modifying the URL root path

Describe the bug
mindsphere.css and ajv.min.js failed to be loaded from browser when providing httpAdminRoot in settings.js file in order to configure URL base path.
The way to modify the root path is described in Node-RED official document.

To Reproduce
Steps to reproduce the behavior:

  1. Edit settings.js and insert httpAdminRoot: 'mypath'
  2. Start Node-RED and access to http://localhost:1880/mypath on a local browser
  3. The browser complains as CSS and JS resources are missing (HTTP 404 error for the resources)
  4. Node-RED editor also shows a dialog saying Failed to load '@mindconnect/node-red-contrib-mindconnect/mindconnect' SyntaxError: expected expression, got '<' on the browser

Expected behavior
The both resources should be loaded without errors.

Screenshots
Node-RED editor error:
screenshot1
Browser errors:
unnamed

Desktop

  • OS: macOS 10.13.6, Raspbian Stretch (2018-10-09)
  • Browser Safari 12.0.3

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
I found a solution to the issue. Just remove '/' from href attribute values.

$ diff node-red-contrib-mindconnect/src/mindconnect.html.resolved node-red-contrib-mindconnect/src/mindconnect.html
1c1
< <link href="mindsphere.css" rel="stylesheet">
---
> <link href="/mindsphere.css" rel="stylesheet">
177c177
< <script type="text/javascript" src="ajv.min.js" />
---
> <script type="text/javascript" src="/ajv.min.js" />

Copying templates for function nodes to the clipboard fails

Describe the bug
Copying templates to the clipboard fails. This is the same for every of the four buttons.

To Reproduce
Steps to reproduce the behavior:

  1. Automatically create DP Mapping
  2. Click on of the four copy template buttons
  3. Try to paste the clipboard to a function node

Expected behavior
Successful copy of templates.

Screenshots
temp

Desktop (please complete the following information):
Chrome Windows

Additional context
Add any other context about the problem here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.