{"id":13799476,"url":"https://github.com/mindsphere/node-red-contrib-mindconnect","last_synced_at":"2025-09-22T22:35:08.072Z","repository":{"id":34067999,"uuid":"155538725","full_name":"mindsphere/node-red-contrib-mindconnect","owner":"mindsphere","description":"Node-RED Agent for the MindConnect API (community driven project)","archived":false,"fork":false,"pushed_at":"2024-09-06T10:29:19.000Z","size":10658,"stargazers_count":50,"open_issues_count":20,"forks_count":1,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-09-07T21:03:59.893Z","etag":null,"topics":["industrial-iot","insights-hub","mindconnect","node-red","node-red-contrib","nodejs","siemens","siemens-xcelerator"],"latest_commit_sha":null,"homepage":"https://opensource.mindsphere.io/docs/node-red-contrib-mindconnect/index.html","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mindsphere.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-10-31T10:26:14.000Z","updated_at":"2025-02-28T08:55:06.000Z","dependencies_parsed_at":"2024-01-29T09:18:40.828Z","dependency_job_id":"4f1570a1-8a5c-4da7-a263-bb536c90cb64","html_url":"https://github.com/mindsphere/node-red-contrib-mindconnect","commit_stats":{"total_commits":89,"total_committers":8,"mean_commits":11.125,"dds":0.202247191011236,"last_synced_commit":"76b7ab9ef457ed7f3193103bb761bfbde420828f"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/mindsphere/node-red-contrib-mindconnect","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mindsphere%2Fnode-red-contrib-mindconnect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mindsphere%2Fnode-red-contrib-mindconnect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mindsphere%2Fnode-red-contrib-mindconnect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mindsphere%2Fnode-red-contrib-mindconnect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mindsphere","download_url":"https://codeload.github.com/mindsphere/node-red-contrib-mindconnect/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mindsphere%2Fnode-red-contrib-mindconnect/sbom","scorecard":{"id":647899,"data":{"date":"2025-08-11","repo":{"name":"github.com/mindsphere/node-red-contrib-mindconnect","commit":"76b7ab9ef457ed7f3193103bb761bfbde420828f"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.5,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/27 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/build.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: MIT License: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/mindsphere/node-red-contrib-mindconnect/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/mindsphere/node-red-contrib-mindconnect/build.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/mindsphere/node-red-contrib-mindconnect/build.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:48: update your workflow using https://app.stepsecurity.io/secureworkflow/mindsphere/node-red-contrib-mindconnect/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:66: update your workflow using https://app.stepsecurity.io/secureworkflow/mindsphere/node-red-contrib-mindconnect/build.yml/master?enable=pin","Warn: containerImage not pinned by hash: Dockerfile:1: pin your Docker image by updating nodered/node-red to nodered/node-red@sha256:da6ac47cce14ed8df7ceddc8a15c8f4c0a41e0836c4d6e68e7a6a82329305a6b","Warn: npmCommand not pinned by hash: Dockerfile:9","Warn: npmCommand not pinned by hash: .github/workflows/build.yml:35","Info:   0 out of   3 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 third-party GitHubAction dependencies pinned","Info:   0 out of   1 containerImage dependencies pinned","Info:   0 out of   2 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact v3.12.1 not signed: https://api.github.com/repos/mindsphere/node-red-contrib-mindconnect/releases/66494437","Warn: release artifact v3.12.0 not signed: https://api.github.com/repos/mindsphere/node-red-contrib-mindconnect/releases/43318798","Warn: release artifact v3.11.0 not signed: https://api.github.com/repos/mindsphere/node-red-contrib-mindconnect/releases/40103107","Warn: release artifact v3.10.0 not signed: https://api.github.com/repos/mindsphere/node-red-contrib-mindconnect/releases/33601032","Warn: release artifact v3.9.2 not signed: https://api.github.com/repos/mindsphere/node-red-contrib-mindconnect/releases/32893959","Warn: release artifact v3.12.1 does not have provenance: https://api.github.com/repos/mindsphere/node-red-contrib-mindconnect/releases/66494437","Warn: release artifact v3.12.0 does not have provenance: https://api.github.com/repos/mindsphere/node-red-contrib-mindconnect/releases/43318798","Warn: release artifact v3.11.0 does not have provenance: https://api.github.com/repos/mindsphere/node-red-contrib-mindconnect/releases/40103107","Warn: release artifact v3.10.0 does not have provenance: https://api.github.com/repos/mindsphere/node-red-contrib-mindconnect/releases/33601032","Warn: release artifact v3.9.2 does not have provenance: https://api.github.com/repos/mindsphere/node-red-contrib-mindconnect/releases/32893959"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 16 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"56 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-wf5p-g6vw-rhxx","Warn: Project is vulnerable to: GHSA-jr5f-v2jv-69x6","Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-h452-7996-h45h","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-xwcq-pm8m-c4vf","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-wm7h-9275-46v2","Warn: Project is vulnerable to: GHSA-4gmj-3p3h-gm8h","Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc","Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx","Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc","Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5","Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97","Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-fqg8-vfv7-8fj8","Warn: Project is vulnerable to: GHSA-8cf7-32gw-wr33","Warn: Project is vulnerable to: GHSA-hjrf-2m68-5959","Warn: Project is vulnerable to: GHSA-qwph-4952-7xr6","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-wc69-rhjr-hc9g","Warn: Project is vulnerable to: GHSA-56x4-j7p9-fcf9","Warn: Project is vulnerable to: GHSA-v78c-4p63-2j6c","Warn: Project is vulnerable to: GHSA-44fp-w29j-9vj5","Warn: Project is vulnerable to: GHSA-4pg4-qvpc-4q3h","Warn: Project is vulnerable to: GHSA-g5hg-p3ph-g8qg","Warn: Project is vulnerable to: GHSA-fjgf-rc76-4x9p","Warn: Project is vulnerable to: GHSA-qrpm-p2h7-hrv2","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-px4h-xg32-q955","Warn: Project is vulnerable to: GHSA-76c9-3jph-rj3q","Warn: Project is vulnerable to: GHSA-v923-w3x8-wh69","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w","Warn: Project is vulnerable to: GHSA-wgrm-67xf-hhpq","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg","Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-776f-qx25-q3cc","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T12:38:48.115Z","repository_id":34067999,"created_at":"2025-08-21T12:38:48.115Z","updated_at":"2025-08-21T12:38:48.115Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276487462,"owners_count":25651133,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-22T02:00:08.972Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["industrial-iot","insights-hub","mindconnect","node-red","node-red-contrib","nodejs","siemens","siemens-xcelerator"],"created_at":"2024-08-04T00:01:03.173Z","updated_at":"2025-09-22T22:35:08.026Z","avatar_url":"https://github.com/mindsphere.png","language":"TypeScript","funding_links":[],"categories":["Nodes"],"sub_categories":["I/O"],"readme":"# node-red-contrib-mindconnect\n\n## Node-RED Agent for the MindConnect API\n\n\u003c!-- markdownlint-disable MD033 --\u003e\n\u003cimg src=\"images/mindconnect-node-red-logo.svg\" alt=\"@mindconnect/node-red-contrib-mindconnect\" width=\"300px\"/\u003e\n\u003c!-- markdownlint-enableMD033 --\u003e\n\nThis node enables the Node-RED users to upload timeseries, files and events to MindSphere.\nThis project has started as a community effort at Siemens AG and is now available for general use.\n\n[![Build](https://github.com/mindsphere/node-red-contrib-mindconnect/actions/workflows/build.yml/badge.svg)](https://github.com/mindsphere/node-red-contrib-mindconnect/actions/workflows/build.yml) [![The MIT License](https://img.shields.io/badge/license-MIT-009999.svg?style=flat)](./LICENSE.md)\n[![npm](https://img.shields.io/npm/v/@mindconnect/node-red-contrib-mindconnect/latest.svg?style=flat)](https://www.npmjs.com/package/@mindconnect/node-red-contrib-mindconnect) ![downloads](https://img.shields.io/npm/dw/@mindconnect/node-red-contrib-mindconnect.svg?colorB=009999)\n[![Documentation](https://img.shields.io/badge/mindsphere-documentation-%23009999.svg)](https://opensource.mindsphere.io/docs/node-red-contrib-mindconnect/index.html)\n[![Forum](https://img.shields.io/badge/mindsphere-community-%23009999.svg)](https://community.plm.automation.siemens.com/t5/Developer-Space/bd-p/MindSphere-platform-forum)\n[![Demo Flows](https://img.shields.io/badge/node--RED-playground-%23009999.svg)](https://playground.mindconnect.rocks)\n\nThe 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).\n\n## Installing the node\n\n```bash\n# change to your ~./node-red/ folder\ncd ~/.node-red/\nnpm install @mindconnect/node-red-contrib-mindconnect\n```\n\n## Node-RED - Manage Palette Installation\n\nYou can install the node also via the Manage palette feature in the Node-RED administration UI.\n\n![palette](images/install_palette.png)\n\n### FAQ\n\n- install to the .node-red folder if you have installed node-red globally\n- install to the userDir directory if you have custom userDir\n- make sure that your nodejs version is relatively current\n\n## How to use the Node-RED node\n\nSince 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.\n\n### Step 0: Create (at least) one asset and one agent in MindSphere\n\n- Create an asset in Asset Manager for your data\n- Create an agent of the type MindConnectLib [core.mclib] and store the agent.\n\n### Step 1: Get the initial agent configuration from Mindsphere Asset Manager\n\nYou can choose between:\n\n- **RSA_3072** public/private key pair (3072bit) for enhanced security which requires more computing power on the devices and\n- **SHARED_SECRET** shared key (256bit) for lightweight devices.\n\nIf you want to use RSA_3072 you will have to create a 3072bit key for your device, eg. with openssl:\n\n```bash\nopenssl genrsa -out private.key 3072\n```\n\nThere is no additional configuration required for SHARED_SECRET security profile.\n\n![boarding configuration](images/boarding-configuration.png)\n\n### Step 2: Copy the agent onboarding information (and if necessary the RSA 3072 private key) to the node and deploy the flow\n\nCopy the agent onboarding information and optionally the RSA_3072 private key to the node and deploy the flow.\n\n![implementation](images/configured-node.png)\n\n### Step 3: Press the agent configuration button and select the target asset\n\nThe 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\nMindSphere 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)\n\n![implementation](images/automatic-configuration.png)\n\nThe 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.\n\n![implementation](images/mindsphere-configuration.png)\n\n### Step 4: Create and deploy the flow and send data\n\nYou can use the node to send timeseries, bulk timeseries, events and files to MindSphere. The templates for the input messages are listed\nbelow, but you can also just use the **Agent Information** button which will let you copy the corresponding template to clipboard.\n\n![implementation](images/infodialog-templates.png)\n\n#### Send data points\n\nThe node requires json objects as input in following format (e.g. from a function node)\n\n```javascript\nconst values = [\n    { dataPointId: \"1000000000\", qualityCode: \"1\", value: \"42\" },\n    { dataPointId: \"1000000001\", qualityCode: \"1\", value: \"33.7\" },\n    { dataPointId: \"1000000003\", qualityCode: \"1\", value: \"45.76\" }\n];\n\nmsg._time = new Date();\nmsg.payload = values;\nreturn msg;\n```\n\nThe 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.\n\n#### Send data points in bulk\n\nThe node requires json objects as input in following format (e.g. from a function node if you want to use bulk upload)\n\n```javascript\nconst values = [\n    {\n        timestamp: \"2018-11-09T07:46:36.699Z\",\n        values: [\n            { dataPointId: \"1000000000\", qualityCode: \"1\", value: \"42\" },\n            { dataPointId: \"1000000001\", qualityCode: \"1\", value: \"33.7\" },\n            { dataPointId: \"1000000003\", qualityCode: \"1\", value: \"45.76\" }\n        ]\n    },\n    {\n        timestamp: \"2018-11-08T07:46:36.699Z\",\n        values: [\n            { dataPointId: \"1000000000\", qualityCode: \"1\", value: \"12\" },\n            { dataPointId: \"1000000001\", qualityCode: \"1\", value: \"13.7\" },\n            { dataPointId: \"1000000003\", qualityCode: \"1\", value: \"15.76\" }\n        ]\n    }\n];\n\nmsg.payload = values;\nreturn msg;\n```\n\n**Note:** All MindSphere timestamps must be in the **ISO format** (use `toISOString()` function).\n\n#### Send events\n\nThe 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.\n\n```javascript\nmsg.payload = {\n    entityId: \"d72262e71ea0470eb9f880176b888938\", // optional, use assetid if you want to send event somewhere else :)\n    sourceType: \"Agent\",\n    sourceId: \"application\",\n    source: \"Meowz\",\n    severity: 30, // 0-99 : 20:error, 30:warning, 40: information\n    description: \"Event sent at \" + new Date().toISOString(),\n    timestamp: new Date().toISOString(),\n    additionalproperty1: \"123\",\n    additionalproperty2: \"456\"\n};\nreturn msg;\n```\n\nIf you are using the custom events instead of MindSphere Standard Events please include the following switch in the message.\n\n```javascript\nmsg._customEvent=true;\n```\n\n#### File Upload\n\nThe 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.\n\n```javascript\nmsg.payload = {\n    entityId: \"d72262e71ea0470eb9f880176b888938\", //optional (per default files are uploaded to the agent)\n    fileName: \"digitaltwin.png\", // you can also pass an instance of a Buffer\n    fileType: \"image/png\", //optional, it is automatically determined if there is no fileType specified\n    filePath: \"images/digitaltwin.png\", // required if you are using buffer instead of the file name\n    description: \"testfile\"\n};\nreturn msg;\n```\n\nIf the experimental chunking feature is on, the files which are larger than 8MB will be uploaded in 8 MB Chunks.\n\n#### Data Lake File Upload\n\nPrecondition for data lake upload is that [MindSphere Integrated Data Lake](https://www.dex.siemens.com/mindsphere/applications/integrated-data-lake) is purchased and write-enabled.\nThe node requires json objects as input in following format (e.g. from a function node).\n\n```javascript\n// take a look at the flow examples at https://playground.mindconnect.rocks \n//\n// Preconditions : data-lake is purchased and enabled for writing (see mc data-lake --mode write  CLI command)\n//\n// Agents can only upload files to a path which is prefixed with their agent id\n// The MindConnect Node will apply this prefix automatically to the dataLakeFileUpload Path\n// You can pass either a javascript buffer or path to file in the dataLakeFile property for upload\n// The subTenantId can be optionally added to the messsage\n\nconst dataLakeFileInfo = {\n  \"dataLakeFile\": \"my/path/to/file.txt\",\n  \"dataLakeFilePath\": \"uploads/file.txt\"\n};\n\n// Uncomment the next code line if you just want to generate an upload url (in msg._signedUrl) \n// without actually uploading the file\n// msg._ignorePayload = true;\n\nmsg.payload = dataLakeFileInfo;\nreturn msg;\n```\n\nPlease note:\n\n- Agents can only upload files to a path which is prefixed with their agent id\n- The MindConnect Node will apply this prefix automatically to the dataLakeFileUpload Path\n- You can pass either a javascript buffer or path to file in the dataLakeFile property for upload\n- The subTenantId can be optionally added to the messsage\n\n#### Reading Asset Information\n\nYou 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](https://playground.mindconnect.rocks/#flow/9ff72be.3d502d8) on playground for a full example.\n\n```javascript\nmsg.payload = {\n  \"assetId\": \"{assetId}\",\n  \"includeShared\": false,\n  \"propertyNames\": []\n};\n\nreturn msg;\n```\n\nYou can reduce the number of items in payload by specifying list of properties to include in the message: e.g.\n`propertyNames: [\"variables\"] or [\"location\"]`\n\n#### Executing custom functions using MindSphere javascript/typescript SDK\n\nThe node can be used to execute a complex script which uses [MindSphere javascript/typescript SDK](https://opensource.mindsphere.io/docs/mindconnect-nodejs/sdk/index.html). 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.\n\n```javascript\nmsg.payload = {\n    function: `\nconst assetManagement = sdk.GetAssetManagementClient();\nconst asset = await assetManagement.GetAsset('{assetId}');\nreturn asset;\n`};\n           \nreturn msg;\n```\n\n#### Error handling in the flows\n\nThe node can be configured to retry all mindsphere operations (1-10 times, with delay of time \\* 300ms before the next try)\nIf you need more complex flows, the node also returns the\n\n```javascript\nmsg._mindsphereStatus; // OK on success othervise error\nmsg._error; // The timestamped error message\n```\n\nproperties 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)\n\n![errorhandling](images/errorhandling.png)\n\n## JWT Token Generation for SouthBound APIs\n\nThe node can be used to generate authentication tokens which you can use to call your own custom southbound APIs.\nThe msg.headers will have a Mindsphere Authorization JWT.\n\n```javascript\nmsg._includeMindSphereToken=true;\n```\n\nif you just want to get the token without sending any data to MindSphere\n\n```javascript\nmsg._ignorePayload=true;\n```\n\nTreat tokens as you would any other credentials.\n\n## Control Topic and Status Messages\n\nThe 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:\n\n- the maximal number of parallel requests (**Async Requests**) has been exceeded or\n- the maximal wait time (**Async Duration**) has been reached.\n\nThe following image illustrates the function of the new settings:\n\n![image](./images/internal-array.png)\n\nThe `payload` on the `control` topic with the status information looks like this:\n\n```javascript\n{\n    requests: number;\n    success: number;\n    pending: number;\n    errors: number;\n}\n```\n\nThis information can be used to manage for example a queue node before the mindconnect node to regulate the flow of\nthe messages. See example `#HighDataVolume` on [https://playground.mindconnect.rocks](https://playground.mindconnect.rocks)\n\n## Demo flows\n\n[![Demo Flows](https://img.shields.io/badge/node--RED-playground-%23009999.svg)](https://playground.mindconnect.rocks)\n\n[MindConnect Node-RED playground](https://playground.mindconnect.rocks) provides following demo flows importing following data points to MindSphere\n\n- CPU-Usage\n- Batched MQTT Data\n- OPC-UA Data\n- Real Weather Data to MindSphere\n- Simulated Water Pump Data\n- Custom SouthBound API Calls\n\nThe simulated water pump data can be inspected at\n\n\u003chttps://dreamforce.mindconnect.rocks\u003e\n\nThis application can be used without mindsphere credentials.\n\n- username: guest@mindsphere.io\n- password: Siemens123!\n\nThis data is also used as an example for the KPI-Calculation and Trend prediction with help of MindSphere APIs. \u003chttps://github.com/mindsphere/analytics-examples\u003e\n\n## Securing API Endpoints\n\nThe corresponding API calls for reading the data source configuration and mappings in Agent Configuration and Agent Information dialog require that the user has:\n\n```mindconnect.read```\n\npermission. The automatic configuration requires\n\n```mindconnect.write```\n\npermission.\n\n## Troubleshooting\n\nIf you have problems with your agent:\n\n1. Stop the agent.\n2. Move or delete the content of the .mc folder (the json files with configuration and authentication settings).\n3. Offboard the agent.\n4. Create new settings for the mindconnect library.\n5. copy the new settings to the node.\n\n### Reseting the agent settings from version 3.7.0\n\nSince 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.\n\nPress on the \"delete local configuration\" :wastebucket: button on the node, confirm the dialog and redeploy the node.\n\n![delete local settings](images/deletelocal.png)\n\nIf you are having problems, it is a good idea to restart the Node-RED runtime completely.\n\n### Diagnostic in MindSphere\n\nIf 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.\nThe agent diagnostic button will lead you directly to the agent diagnostic application in the MindSphere.\n\n![diagnostic](images/diag.png)\n\n## Generating the documentation\n\nYou can always generate the current HTML documentation by running the command below.\n\n```bash\n#this generates a docs/ folder the with full documentation of the library.\nnpm run doc\n```\n\n## Proxy support\n\nSet the http_proxy or HTTP_PROXY environment variable if you need to connect via proxy.\n\n```bash\n# set http proxy environment variable if you are using e.g. fiddler on the localhost.\n\nexport HTTP_PROXY=http://localhost:8888\n```\n\n## How to setup development environment\n\n```bash\n# create a directory ../devnodes\ncd ..\nmkdir devnodes\ncd devnodes\n# this registers your development directory with node red\nnpm link ../node-red-contrib-mindconnect\n\n# after that in you can start developing with\ncd ../node-red-contrib-mindconnect\n\nnpm run start-dev\n\n# your node red flows will be stored in the ../devnodes directory\n```\n\n## Legal\n\nThis project has been released under an [Open Source license](./LICENSE.md). 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.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmindsphere%2Fnode-red-contrib-mindconnect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmindsphere%2Fnode-red-contrib-mindconnect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmindsphere%2Fnode-red-contrib-mindconnect/lists"}