Skip to content

Commit f8f519a

Browse files
authored
Merge pull request #1 from industrial-edge/dev-updateto1.1 into main
Update app example to 1.1.0 and align with IE 1.1
2 parents 2442442 + 2b78e23 commit f8f519a

15 files changed

Lines changed: 312 additions & 165 deletions

README.md

Lines changed: 29 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
11
# Ping Pong Edge application implemented in Python
22

3-
Application example how to communicate over MQTT broker (called Databus in case of Industrial Edge) using IE Flow Creator ([NodeRED fork](https://nodered.org/)) and Python.
3+
Application example how to communicate over MQTT broker (called Databus in case of Industrial Edge) using IE Flow Creator and Python.
44

55
- [Ping Pong Edge application implemented in Python](#ping-pong-edge-application-implemented-in-python)
6+
- [QuickStart](#quickstart)
67
- [Description](#description)
78
- [Overview](#overview)
89
- [Requirements](#requirements)
910
- [Used components](#used-components)
11+
- [Further requirements](#further-requirements)
1012
- [Installation](#installation)
1113
- [Direct Import steps](#direct-import-steps)
12-
- [Manual Build](#manual-build)
14+
- [Complete Installation](#complete-installation)
1315
- [Usage](#usage)
1416
- [Dependencies](#dependencies)
1517
- [Playing ping pong](#playing-ping-pong)
1618
- [Documentation](#documentation)
1719
- [Contribution](#contribution)
1820
- [Licence and Legal Information](#licence-and-legal-information)
1921

22+
## QuickStart
23+
24+
If you want to run everything locally with single command just run `docker-compose up -d` and open webpage on [localhost:1880](http://localhost:1880) and import [flows](SFC-flows/Pingpong-testing.json).
25+
2026
## Description
2127

2228
This application example demonstrates how Industrial Edge application can communicate with Databus using MQTT protocol. The goal is to send a string "Ping" message to Databus (MQTT broker) to a topic "topic1" and subscribe to MQTT topic "topic2" which should return "Pong python". The return message is generated by this python application. You can play virtual ping pong using this application!
@@ -35,40 +41,41 @@ A picture bellow shows the application data flow and architecture from the docke
3541

3642
## Requirements
3743

38-
In order for this use case to work the following apps needs to be present and configured on the Edge device
39-
40-
- IE Databus
41-
- IE Flow Creator (Can be replaced by any app that can send, receive and display MQTT messages)
42-
- IEM ready to deploy app
43-
- One available onboarded IE Device with enough memory available
44-
- Configured user and user rights on the Databus MQTT broker
45-
4644
### Used components
4745

48-
This application was created and tested using these components
46+
This application version 1.1.x was created and tested using these components
4947

50-
- Industrial Edge App Publisher V1.0.8
51-
- Docker Engine 19.03.8
48+
- Industrial Edge App Publisher V1.1.5
49+
- Docker Engine 20.10.2
5250
- Docker Compose V2.4
53-
- IE Databus V 1.0.11
54-
- IE Flow Creator V 1.0.4
55-
- Industrial Edge Management Version 1.0.11
56-
- Industrial Edge Device V 1.0.0-34
51+
- Industrial Edge Device V1.1.0-39
52+
- IE Databus Configurator V1.1.44
53+
- IE Databus V1.1.23
54+
- IE Flow Creator V1.0.4
55+
- IE Management System V1.1.0-48
56+
57+
### Further requirements
58+
59+
- IE Device is onboarded to a IE Management
60+
- IE Databus Configurator is deployed to the IE Management
61+
- IE Databus is deployed to the IE Device
62+
- IE Flow Creator is deployed to the IE Device
5763

5864
## Installation
5965

60-
You have two options how to install this app into Industrial Edge Management system. You can either use the [Direct Import section](#direct-import) to use .app we build for you or you can follow the [Manual Build](#manual-build) section to build the .app yourself.
66+
You have two options how to install this app into Industrial Edge Management system. You can either use the [Direct Import section](#direct-import) to reuse .app we build for you or you can follow the [Complete Installation](#complete-installation) section to create the .app yourself.
6167

6268
### Direct Import steps
6369

6470
1. Import .app application available at [GitHub](https://github.com/industrial-edge/ping-pong-python/releases) to your Industrial Edge Management using one of the two options
6571
1. Industrial Edge App Publisher (recommended)
6672
2. Catalog import functionality
6773
2. Install the imported app to onboarded Industrial Edge Device
74+
3. Follow the configuration steps in [Installation guide](docs/Installation.md).
6875

69-
### Manual Build
76+
### Complete Installation
7077

71-
More comprehensive instructions for building and installing this application is available in the [Installation guide](docs/Instalation.md).
78+
Comprehensive instructions for building and installing this application is available in the [Installation guide](docs/Installation.md).
7279

7380
## Usage
7481

@@ -79,25 +86,11 @@ In order for this application to run properly on Industrial Edge Device (IED), t
7986
- Databus application
8087
- IE Flow Creator application
8188

82-
For detailed explanation have a look at the [Installation guide](docs/Instalation.md).
89+
For detailed explanation have a look in the [Installation guide](docs/Installation.md) in the Testing section.
8390

8491
### Playing ping pong
8592

86-
1. Navigate to IED web interface home page
87-
2. Open IE Flow Creator UI
88-
3. Create MQTT Input node in Flow Creator
89-
4. Configure MQTT Broker
90-
1. IP address is "ie_databus", port is 1883, password and user must be configured by you in advance
91-
5. As topic write "topic2" to node
92-
6. Deploy the flow to check whether the connection is working. You should see green "connected" indicator after deploying
93-
7. Repeat the same process for MQTT output node
94-
8. Use Inject node as input to MQTT output node. Input text message should be "Ping"
95-
9. Use Debug node as output to MQTT input node
96-
10. Click on Inject to send message to broker. In the debug window you should see response.
97-
98-
The end flow should look like this.
99-
100-
![flow](docs/graphics/PingPongFlowCreator.png)
93+
Have a look in the [Installation guide testing section](docs/Installation.md) on how to play ping pong in Industrial Edge. :D
10194

10295
## Documentation
10396

SFC-flows/Pingpong-testing.json

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
[
2+
{
3+
"id": "cd02c1b1.e5539",
4+
"type": "tab",
5+
"label": "PingPong Test",
6+
"disabled": false,
7+
"info": ""
8+
},
9+
{
10+
"id": "28f15183.6df22e",
11+
"type": "inject",
12+
"z": "cd02c1b1.e5539",
13+
"name": "",
14+
"props": [{ "p": "payload" }, { "p": "topic", "vt": "str" }],
15+
"repeat": "",
16+
"crontab": "",
17+
"once": false,
18+
"onceDelay": 0.1,
19+
"topic": "",
20+
"payload": "Ping",
21+
"payloadType": "str",
22+
"x": 450,
23+
"y": 180,
24+
"wires": [["a7b5026b.7018c"]]
25+
},
26+
{
27+
"id": "5357c931.64e9d8",
28+
"type": "inject",
29+
"z": "cd02c1b1.e5539",
30+
"name": "",
31+
"props": [{ "p": "payload" }, { "p": "topic", "vt": "str" }],
32+
"repeat": "",
33+
"crontab": "",
34+
"once": false,
35+
"onceDelay": 0.1,
36+
"topic": "",
37+
"payload": "Pong",
38+
"payloadType": "str",
39+
"x": 450,
40+
"y": 240,
41+
"wires": [["a7b5026b.7018c"]]
42+
},
43+
{
44+
"id": "d34cbaff.a45528",
45+
"type": "inject",
46+
"z": "cd02c1b1.e5539",
47+
"name": "",
48+
"props": [{ "p": "payload" }, { "p": "topic", "vt": "str" }],
49+
"repeat": "",
50+
"crontab": "",
51+
"once": false,
52+
"onceDelay": 0.1,
53+
"topic": "",
54+
"payload": "Something else",
55+
"payloadType": "str",
56+
"x": 420,
57+
"y": 300,
58+
"wires": [["a7b5026b.7018c"]]
59+
},
60+
{
61+
"id": "a7b5026b.7018c",
62+
"type": "mqtt out",
63+
"z": "cd02c1b1.e5539",
64+
"name": "",
65+
"topic": "topic1",
66+
"qos": "",
67+
"retain": "",
68+
"broker": "f9797e4b.7d9c9",
69+
"x": 610,
70+
"y": 240,
71+
"wires": []
72+
},
73+
{
74+
"id": "be36003a.4e936",
75+
"type": "mqtt in",
76+
"z": "cd02c1b1.e5539",
77+
"name": "",
78+
"topic": "topic2",
79+
"qos": "2",
80+
"datatype": "auto",
81+
"broker": "f9797e4b.7d9c9",
82+
"x": 390,
83+
"y": 440,
84+
"wires": [["9618c676.7e2158"]]
85+
},
86+
{
87+
"id": "9618c676.7e2158",
88+
"type": "debug",
89+
"z": "cd02c1b1.e5539",
90+
"name": "",
91+
"active": true,
92+
"tosidebar": true,
93+
"console": false,
94+
"tostatus": false,
95+
"complete": "false",
96+
"statusVal": "",
97+
"statusType": "auto",
98+
"x": 590,
99+
"y": 440,
100+
"wires": []
101+
},
102+
{
103+
"id": "23479def.67eba2",
104+
"type": "comment",
105+
"z": "cd02c1b1.e5539",
106+
"name": "publish different data to topic on databus",
107+
"info": "",
108+
"x": 480,
109+
"y": 120,
110+
"wires": []
111+
},
112+
{
113+
"id": "227e2d39.73b9e2",
114+
"type": "comment",
115+
"z": "cd02c1b1.e5539",
116+
"name": "subscribe to topic on databus to receive answer",
117+
"info": "",
118+
"x": 500,
119+
"y": 400,
120+
"wires": []
121+
},
122+
{
123+
"id": "f9797e4b.7d9c9",
124+
"type": "mqtt-broker",
125+
"name": "",
126+
"broker": "ie-databus",
127+
"port": "1883",
128+
"clientid": "",
129+
"usetls": false,
130+
"compatmode": false,
131+
"keepalive": "60",
132+
"cleansession": true,
133+
"birthTopic": "",
134+
"birthQos": "0",
135+
"birthPayload": "",
136+
"closeTopic": "",
137+
"closeQos": "0",
138+
"closePayload": "",
139+
"willTopic": "",
140+
"willQos": "0",
141+
"willPayload": ""
142+
}
143+
]

cfg-data/mqtt-config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"MQTT_USER":"edge",
33
"MQTT_PASSWORD":"edge",
4-
"MQTT_IP":"ie_databus",
4+
"MQTT_IP":"ie-databus",
55
"TOPIC_1":"topic1",
66
"TOPIC_2":"topic2"
77
}

docker-compose.prod.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
# Docker compose that can be imported to Industrial Edge App Publisher (IEAP)
1+
# Docker compose that can be imported to Industrial Edge App Publisher (IEAP) but first build it with docker-compose.yml
22

33
version: "2.4"
44
services:
55
pingpong-python:
6-
image: ping-pong-python:1.0.0
6+
image: ping-pong-python:1.1.0
77
environment: # We recommend using cfg-data folder and load config from file rather than environment variables
88
- TOPIC_1=topic1
99
- TOPIC_2=topic2
10-
# Databus service in network is called ie_databus but will be probably changed in Industrial Edge 1.1
11-
- MQTT_IP=ie_databus
10+
- MQTT_IP=ie-databus # Databus name has changed in Industrial Edge 1.1
1211
- MQTT_USER=edge
1312
- MQTT_PASSWORD=edge
1413
mem_limit: 300mb

docker-compose.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
version: "2.4"
1+
# Use this docker-compose as a one-click start for demo -> simply run "docker-compose up -d" and see logs of python container that it is connected
22

3+
version: "2.4"
34
services:
45
pingpong-python:
56
build: ./src/
6-
image: ping-pong-python:1.0.0
7+
image: ping-pong-python:1.1.0
78
environment:
89
- TOPIC_1=topic1
910
- TOPIC_2=topic2
10-
# Databus service in network is called ie_databus but will be probably changed in Industrial Edge 1.1
11-
- MQTT_IP=ie_databus
11+
- MQTT_IP=ie-databus
1212
- MQTT_USER=edge
1313
- MQTT_PASSWORD=edge
1414
mem_limit: 300mb
@@ -18,8 +18,15 @@ services:
1818
# Network of system apps
1919
networks:
2020
- proxy-redirect
21-
ie_databus: # note that the underscore will be removed in the future
22-
image: eclipse-mosquitto
21+
ie-databus: # For local development purposes. Note that preffered databus name changed from 1.0 to 1.1. Legacy old name is "ie_databus".
22+
image: eclipse-mosquitto:1.6
23+
networks:
24+
- proxy-redirect
25+
26+
nodered:
27+
image: nodered/node-red
28+
ports:
29+
- 1880:1880
2330
networks:
2431
- proxy-redirect
2532
networks:

0 commit comments

Comments
 (0)