diff --git a/Dashboard_getting_started/readme.md b/Dashboard_getting_started/readme.md index 906ad4d..a40ad10 100644 --- a/Dashboard_getting_started/readme.md +++ b/Dashboard_getting_started/readme.md @@ -1,5 +1,5 @@ # VFC Dashboard - A Getting Started Example: -This example will guide you step by step through the VFC Dahsboard functionalities. You will create a simple but interactive dashboard that shows the status of your three (simulated) machines that you already connected to MindSphere. You will learn the essential nodes for dashboarding with the VFC and will be able to extend your dashboard according to your own needs. The Dashboard you create will look like this: +This example will guide you step by step through the VFC Dahsboard functionalities. You will create a simple but interactive dashboard that shows the status of your three (simulated) machines that you already connected to Insights Hub. You will learn the essential nodes for dashboarding with the VFC and will be able to extend your dashboard according to your own needs. The Dashboard you create will look like this: ![dashboard_image](./doc/overview.png) @@ -10,7 +10,7 @@ This tutorial is meant to start from scratch. You will set up your Assets, gener - Visual Flow Creator - Asset Manager - basic Javascript knowledge is helpful, but not required -> All required applications and resources are part of a [Start for free](https://siemens.mindsphere.io/en/start) tenant. You can follow this tutorial along regardless of your MindSphere package. +> All required applications and resources are part of a [Start for free](https://siemens.mindsphere.io/en/start) tenant. You can follow this tutorial along regardless of your Insights Hub package. > This tutorial is designed for beginners. However, some fundamental knowledge about the VFC will make your learning journey more enjoyable. Learn the basics [Here](https://documentation.mindsphere.io/resources/html/visualflow-creator/en-US/index.html). @@ -20,7 +20,7 @@ We will simulate three different versions of an industrial machine: - Performance - Eco -This step requires you to be familiar with MindSphere's asset structure and that you can create new aspects, assets and asset types. If this sounds like a big headache to you, please visit the [Asset Manager Tutorial](https://siemens.mindsphere.io/en/docs/tutorials/asset-manager) first. +This step requires you to be familiar with Insights Hub's asset structure and that you can create new aspects, assets and asset types. If this sounds like a big headache to you, please visit the [Asset Manager Tutorial](https://siemens.mindsphere.io/en/docs/tutorials/asset-manager) first. If not, please follow the [Setup Instructions](./Setup/readme.md) and come back once you completed the process. @@ -227,7 +227,7 @@ Try these new functionalities in your own dashboard. If you click on a machine, https://user-images.githubusercontent.com/90254123/166253526-9b203cf0-5e0d-42ab-9dd6-360943efe8bd.mp4 -Let's take a short summary. As a VFC user you have already visualized your three assets, their location and status. Now you want to take things to the next level. Imagine beeing a machine Operator, who wants to report a critical machine failure as quickly as possible directly from the dashboard. Furthermore, you want to be able to navigate to your machine and see what happened. MindSphere offers a functionality that supports our idea, it' called **events**. So let's implement events in our dashboard. But we have to do something else first. The logic of our flow needs to know which machine is actually selected. We need to store some kind of indicator which machine is selected and we can do it in two different ways: +Let's take a short summary. As a VFC user you have already visualized your three assets, their location and status. Now you want to take things to the next level. Imagine beeing a machine Operator, who wants to report a critical machine failure as quickly as possible directly from the dashboard. Furthermore, you want to be able to navigate to your machine and see what happened. Insights Hub offers a functionality that supports our idea, it' called **events**. So let's implement events in our dashboard. But we have to do something else first. The logic of our flow needs to know which machine is actually selected. We need to store some kind of indicator which machine is selected and we can do it in two different ways: 1. By sending the machine directly as *msg.payload* or as a *msg.xxxxx* property 2. By setting up a flow variable When you are declaring variables in a *function* node, they are of course only valid and accessible in the respective function. Flow variables however are stored on flow level and can be used to store some data and read it again later in the flow without the need to send it in the *msg*. We now want to store our selected machine in a flow variable called *ActiveAsset*. Drop three *change* nodes and one *store ctx* node into your flow. @@ -285,7 +285,7 @@ And the whole bottom part of your flow should look like this: But what exactly are these nodes doing? If a machine is selected and you click on the button *Report emergency* you create an event for this machine, which is saved and bound to your asset, so you can see and use this event in the future or execute other commands dependent of the event severity. At the same time, a notification pops out in the right corner of your browser to inform you that the event was successfully created. -Now let's get this getting-started dashboard finished and implement one last feature: we want to see our events for a machine on our detail dashboard. MindSphere offers the pre build *event table* node exactly for this purpose. Go to your *Detail* tab and create a new group called *Events* with a width of 26. Then drop the *event table* node from the *MDSP Dashboard* section in your flow and assign it to the *Events* group. Give the node a *Size* of 26 x 12. We want it to be big, to see al the details of the events. Choose the *Basic* machine in the Asset field and check these columns to show: +Now let's get this getting-started dashboard finished and implement one last feature: we want to see our events for a machine on our detail dashboard. Insights Hub offers the pre build *event table* node exactly for this purpose. Go to your *Detail* tab and create a new group called *Events* with a width of 26. Then drop the *event table* node from the *MDSP Dashboard* section in your flow and assign it to the *Events* group. Give the node a *Size* of 26 x 12. We want it to be big, to see al the details of the events. Choose the *Basic* machine in the Asset field and check these columns to show: - [x] Severity - [x] EntityId - [x] Timestamp @@ -332,7 +332,7 @@ You can extend this dashboard in many ways. See it as a starting point and add t - . . . # Questions and Answers -Feel free to ask your questions in the [MindSphere Developer Forum](https://community.sw.siemens.com/s/topic/0TO4O000000MihsWAC). +Feel free to ask your questions in the [Insights Hub Developer Forum](https://community.sw.siemens.com/s/topic/0TO4O000000MihsWAC). Or open an [issue](https://github.com/mindsphere/vfc-examples/issues) if you find a bug in our examples. diff --git a/DataLake_provideAccessToken/readme.md b/DataLake_provideAccessToken/readme.md index 84ab33e..09c3005 100644 --- a/DataLake_provideAccessToken/readme.md +++ b/DataLake_provideAccessToken/readme.md @@ -1,6 +1,6 @@ # Provide Access Token for Integrated Data Lake via API -This small flow triggers sets up an API endpoint which can be called from external system to get an access token to MindSpheres' Integrated Data Lake. +This small flow triggers sets up an API endpoint which can be called from external system to get an access token to Insights Hubs' Integrated Data Lake. ![image](./doc/example.png) @@ -32,9 +32,9 @@ In this example, calling the full API endpoint https://presiot-visualflowcreator ## See also -- [:shopping_cart: MindSphere Store: Integrated Data Lake](https://www.dex.siemens.com/mindsphere/mindaccess/integrated-data-lake-essential) +- [:shopping_cart: Insights Hub Store: Integrated Data Lake](https://www.dex.siemens.com/mindsphere/mindaccess/integrated-data-lake-essential) - [Developer Documentation: Integrated Data Lake Service](https://developer.mindsphere.io/apis/iot-integrated-data-lake/api-integrated-data-lake-overview.html) -) + diff --git a/DataLake_scheduledImport/readme.md b/DataLake_scheduledImport/readme.md index f396261..6a03fb5 100644 --- a/DataLake_scheduledImport/readme.md +++ b/DataLake_scheduledImport/readme.md @@ -36,7 +36,6 @@ The IDL Explorer helps to browse the file structures. ## See also - [:shopping_cart: MindSphere Store: Integrated Data Lake](https://www.dex.siemens.com/mindsphere/mindaccess/integrated-data-lake-essential) - [Developer Documentation: Integrated Data Lake Service](https://developer.mindsphere.io/apis/iot-integrated-data-lake/api-integrated-data-lake-overview.html) -) diff --git a/README.md b/README.md index 363c6a0..bc5602f 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,19 @@ -# MindSphere Visual Flow Creator Examples +# Insights Hub Visual Flow Creator Examples [![The MDL License](https://img.shields.io/badge/license-MDL-009999.svg?style=flat)](./LICENSE.md) [![Documentation](https://img.shields.io/badge/mindsphere-documentation-%23009999.svg)](https://opensource.mindsphere.io/docs/mindconnect-nodejs/index.html) [![Forum](https://img.shields.io/badge/mindsphere-community-%23009999.svg)](https://community.plm.automation.siemens.com/t5/Developer-Space/bd-p/MindSphere-platform-forum) # Welcome -* You are interested in MindSphere? +* You are interested in Insights Hub? * You want to know, what you can do with it? * You've heard about Visual Flow Creator and want to try it out? * You know already Visual Flow Creator but search for examples? * You want to get inspired by other flows from the community? -This repository provides example flows to be used in MindSphere Visual Flow Creator (VFC). You can use them and try it out to get an impression what is possible. Additionally you can customize them to your use cases. And of course you can contribute to this repository and share your knowledge to others. +This repository provides example flows to be used in Insights Hub Visual Flow Creator (VFC). You can use them and try it out to get an impression what is possible. Additionally you can customize them to your use cases. And of course you can contribute to this repository and share your knowledge to others. -If you do not have already purchased the app, you can get it in the [MindSphere Store](https://www.dex.siemens.com/mindsphere/applications/Visual-Flow-Creator). Or if you do not already have a MindSphere account, get one at [MindSphere Start](https://www.mindsphere.io/start). +If you do not have already purchased the app, you can get it in the [Insights Hub Store](https://www.dex.siemens.com/mindsphere/applications/Visual-Flow-Creator). Or if you do not already have a Insights Hub account, get one at [Insights Hub Start](https://www.mindsphere.io/start). ## How does this work @@ -31,14 +31,12 @@ Please note, that the json-files are exported from another tenant. So their migh | Name | Description | Complexity Rating | Prerequisites | | --- | --- | --- | --- | | [Command MQTT devices connected via MindConnect](./commandMqttDevice_MindConnect/readme.md) | Send commands back to a device via MindConnect MQTT | :star: | MindConnect MQTT connected device | -| [Command MQTT devices connected via IoT Extension](./commandMqttDevice_IoT-Extension/readme.md) | Send a command to a device via IoT Extension | :star: :star: | IoT Extension| | [Create custom API endpoints](./createCustomEndpoint/readme.md) | | :star: | - | | [Create rule for asset type](./createRuleForAssetType/readme.md) | Create a rule for all assets of this type | :star: | - | | [Data Lake - timeseries import](./DataLake_scheduledImport/readme.md) | Setup scheduled trigger to start import of data from timeseries storage to Integrated Data Lake | :star: | Integrated Data Lake | | [Data Lake - generate access token](./DataLake_provideAccessToken/readme.md) | Provides an API endpoint which feedbacks an access token for IDL data | :star: | Integrated Data Lake | -| [Generate sample data](./generateSampleData/readme.md) | Demo data for different data types in MindSphere | :star: | - | +| [Generate sample data](./generateSampleData/readme.md) | Demo data for different data types in Insights Hub | :star: | - | | [Send SMS notifications](./sendSmsNotifications/readme.md) | Send SMS notifications and dynamically specify recipient | :star: | - | -| [Trend Prediction Example](./trendPredictionAPI/readme.md) | Application example which shows how to use trend prediction service to forecast timeseries data | :star: | - | | [Virtual machine simulator](./virtualMachineSimulator/readme.md) | | :star: | - | | [Write location data to your Asset](./WriteLocationToAsset/readme.md) | Write locational information directly to your Asset using the Asset Management API | :star: | - | | [VFC Dashboard - Getting Started Guide](./Dashboard_getting_started/readme.md) | Create a dynamic Dashboard completely from scratch and learn the basics of VFC Dashboarding | :star: | - | @@ -46,8 +44,6 @@ Please note, that the json-files are exported from another tenant. So their migh ### Examples which have to be added: | Name | Description | Complexity Rating | Prerequisites | | --- | --- | --- | --- | -| [IN PROGRESS: Set Flow variables via dashboard](./setFlowVariablesViaDashboard/readme.md) | | :star: | | -| [TODO: Create dashboard for Fleet Manager](./createDashboardForFleetManager/readme.md) | | :star: | | | [TODO: Integrate external API](./integrateExternalApi/readme.md) | | :star: | | | [TODO: Dashboard with dynamic data layer](./dynamicDashboards/readme.md) | | :star: :star: | | @@ -61,10 +57,10 @@ Please note that the screenshots show just the current state, when these example Each flow has to be adapted to your tenant. Ensure, that e.g. fixed tenant names or asset ids are adapted before/after you import the flow. ## Prerequisites -All application examples shown in this repository require the MindSphere Application *Visual Flow Creator (VFC)*. +All application examples shown in this repository require the Insights Hub Application *Visual Flow Creator (VFC)*. To use them, ensure that -- VFC is available in your MindSphere tenant ([VFC in MindSphere Store](https://www.dex.siemens.com/mindsphere/applications/visual-flow-creator)) +- VFC is available in your Insights Hub tenant ([VFC in Insights Hub Store](https://www.dex.siemens.com/mindsphere/applications/visual-flow-creator)) ![image](./MindSphere_Launchpad_VFC.png) - you have *admin* or *user* access to VFC ([VFC user role settings](https://documentation.mindsphere.io/resources/html/visualflow-creator/en-US/108812512779.html)) ![image](./VFC_roles.png) @@ -81,7 +77,7 @@ If you can see Visual Flow Creator on your Launchpad, you're ready to start deve ## Questions and answers -Feel free to ask your questions in the [MindSphere Developer Forum](https://community.sw.siemens.com/s/topic/0TO4O000000MihsWAC). +Feel free to ask your questions in the [Insights Hub Developer Forum](https://community.sw.siemens.com/s/topic/0TO4O000000MihsWAC). Or open an [issue](https://github.com/mindsphere/vfc-examples/issues) if you find a bug in our examples. diff --git a/commandMqttDevice_IoT-Extension/IMPORT_commandMqttDevice_IoTExt.json b/commandMqttDevice_IoT-Extension/IMPORT_commandMqttDevice_IoTExt.json deleted file mode 100644 index 7fb07cc..0000000 --- a/commandMqttDevice_IoT-Extension/IMPORT_commandMqttDevice_IoTExt.json +++ /dev/null @@ -1,87 +0,0 @@ -[ - { - "id": "3ddaa4f0.f2cefc", - "type": "comment", - "z": "216044f1.bc512c", - "name": "Bi-Directional Communication to MQTT devices", - "info": "- send commands to devices connected via IoT Extension MQTT Broker\n- adjust payload with device-ID and message body dynamically in VFC \n- all parameters (deviceID, message, ...) currently hardcoded \n- authentication for IoT Extension Broker is set in http request node", - "sticky": 1, - "x": 520, - "y": 760, - "wires": [] - }, - { - "id": "b8016fbd.6144d", - "type": "debug", - "z": "216044f1.bc512c", - "name": "debug", - "active": true, - "console": "false", - "xaxis": "_time", - "complete": "payload", - "x": 1150, - "y": 860, - "wires": [] - }, - { - "id": "9c8b7033.0568", - "type": "function", - "z": "216044f1.bc512c", - "name": "DeviceID and Command", - "func": "var deviceID = \"67342472\";\nvar command = \"my command from Visual Flow Creator\"\nvar description = \"Shell command received from MindSphere VFC\"\n\n\nmsg.payload = {\n \"deviceId\" : deviceID,\n \"c8y_Command\": {\n \"text\": command\n },\n \"description\": description\n}\n\nreturn msg;", - "outputs": 1, - "noerr": 0, - "x": 590, - "y": 860, - "wires": [ - [ - "2c6ac212.95352e" - ] - ] - }, - { - "id": "2c6ac212.95352e", - "type": "http request", - "z": "216044f1.bc512c", - "name": "send command to IoT Extension", - "method": "POST", - "ret": "txt", - "url": "http://myTenantName.mciotextension.eu-central.mindsphere.io/devicecontrol/operations/", - "timeout": "", - "mindspherePath": "", - "useMindsphereAuth": false, - "isAdmin": false, - "secretHeaders": "", - "x": 890, - "y": 860, - "wires": [ - [ - "b8016fbd.6144d" - ] - ], - "_type": "node" - }, - { - "id": "8c4cd279.ce237", - "type": "inject", - "z": "216044f1.bc512c", - "name": "", - "topic": "", - "payload": "", - "payloadType": "date", - "repeat": "", - "crontab": "", - "once": false, - "properties": "", - "timezone": "utc", - "betweentimesunit": "m", - "enableRuleEngine": false, - "x": 340, - "y": 860, - "wires": [ - [ - "9c8b7033.0568" - ] - ] - } -] \ No newline at end of file diff --git a/commandMqttDevice_IoT-Extension/doc/VFC_setup_device_command.png b/commandMqttDevice_IoT-Extension/doc/VFC_setup_device_command.png deleted file mode 100644 index bcd9e24..0000000 Binary files a/commandMqttDevice_IoT-Extension/doc/VFC_setup_device_command.png and /dev/null differ diff --git a/commandMqttDevice_IoT-Extension/doc/VFC_setup_http_request.png b/commandMqttDevice_IoT-Extension/doc/VFC_setup_http_request.png deleted file mode 100644 index 16b6aba..0000000 Binary files a/commandMqttDevice_IoT-Extension/doc/VFC_setup_http_request.png and /dev/null differ diff --git a/commandMqttDevice_IoT-Extension/doc/activate_receiving operations_MQTT_device.png b/commandMqttDevice_IoT-Extension/doc/activate_receiving operations_MQTT_device.png deleted file mode 100644 index fd183db..0000000 Binary files a/commandMqttDevice_IoT-Extension/doc/activate_receiving operations_MQTT_device.png and /dev/null differ diff --git a/commandMqttDevice_IoT-Extension/doc/commandMqttDevice.png b/commandMqttDevice_IoT-Extension/doc/commandMqttDevice.png deleted file mode 100644 index aecd61a..0000000 Binary files a/commandMqttDevice_IoT-Extension/doc/commandMqttDevice.png and /dev/null differ diff --git a/commandMqttDevice_IoT-Extension/doc/create_MQTT_device.png b/commandMqttDevice_IoT-Extension/doc/create_MQTT_device.png deleted file mode 100644 index f482d03..0000000 Binary files a/commandMqttDevice_IoT-Extension/doc/create_MQTT_device.png and /dev/null differ diff --git a/commandMqttDevice_IoT-Extension/doc/receive_command.png b/commandMqttDevice_IoT-Extension/doc/receive_command.png deleted file mode 100644 index 9895e08..0000000 Binary files a/commandMqttDevice_IoT-Extension/doc/receive_command.png and /dev/null differ diff --git a/commandMqttDevice_IoT-Extension/doc/receive_command_IoTExt.png b/commandMqttDevice_IoT-Extension/doc/receive_command_IoTExt.png deleted file mode 100644 index dc41e06..0000000 Binary files a/commandMqttDevice_IoT-Extension/doc/receive_command_IoTExt.png and /dev/null differ diff --git a/commandMqttDevice_IoT-Extension/readme.md b/commandMqttDevice_IoT-Extension/readme.md deleted file mode 100644 index 1f599b4..0000000 --- a/commandMqttDevice_IoT-Extension/readme.md +++ /dev/null @@ -1,60 +0,0 @@ -# Command device via MQTT - -This flow demonstrates how you can use Visual Flow Creator to trigger sending of a command to a device connected to MindSphere via IoT Extension and MQTT protocol. -Every time the flow is triggered, the command specified in the payload is send to the device linked using the device-ID. - -![image](./doc/commandMqttDevice.png) - -## Prerequisites -- Access to Visual Flow Creator -- Access to IoT Extension - -## Setup & Configuration - -### Setup in IoT Extension -1. Create a device account to be used from IoT Extensions manually ([see Manage users](https://documentation.mindsphere.io/resources/html/mindconnect-iot-extension/en-US/120385099019.html)) or via the [Device Integration](https://cumulocity.com/guides/device-sdk/rest/#device-integration) process for automatically obtained device credentials. Note that you will need this credentials later in VFC as well. -2. Connect to IoT Extension via your MQTT client of choice. The detailed process is described [here](https://developer.mindsphere.io/howto/howto-mqtt-mciot.html) -3. Follow the process to [create your MQTT device](https://cumulocity.com/guides/device-sdk/mqtt-examples/#hello-mqtt) by sending ```100,My first MQTT device,MqttDeviceType``` to ```s/us``` topic. Once you can see the device showing up in your device list, you're ready for the next step. - ![image](./doc/create_MQTT_device.png) -4. Enable [receiving operations](https://cumulocity.com/guides/device-sdk/mqtt-examples/#receiving-operations) for the device by sending the following payload ```114,c8y_Command,c8y_Configuration``` to ```s/us```. In your device view, you should then see the *Shell* option to show up after reloading the website. - ![image](./doc/activate_receiving%20operations_MQTT_device.png) -5. Subscribe to ```s/ds``` topic on the device to see the commands send -6. Test the device setup by sending a command through the IoT Extension UI in the *Shell* window. Onc you receive the command on the device send from the browser, you're ready to automate this via VFC in the next step. - -### Setup in Visual Flow Creator -1. Import the flow in Visual Flow Creator -2. Adjust the payload body in the function node - - specify ```deviceID``` as seen in IoT Extension overview page - - set the ```command``` you want to send to the device - ![image](./doc/VFC_setup_device_command.png) -3. In the *http request* node - - change the URL to your tenant name - - enable basic authentication - - use the device credentials you used earlier to also connect the device to MindSphere - ![image](./doc/VFC_setup_http_request.png) -4. Save the flow - -:cloud: :heavy_check_mark: You're ready to command a device once the flow is triggered - enjoy! - - -## Result -Once the flow is executed, the device will receive on ```s/ds``` topic the command as specified in the VFC flow. -Follow the device logic to now acknowledge this command and use it for your application nees further on the device. -**Device-View** -![image](./doc/receive_command.png) -**Platform-View** -![image](./doc/receive_command_IoTExt.png) - -## See also -- [Integrate an MQTT Device via IoT Extension](https://developer.mindsphere.io/howto/howto-mqtt-mciot.html) -- [Device Control for IoT Extension](https://cumulocity.com/guides/reference/device-control/) -- [GitHub: Cumulocity MQTT client examples](https://github.com/SoftwareAG/c8y_hw_mqtt) -- [:shopping_cart: MindSphere Store: Visual Flow Creator](https://www.dex.siemens.com/mindsphere/applications/visual-flow-creator?viewState=DetailView&cartID=&portalUser=&store=&cclcl=en_US) -- [:shopping_cart: MindSphere Store: IoT Extension](https://mindsphere.io/store) - - - - - - - diff --git a/commandMqttDevice_MindConnect/IMPORT_commandMqttDevice_MindConnect.json b/commandMqttDevice_MindConnect/IMPORT_commandMqttDevice_MindConnect.json index cd848d5..3b92944 100644 --- a/commandMqttDevice_MindConnect/IMPORT_commandMqttDevice_MindConnect.json +++ b/commandMqttDevice_MindConnect/IMPORT_commandMqttDevice_MindConnect.json @@ -6,67 +6,80 @@ "name": "MindConnect MQTT - commading of a device", "info": "- sends a command to a device which is connected via MindConnect MQTT", "sticky": 1, - "x": 360, - "y": 1720, - "wires": [], - "readOnly": false, - "userName": "CloudFoxUser", - "tenant": "presiot" + "x": 320, + "y": 1920, + "wires": [] + }, + { + "id": "daff595.58e3ea8", + "type": "group", + "z": "cba45765.fb58c8", + "name": "manual setup of the API call for commanding // not recommended", + "style": { + "label": true + }, + "nodes": [ + "5d4d2d1e.1be5f4", + "6dadce05.535e5", + "100131f0.458a6e", + "21c0aab9.b71656", + "8bd21774.9b5778" + ], + "x": 55, + "y": 2161, + "w": 1010, + "h": 159 }, { "id": "5d4d2d1e.1be5f4", "type": "comment", "z": "cba45765.fb58c8", + "g": "daff595.58e3ea8", "name": "adjust here:", "info": "- MQTT clientID(s)\n- commanding payload (data) for device", "sticky": 1, - "x": 460, - "y": 1820, - "wires": [], - "readOnly": false, - "userName": "CloudFoxUser", - "tenant": "presiot" + "x": 440, + "y": 2220, + "wires": [] }, { "id": "6dadce05.535e5", "type": "debug", "z": "cba45765.fb58c8", + "g": "daff595.58e3ea8", "name": "", "active": true, "console": "false", "xaxis": "_time", "complete": "payload", - "x": 970, - "y": 1880, - "wires": [], - "readOnly": false, - "userName": "CloudFoxUser", - "tenant": "presiot" + "x": 950, + "y": 2280, + "wires": [] }, { "id": "100131f0.458a6e", "type": "function", "z": "cba45765.fb58c8", + "g": "daff595.58e3ea8", "name": "edit clientID and data", "func": "/**in the body of the request, specify \n - clientID(s) which should received the command. Can be one or multiple clients\n - in the 'data' section, specify the command-payload to be send to the device. \n This will be received on the device at the command-subscription topic. \n \nExample: \n- tenant: presiot\n- device name: CloudFox-Laptop\n- clientID: presiot_CloudFox-Laptop\n- commanding topic: tc/presiot/presiot_CloudFox-Laptop/i/cmd_v3/c\n\n**/\nvar name = \"a commanding information for my device\";\nvar clientIDs = [\"presiot_CloudFox-Laptop\"]; \nvar commandingData = {\n \"configuration\": \"sample config v1.4.3\",\n \"data\": \"hello world\",\n \"INTvalue\": 5,\n \"light-status\": true,\n \"motor_rpm_setpoint\": 1200.5\n }\n\n//setup body for commanding request\nmsg.payload = {\n \"name\": name,\n \"clientIds\": clientIDs,\n \"data\": commandingData\n}\nreturn msg;", "outputs": 1, "language": "javascript", "noerr": 0, - "x": 400, - "y": 1880, + "x": 380, + "y": 2280, "wires": [ [ "21c0aab9.b71656" ] ], - "readOnly": false, - "userName": "CloudFoxUser", - "tenant": "presiot" + "_type": "node" }, { "id": "21c0aab9.b71656", "type": "http request", "z": "cba45765.fb58c8", + "g": "daff595.58e3ea8", "name": "command to device", "method": "POST", "ret": "txt", @@ -75,23 +88,20 @@ "mindspherePath": "/api/commanding/v3/deliveryJobs", "useMindsphereAuth": true, "isAdmin": false, - "userSecrets": "", "secretHeaders": "", - "x": 770, - "y": 1880, + "x": 686, + "y": 2280, "wires": [ [ "6dadce05.535e5" ] - ], - "readOnly": false, - "userName": "CloudFoxUser", - "tenant": "presiot" + ] }, { "id": "8bd21774.9b5778", "type": "inject", "z": "cba45765.fb58c8", + "g": "daff595.58e3ea8", "name": "", "topic": "", "payload": "", @@ -105,18 +115,142 @@ "properties": "", "timezone": "utc", "betweentimesunit": "m", - "enableRuleEngine": false, "showNextExecution": false, "powerMode": false, - "x": 180, - "y": 1880, + "x": 160, + "y": 2280, "wires": [ [ "100131f0.458a6e" ] + ] + }, + { + "id": "21c0892b.577e66", + "type": "group", + "z": "cba45765.fb58c8", + "name": "Commanding MindConnect MQTT Agents", + "style": { + "stroke": "#92d04f", + "label": true, + "color": "#92d04f" + }, + "nodes": [ + "ab1fc976.a28a08", + "db2569e5.5bdc58", + "1e8fa7.7bd4f05a", + "1d379f8d.7f5c1", + "ff1099c4.d74328", + "3e55db85.3ac6c4" + ], + "x": 55, + "y": 1971, + "w": 1010, + "h": 149 + }, + { + "id": "ab1fc976.a28a08", + "type": "command mindconnect", + "z": "cba45765.fb58c8", + "g": "21c0892b.577e66", + "name": "", + "mindconnectMqttId": "", + "mindconnectTopic": "", + "mindconnectTopicData": "", + "x": 670, + "y": 2080, + "wires": [ + [ + "1d379f8d.7f5c1" + ] ], - "readOnly": false, - "userName": "CloudFoxUser", - "tenant": "presiot" + "_type": "node" + }, + { + "id": "db2569e5.5bdc58", + "type": "function", + "z": "cba45765.fb58c8", + "g": "21c0892b.577e66", + "name": "edit data", + "func": "/**in the body of the request, specify \n - in the 'data' section, specify the command-payload to be send to the device. \n This will be received on the device at the command-subscription topic. \n \n**/\n\nvar commandingData = {\n \"configuration\": \"sample config v1.4.3\",\n \"data\": \"hello world\",\n \"INTvalue\": 5,\n \"light-status\": true,\n \"motor_rpm_setpoint\": 1200.5\n }\n\n//setup body for commanding request\nmsg.payload = commandingData;\n\nreturn msg;", + "outputs": 1, + "language": "javascript", + "noerr": 0, + "x": 320, + "y": 2080, + "wires": [ + [ + "ab1fc976.a28a08" + ] + ], + "_type": "node" + }, + { + "id": "1e8fa7.7bd4f05a", + "type": "inject", + "z": "cba45765.fb58c8", + "g": "21c0892b.577e66", + "name": "", + "topic": "", + "payload": "", + "payloadType": "date", + "repeat": "", + "repeatEnd": "0", + "endTime": "0", + "crontab": "", + "offset": "NaN", + "once": false, + "properties": "", + "timezone": "utc", + "betweentimesunit": "m", + "showNextExecution": false, + "powerMode": false, + "x": 160, + "y": 2080, + "wires": [ + [ + "db2569e5.5bdc58" + ] + ] + }, + { + "id": "1d379f8d.7f5c1", + "type": "debug", + "z": "cba45765.fb58c8", + "g": "21c0892b.577e66", + "name": "", + "active": true, + "console": "false", + "xaxis": "_time", + "complete": "payload", + "x": 950, + "y": 2080, + "wires": [] + }, + { + "id": "ff1099c4.d74328", + "type": "comment", + "z": "cba45765.fb58c8", + "g": "21c0892b.577e66", + "name": "adjust here:", + "info": "- commanding data) for device", + "sticky": 1, + "x": 370, + "y": 2020, + "wires": [], + "_type": "node" + }, + { + "id": "3e55db85.3ac6c4", + "type": "comment", + "z": "cba45765.fb58c8", + "g": "21c0892b.577e66", + "name": "adjust here:", + "info": "- select device(s)", + "sticky": 1, + "x": 650, + "y": 2020, + "wires": [], + "_type": "node" } ] \ No newline at end of file diff --git a/commandMqttDevice_MindConnect/doc/commandMqttDevice_MC.png b/commandMqttDevice_MindConnect/doc/commandMqttDevice_MC.png index ef03fd1..43eca51 100644 Binary files a/commandMqttDevice_MindConnect/doc/commandMqttDevice_MC.png and b/commandMqttDevice_MindConnect/doc/commandMqttDevice_MC.png differ diff --git a/commandMqttDevice_MindConnect/readme.md b/commandMqttDevice_MindConnect/readme.md index 768fcf0..8121ce3 100644 --- a/commandMqttDevice_MindConnect/readme.md +++ b/commandMqttDevice_MindConnect/readme.md @@ -1,27 +1,37 @@ # Command device via MindConnect MQTT -This flow demonstrates how you can use Visual Flow Creator to trigger sending of a command to a device connected to MindSphere via [MindConnect MQTT](https://documentation.mindsphere.io/MindSphere/howto/howto-mindconnectmqtt-commanding.html) protocol. +This flow demonstrates how you can use Visual Flow Creator to trigger sending of a command to a device connected to Insights Hub via [MindConnect MQTT](https://documentation.mindsphere.io/MindSphere/howto/howto-mindconnectmqtt-commanding.html) protocol. Every time the flow is triggered, the command specified in the payload is send to the device linked using the client-ID of the connect MQTT client. ![image](./doc/commandMqttDevice_MC.png) ## Prerequisites - Access to Visual Flow Creator -- a device connected to MindSphere via MindConnect MQTT +- a device connected to Insights Hub via MindConnect MQTT ## Setup & Configuration ### Setup your MQTT device -Creation and connection of a device via MindConnect MQTT is not further described in this document. The core element to do so, are to be found on the MindSphere Developer Website. +Creation and connection of a device via MindConnect MQTT is not further described in this document. The core element to do so, are to be found on the Insights Hub Developer Website. In order to use this feature, make sure you have successfully completed step 1 - 3. 1) [Onboarding MindConnect MQTT Agent](https://documentation.mindsphere.io/MindSphere/howto/howto-onboard-mindconnect-mqtt.html) 2) [Creating Data Model from MQTT Agent](https://documentation.mindsphere.io/MindSphere/howto/howto-create-data-model-mqtt-agent.html) 3) [Sending Data from MindConnect MQTT Agent](https://documentation.mindsphere.io/MindSphere/howto/howto-send-data-from-mqtt-agent.html) ### Usage of commanding -Once your device is connected to MindSphere, you can start using the [MindConnect MQTT Commanding](https://documentation.mindsphere.io/MindSphere/howto/howto-mindconnectmqtt-commanding.html) feature. +Once your device is connected to Insights Hub, you can start using the [MindConnect MQTT Commanding](https://documentation.mindsphere.io/MindSphere/howto/howto-mindconnectmqtt-commanding.html) feature. Commanding can be initiated via a dedicated API. Here we will use VFC to initiate the API call and request the commanding. ### Setup in Visual Flow Creator + +#### Using standard nodes for "MindConnect" +A dedicated commanding node was added to the standard nodes of Visual Flow Creator. +https://documentation.mindsphere.io/MindSphere/apps/visual-flow-creator/mindconnect-nodes.html#command-mindconnect + +Manual confuguration towards the API endpoint for commanding is no longer needed but still shown in depth in the description below. +With "MindConnect" nodes, you can send a command to MindConnect MQTT device and check the status of the sent command. For more information about MindConnect Elements, refer to [Connectivity](https://documentation.mindsphere.io/MindSphere/connectivity/overview.html). + + +#### Manually setting up the API call 1. Import the flow in Visual Flow Creator 2. Adjust the payload body in the function node - ```name``` defines an internal name for the job to be send to the devices. @@ -66,8 +76,8 @@ The following is received at the device on the subscribed topic, given the follo ![image](./doc/receive_command_MC.png) ## See also -- [MindSphere MindConnect MQTT Broker - API specs](https://documentation.mindsphere.io/MindSphere/concepts/concept-mindsphere-mqtt-broker.html) -- [MindSphere MindConnect MQTT Broker - How To section](https://documentation.mindsphere.io/MindSphere/concepts/concept-mindsphere-mqtt-broker.html) +- [Insights Hub MindConnect MQTT Broker - API specs](https://documentation.mindsphere.io/MindSphere/concepts/concept-mindsphere-mqtt-broker.html) +- [Insights Hub MindConnect MQTT Broker - How To section](https://documentation.mindsphere.io/MindSphere/concepts/concept-mindsphere-mqtt-broker.html) diff --git a/createCustomEndpoint/readme.md b/createCustomEndpoint/readme.md index da2b79d..e9b4f0b 100644 --- a/createCustomEndpoint/readme.md +++ b/createCustomEndpoint/readme.md @@ -1,8 +1,8 @@ # Create a custom API endpoint -If you want to provide some external partners/users with your MindSphere data though a customizable API endpoint, this is how you get started on this. +If you want to provide some external partners/users with your Insights Hub data though a customizable API endpoint, this is how you get started on this. The example shows how you can -- specify a dedicated MindSphere RestAPI endpoint +- specify a dedicated Insights Hub RestAPI endpoint - select the method the endpoint should support (GET, PUT, POST, DELETE) - choose who has access to this endpoint (only users of the flow, all users on the tenant, public access) - develop the API functionality using VFC nodes diff --git a/createRuleForAssetType/readme.md b/createRuleForAssetType/readme.md index a71c60a..3e14ef2 100644 --- a/createRuleForAssetType/readme.md +++ b/createRuleForAssetType/readme.md @@ -16,4 +16,4 @@ You might created a flow where you monitor a single variable for a defined condi - the flow is triggered by the inject node - with the `asset type` node VFC will get all assets of a specific type and perform the action for all assets of this type - you can also disable specific assets, that they are not used -- for all of this assets a rule is checked and an email can be sent or a MindSphere event can be created +- for all of this assets a rule is checked and an email can be sent or a Insights Hub event can be created diff --git a/setFlowVariablesViaDashboard/doc/example.png b/setFlowVariablesViaDashboard/doc/example.png deleted file mode 100644 index 64a7465..0000000 Binary files a/setFlowVariablesViaDashboard/doc/example.png and /dev/null differ diff --git a/setFlowVariablesViaDashboard/readme.md b/setFlowVariablesViaDashboard/readme.md deleted file mode 100644 index c19f3aa..0000000 --- a/setFlowVariablesViaDashboard/readme.md +++ /dev/null @@ -1,33 +0,0 @@ -# HEADING for vfc-application example - - - - - - -## Prerequisites - - -## Setup & Configuration - - -1. Import the flow in Visual Flow Creator -2. ... - -3. Save the flow - -:cloud: :heavy_check_mark: You're ready ... - enjoy! - - -## How does this flow works - - -## Result - - -## See also - - - - - diff --git a/setFlowVariablesViaDashboard/setFlowVariablesViaDashboard.json b/setFlowVariablesViaDashboard/setFlowVariablesViaDashboard.json deleted file mode 100644 index f8fe691..0000000 --- a/setFlowVariablesViaDashboard/setFlowVariablesViaDashboard.json +++ /dev/null @@ -1,4 +0,0 @@ -// insert your exported json here -// ensure that it does not contain any private data like -// - e-mail addresses -// - tenant or asset names \ No newline at end of file diff --git a/trendPredictionAPI/IMPORT_trendPredictionAPI.json b/trendPredictionAPI/IMPORT_trendPredictionAPI.json deleted file mode 100644 index 88d2d49..0000000 --- a/trendPredictionAPI/IMPORT_trendPredictionAPI.json +++ /dev/null @@ -1,606 +0,0 @@ -[ - { - "id": "cea5ffeb.d1862", - "type": "tab", - "allowCycles": false, - "label": "Predictive Maintenance", - "disabled": false, - "info": "tim.pennington@siemens.com" - }, - { - "id": "a9d9b8ee.5541f8", - "type": "change", - "z": "cea5ffeb.d1862", - "name": "polynomialDegree -> 1", - "rules": [ - { - "t": "change", - "p": "payload.modelConfiguration.polynomialDegree", - "pt": "msg", - "from": "0", - "fromt": "num", - "to": "1", - "tot": "num" - } - ], - "action": "", - "property": "", - "from": "", - "to": "", - "reg": false, - "x": 740, - "y": 220, - "wires": [ - [ - "d35cdda7.8bbf5", - "8506a16a.29b7" - ] - ] - }, - { - "id": "68180cab.24d4d4", - "type": "change", - "z": "cea5ffeb.d1862", - "name": "polynomialDegree -> 2", - "rules": [ - { - "t": "change", - "p": "payload.modelConfiguration.polynomialDegree", - "pt": "msg", - "from": "0", - "fromt": "num", - "to": "2", - "tot": "num" - } - ], - "action": "", - "property": "", - "from": "", - "to": "", - "reg": false, - "x": 740, - "y": 260, - "wires": [ - [ - "c31350f6.885be" - ] - ] - }, - { - "id": "4ea16595.25867c", - "type": "change", - "z": "cea5ffeb.d1862", - "name": "polynomialDegree -> 3", - "rules": [ - { - "t": "change", - "p": "payload.modelConfiguration.polynomialDegree", - "pt": "msg", - "from": "0", - "fromt": "num", - "to": "3", - "tot": "num" - } - ], - "action": "", - "property": "", - "from": "", - "to": "", - "reg": false, - "x": 740, - "y": 300, - "wires": [ - [ - "ae785994.d325f8" - ] - ] - }, - { - "id": "ae61d2b7.31639", - "type": "change", - "z": "cea5ffeb.d1862", - "name": "polynomialDegree -> 4", - "rules": [ - { - "t": "change", - "p": "payload.modelConfiguration.polynomialDegree", - "pt": "msg", - "from": "0", - "fromt": "num", - "to": "4", - "tot": "num" - } - ], - "action": "", - "property": "", - "from": "", - "to": "", - "reg": false, - "x": 740, - "y": 340, - "wires": [ - [ - "edba801.b76ed8" - ] - ] - }, - { - "id": "3a7a9fd6.0f93e", - "type": "debug", - "z": "cea5ffeb.d1862", - "name": "", - "active": false, - "console": "false", - "xaxis": "_time", - "complete": "false", - "x": 150, - "y": 240, - "wires": [] - }, - { - "id": "6f4e9962.ddab78", - "type": "debug", - "z": "cea5ffeb.d1862", - "name": "", - "active": true, - "console": "false", - "xaxis": "_time", - "complete": "false", - "x": 380, - "y": 80, - "wires": [] - }, - { - "id": "8506a16a.29b7", - "type": "debug", - "z": "cea5ffeb.d1862", - "name": "", - "active": true, - "console": "false", - "xaxis": "_time", - "complete": "false", - "x": 950, - "y": 180, - "wires": [] - }, - { - "id": "4fd5ea68.174d24", - "type": "delay", - "z": "cea5ffeb.d1862", - "name": "", - "pauseType": "delay", - "timeout": "5", - "timeoutUnits": "seconds", - "rate": "1", - "nbRateUnits": "1", - "rateUnits": "second", - "randomFirst": "1", - "randomLast": "5", - "randomUnits": "seconds", - "drop": false, - "powerMode": false, - "x": 700, - "y": 80, - "wires": [ - [ - "6c9d28cd.0561d8" - ] - ] - }, - { - "id": "c336e536.712d28", - "type": "function", - "z": "cea5ffeb.d1862", - "name": "polynomialDegree 0", - "func": "// 30 minute forecast prediction...\nvar prediction_datetime = new Date(new Date().getTime() + flow.get(\"PredictionOffsetMins\") * 60000) || 1800000;\nvar timeseries = msg.payload;\nflow.set(\"PredictionDateTime\", prediction_datetime.toISOString());\n\nmsg.payload = {\n\t\"modelConfiguration\": {\n\t\t\"polynomialDegree\": 0\n\t},\n\t\"metadataConfiguration\": {\n\t\t\"outputVariable\": {\n\t\t\t\"entityId\": 66,\n\t\t\t\"propertySetName\": \"Temperature\",\n\t\t\t\"propertyName\": \"Temperature\"\n\t\t},\n\t\t\"inputVariables\": [\n\t\t\t{\n\t\t\t\t\"entityId\": 66,\n\t\t\t\t\"propertySetName\": \"Temperature\",\n\t\t\t\t\"propertyName\": \"_time\"\n\t\t\t}\n\t\t]\n\t},\n\t\"trainingData\": [\n\t\t{\n\t\t\t\"variable\": {\n\t\t\t\t\"entityId\": \"66\",\n\t\t\t\t\"propertySetName\": \"Temperature\"\n\t\t\t},\n\t\t\t\"timeSeries\": timeseries\n\t\t}\n\t],\n\t\"predictionData\": [\n\t\t{\n\t\t\t\"variable\": {\n\t\t\t\t\"entityId\": \"66\",\n\t\t\t\t\"propertySetName\": \"Temperature\"\n\t\t\t},\n\t\t\t\"timeSeries\": [\n\t\t\t\t{\n\t\t\t\t\t\"_time\": prediction_datetime\n\t\t\t\t}\n\t\t\t]\n\t\t}\n\t]\n}\n\nconsole.log(timeseries);\nreturn msg;\n", - "outputs": 1, - "language": "javascript", - "noerr": 0, - "x": 740, - "y": 160, - "wires": [ - [ - "a9d9b8ee.5541f8", - "68180cab.24d4d4", - "4ea16595.25867c", - "ae61d2b7.31639" - ] - ], - "_type": "node" - }, - { - "id": "e682a016.4c575", - "type": "function", - "z": "cea5ffeb.d1862", - "name": "Temp_P1", - "func": "var timeseries = msg.payload[0].timeSeries;\n\nmsg.payload = {};\nmsg.payload = timeseries;\nmsg.payload[0].Temperature_P1 = msg.payload[0].Temperature;\nmsg.payload[0]._time = flow.get(\"PredictionDateTime\");\ndelete msg.payload[0].Temperature;\nreturn msg;\n", - "outputs": 1, - "language": "javascript", - "noerr": 0, - "x": 1120, - "y": 220, - "wires": [ - [ - "e7acd37e.3bb8e" - ] - ] - }, - { - "id": "5481b4dd.26d8ec", - "type": "function", - "z": "cea5ffeb.d1862", - "name": "Temp_P2", - "func": "var timeseries = msg.payload[0].timeSeries;\n\nmsg.payload = {};\nmsg.payload = timeseries;\nmsg.payload[0].Temperature_P2 = msg.payload[0].Temperature;\nmsg.payload[0]._time = flow.get(\"PredictionDateTime\");\ndelete msg.payload[0].Temperature;\nreturn msg;\n", - "outputs": 1, - "language": "javascript", - "noerr": 0, - "x": 1120, - "y": 260, - "wires": [ - [ - "852fafba.dfae8" - ] - ] - }, - { - "id": "7300f4f.501870c", - "type": "function", - "z": "cea5ffeb.d1862", - "name": "Temp_P3", - "func": "var timeseries = msg.payload[0].timeSeries;\n\nmsg.payload = {};\nmsg.payload = timeseries;\nmsg.payload[0].Temperature_P3 = msg.payload[0].Temperature;\nmsg.payload[0]._time = flow.get(\"PredictionDateTime\");\ndelete msg.payload[0].Temperature;\nreturn msg;\n", - "outputs": 1, - "language": "javascript", - "noerr": 0, - "x": 1120, - "y": 300, - "wires": [ - [ - "a06d434.1cda3c" - ] - ] - }, - { - "id": "80c3d42.7903928", - "type": "function", - "z": "cea5ffeb.d1862", - "name": "Temp_P4", - "func": "var timeseries = msg.payload[0].timeSeries;\n\nmsg.payload = {};\nmsg.payload = timeseries;\nmsg.payload[0].Temperature_P4 = msg.payload[0].Temperature;\nmsg.payload[0]._time = flow.get(\"PredictionDateTime\");\ndelete msg.payload[0].Temperature;\nreturn msg;\n", - "outputs": 1, - "language": "javascript", - "noerr": 0, - "x": 1120, - "y": 340, - "wires": [ - [ - "56cbc97b.1960d8" - ] - ] - }, - { - "id": "498a2ab6.a17fe4", - "type": "function", - "z": "cea5ffeb.d1862", - "name": "Set Payload", - "func": "var temp = msg.payload.main.temp;\nvar pressure = msg.payload.main.pressure;\nvar humidity = msg.payload.main.humidity;\nmsg.payload = \n{\n \"Temperature\": temp,\n \"Pressure\": pressure,\n \"Humidity\": humidity,\n};\n\nreturn msg;", - "outputs": 1, - "language": "javascript", - "noerr": 0, - "x": 150, - "y": 160, - "wires": [ - [ - "bfb97ee2.f66b3", - "3a7a9fd6.0f93e", - "4fd5ea68.174d24" - ] - ], - "_type": "node" - }, - { - "id": "3aebe78.7c3b518", - "type": "http request", - "z": "cea5ffeb.d1862", - "name": "Call Weather API", - "method": "GET", - "ret": "obj", - "url": "https://api.openweathermap.org/data/2.5/weather?q=London&appid={{APPID}}&units=metric", - "timeout": "", - "mindspherePath": "", - "useMindsphereAuth": false, - "isAdmin": false, - "secretHeaders": "[]", - "x": 160, - "y": 120, - "wires": [ - [ - "6f4e9962.ddab78", - "498a2ab6.a17fe4" - ] - ], - "_type": "node" - }, - { - "id": "d35cdda7.8bbf5", - "type": "http request", - "z": "cea5ffeb.d1862", - "name": "", - "method": "POST", - "ret": "obj", - "url": "", - "timeout": "", - "mindspherePath": "/api/trendprediction/v3/trainAndPredict", - "useMindsphereAuth": true, - "isAdmin": false, - "secretHeaders": "", - "x": 950, - "y": 220, - "wires": [ - [ - "e682a016.4c575" - ] - ], - "_type": "node" - }, - { - "id": "c31350f6.885be", - "type": "http request", - "z": "cea5ffeb.d1862", - "name": "", - "method": "POST", - "ret": "obj", - "url": "", - "timeout": "", - "mindspherePath": "/api/trendprediction/v3/trainAndPredict", - "useMindsphereAuth": true, - "isAdmin": false, - "secretHeaders": "", - "x": 950, - "y": 260, - "wires": [ - [ - "5481b4dd.26d8ec" - ] - ] - }, - { - "id": "ae785994.d325f8", - "type": "http request", - "z": "cea5ffeb.d1862", - "name": "", - "method": "POST", - "ret": "obj", - "url": "", - "timeout": "", - "mindspherePath": "/api/trendprediction/v3/trainAndPredict", - "useMindsphereAuth": true, - "isAdmin": false, - "x": 950, - "y": 300, - "wires": [ - [ - "7300f4f.501870c" - ] - ] - }, - { - "id": "edba801.b76ed8", - "type": "http request", - "z": "cea5ffeb.d1862", - "name": "", - "method": "POST", - "ret": "obj", - "url": "", - "timeout": "", - "mindspherePath": "/api/trendprediction/v3/trainAndPredict", - "useMindsphereAuth": true, - "isAdmin": false, - "x": 950, - "y": 340, - "wires": [ - [ - "80c3d42.7903928" - ] - ] - }, - { - "id": "9683a280.4abda", - "type": "inject", - "z": "cea5ffeb.d1862", - "name": "", - "topic": "", - "payload": "", - "payloadType": "date", - "repeat": "300", - "repeatEnd": "0", - "endTime": "0", - "crontab": "", - "offset": "", - "once": false, - "properties": "", - "timezone": "utc", - "betweentimesunit": "m", - "enableRuleEngine": false, - "showNextExecution": false, - "powerMode": false, - "x": 150, - "y": 80, - "wires": [ - [ - "3aebe78.7c3b518" - ] - ], - "_type": "node" - }, - { - "id": "185b2047.166b8", - "type": "inject", - "z": "cea5ffeb.d1862", - "name": "Set Prediction Offset (Minutes)", - "topic": "", - "payload": "30", - "payloadType": "num", - "repeat": "", - "repeatEnd": "0", - "endTime": "0", - "crontab": "", - "offset": "NaN", - "once": false, - "properties": "", - "timezone": "utc", - "betweentimesunit": "m", - "enableRuleEngine": false, - "showNextExecution": false, - "powerMode": false, - "x": 200, - "y": 460, - "wires": [ - [ - "e6d378b9.7512a8" - ] - ], - "_type": "node" - }, - { - "id": "6c9d28cd.0561d8", - "type": "read timeseries", - "z": "cea5ffeb.d1862", - "name": "Read Actual Temperature", - "topic": "15faa3704aab4069b867c948876ce38d/TJP_GenericAspect/Temperature", - "topicLabel": "", - "assetName": "PREDICTIVE_MAINT_TEST", - "period": "120", - "offset": "0", - "mode": "relative", - "from": "", - "datetimepickerFrom": "", - "to": "", - "datetimepickerTo": "", - "timezoneoffset": 0, - "x": 750, - "y": 120, - "wires": [ - [ - "c336e536.712d28" - ] - ], - "_type": "node" - }, - { - "id": "e6d378b9.7512a8", - "type": "store-context", - "z": "cea5ffeb.d1862", - "name": "", - "key": "PredictionOffsetMins", - "context": "flow", - "ttl": 15811200, - "x": 170, - "y": 500, - "wires": [] - }, - { - "id": "bfb97ee2.f66b3", - "type": "write timeseries", - "z": "cea5ffeb.d1862", - "name": "Write Actual Temperature", - "topic": "15faa3704aab4069b867c948876ce38d/TJP_GenericAspect/Temperature", - "topicLabel": "PREDICTIVE_MAINT_TEST/TJP_GenericAspect/Temperature", - "assetName": "PREDICTIVE_MAINT_TEST", - "useMerging": false, - "x": 190, - "y": 200, - "wires": [], - "_type": "node" - }, - { - "id": "e7acd37e.3bb8e", - "type": "write timeseries", - "z": "cea5ffeb.d1862", - "name": "Write Predicted Temperature_P1", - "topic": "15faa3704aab4069b867c948876ce38d/TJP_GenericAspect/Temperature_P1", - "topicLabel": "PREDICTIVE_MAINT_TEST/TJP_GenericAspect/Temperature_P1", - "assetName": "PREDICTIVE_MAINT_TEST", - "useMerging": false, - "x": 1350, - "y": 220, - "wires": [], - "_type": "node" - }, - { - "id": "852fafba.dfae8", - "type": "write timeseries", - "z": "cea5ffeb.d1862", - "name": "Write Predicted Temperature_P2", - "topic": "15faa3704aab4069b867c948876ce38d/TJP_GenericAspect/Temperature_P2", - "topicLabel": "PREDICTIVE_MAINT_TEST/TJP_GenericAspect/Temperature_P2", - "assetName": "PREDICTIVE_MAINT_TEST", - "useMerging": false, - "x": 1350, - "y": 260, - "wires": [], - "_type": "node" - }, - { - "id": "a06d434.1cda3c", - "type": "write timeseries", - "z": "cea5ffeb.d1862", - "name": "Write Predicted Temperature_P3", - "topic": "15faa3704aab4069b867c948876ce38d/TJP_GenericAspect/Temperature_P3", - "topicLabel": "PREDICTIVE_MAINT_TEST/TJP_GenericAspect/Temperature_P3", - "assetName": "PREDICTIVE_MAINT_TEST", - "useMerging": false, - "x": 1350, - "y": 300, - "wires": [], - "_type": "node" - }, - { - "id": "56cbc97b.1960d8", - "type": "write timeseries", - "z": "cea5ffeb.d1862", - "name": "Write Predicted Temperature_P4", - "topic": "15faa3704aab4069b867c948876ce38d/TJP_GenericAspect/Temperature_P4", - "topicLabel": "PREDICTIVE_MAINT_TEST/TJP_GenericAspect/Temperature_P4", - "assetName": "PREDICTIVE_MAINT_TEST", - "useMerging": false, - "x": 1350, - "y": 340, - "wires": [], - "_type": "node" - }, - { - "id": "639153e1.62620c", - "type": "comment", - "z": "cea5ffeb.d1862", - "name": "Get the data", - "info": "- Get weather in London via https://api.openweathermap.org\n- Extract Pressure, Temperature & Flow\n- Write the data to the asset using \"Write Timeseries\" node", - "sticky": 1, - "x": 280, - "y": 320, - "wires": [], - "_type": "node" - }, - { - "id": "71d08dff.912d54", - "type": "comment", - "z": "cea5ffeb.d1862", - "name": "Set Prediction Offset (Minutes)", - "info": "- Enter a value in the inject node to define how far into the future we would like to predict (default = 30 mins)", - "sticky": 1, - "x": 480, - "y": 560, - "wires": [], - "_type": "node" - }, - { - "id": "2c3351a4.ee6e1e", - "type": "comment", - "z": "cea5ffeb.d1862", - "name": "Run MindSphere Trend Prediction API", - "info": "The MindSphere Trend Prediction API (/api/trendprediction/v3/trainAndPredict) is called 4 times...\nEach time with a different polynomial degree parameter (1-4)\nThe trend prediction result is written back to the same asset using the \"Write Timeseries\" node\nIn this example the actual temperature is stored in the \"Temperature\" variable...\nThe 4 predictions are stored in \"Temperature_T1\" -> \"Temperature_T4\"\nFuture predicted values can be seen in Fleet Manager in the same chart as the actual value", - "sticky": 1, - "x": 990, - "y": 440, - "wires": [], - "_type": "node" - } -] \ No newline at end of file diff --git a/trendPredictionAPI/doc/trendPrediction.png b/trendPredictionAPI/doc/trendPrediction.png deleted file mode 100644 index f589fe4..0000000 Binary files a/trendPredictionAPI/doc/trendPrediction.png and /dev/null differ diff --git a/trendPredictionAPI/doc/trendPredictionValues.png b/trendPredictionAPI/doc/trendPredictionValues.png deleted file mode 100644 index 19f45e8..0000000 Binary files a/trendPredictionAPI/doc/trendPredictionValues.png and /dev/null differ diff --git a/trendPredictionAPI/readme.md b/trendPredictionAPI/readme.md deleted file mode 100644 index c223cd3..0000000 --- a/trendPredictionAPI/readme.md +++ /dev/null @@ -1,36 +0,0 @@ -# FLOW: Running MindSphere's Trend Prediction API - -This flow shows how to create a trend prediction from historic time series data. Future predictions can be used to trigger rules and create events (info/warning/error) in Fleet Manager/Operations Insights etc. This is a very useful application within a Predictive Maintenance use case. - -![image](./doc/trendPrediction.png) - -## Prerequisites -- Access to Visual Flow Creator -- An asset to read/write time series data from/to -- OpenWeathermap free account - -## Setup & Configuration - -1. Import the flow in Visual Flow Creator -2. Select the same asset for the following nodes: - -"Write Actual Temperature" - -"Read Actual Temperature" - -"Write Predicted Temperature_P1 -> P4" -3. Create an OpenWeathermap API Key https://home.openweathermap.org/api_keys, and copy it into the "User Secrets" table in "Call Weather API", against the APPID secret. -3. Save the flow - -:cloud: :heavy_check_mark: You're ready ... - enjoy! - -## How does this flow works -The weather data (actual temperature) and predictions (predicted temperature) are written to an asset. In this example the actual temperature is stored in the "Temperature" variable... -The 4 predictions are stored in "Temperature_T1" -> "Temperature_T4" - -## Result -Future predicted and actual values can be seen in MindSphere in various apps (Fleet Manager/Operations Insights etc.). In the screenshot below you can see actual temperature (Temperature) and predicted temperature (Temperature_P1) - -![image](./doc/trendPredictionValues.png) - -## See also -- [:shopping_cart: MindSphere Store: Visual Flow Creator](https://www.dex.siemens.com/mindsphere/applications/visual-flow-creator?viewState=DetailView&cartID=&portalUser=&store=&cclcl=en_US) - -