Skip to content

Commit e9702fc

Browse files
authored
Adds Node-RED Example (#816)
1 parent 1a986df commit e9702fc

File tree

19 files changed

+1250
-2
lines changed

19 files changed

+1250
-2
lines changed

.github/workflows/examples_test.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,4 +169,23 @@ jobs:
169169
run: docker compose -f examples/BaSyxSecured/docker-compose.yaml up -d
170170

171171
- name: Stop BaSyx Secured Example
172-
run: docker compose -f examples/BaSyxSecured/docker-compose.yaml down
172+
run: docker compose -f examples/BaSyxSecured/docker-compose.yaml down
173+
174+
test-basyx-node-red:
175+
runs-on: ubuntu-latest
176+
name: Test BaSyx Node-RED Example
177+
steps:
178+
- uses: actions/checkout@v4
179+
180+
- name: Set up JDK 17
181+
uses: actions/setup-java@v4
182+
with:
183+
java-version: '17'
184+
distribution: 'adopt'
185+
cache: maven
186+
187+
- name: Start BaSyx Node-RED Example
188+
run: docker compose -f examples/BaSyxNodeRED/docker-compose.yml up -d
189+
190+
- name: Stop BaSyx Node-RED Example
191+
run: docker compose -f examples/BaSyxNodeRED/docker-compose.yml down

examples/BaSyxNodeRED/README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# BaSyx Node-RED Example
2+
3+
This example showcases the integration of BaSyx with Node-RED for seamless data flow and management in industrial IoT applications.
4+
Here, an example MQTT client for an environmental sensor is used to send data via Node-RED to the BaSyx AAS Environment.
5+
6+
## How to run the BaSyx + Node-RED Example
7+
8+
1. Open a terminal in this folder
9+
2. Run the following command to start the BaSyx containers:
10+
11+
```bash
12+
docker-compose up -d
13+
```
14+
15+
> To run the example containers, you need to have Docker installed on your device.
16+
17+
## View the working Example
18+
19+
To see the working example, open the [BaSyx AAS Web UI](http://localhost:3000) and navigate to the `SensorExampleAAS`. You can see the data coming from the MQTT client in the `SensorData` submodel.
20+
To see updates in real-time, active the `Auto-Sync` feature in the AAS Web UI (see top right corner of the UI).
21+
22+
![BaSyx AAS Web UI](./docs/basyx-ui.png)
23+
24+
## Where to find the configuration
25+
26+
### Node-RED
27+
28+
You can visit the [Node-RED Editor](http://localhost:1880) to view and edit the flows.
29+
30+
> The preconfigured Node-RED flow can be found in the `nodered` folder. The flow is defined in the `flows.json` file.
31+
32+
![Node-RED Flow](./docs/nodered.png)
33+
34+
### MQTT Client
35+
36+
The configuration for the MQTT client can be found in the `mqtt-client` folder. It is a small Python script that publishes data to the MQTT broker.
37+
38+
### MQTT Broker
39+
40+
The MQTT brokers configuration can be found in the `mosquitto` folder. The configuration is defined in the `config/mosquitto.conf` file.
41+
42+
### BaSyx Components
43+
44+
The configuration for the BaSyx components can be found in the `basyx` folder.
45+
The AAS used in this example is located in the `aas` folder.
12.9 KB
Binary file not shown.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
server.port=8081
2+
3+
spring.application.name=AAS Discovery Service
4+
basyx.aasdiscoveryservice.name=aas-discovery-service
5+
6+
basyx.backend=InMemory
7+
8+
basyx.cors.allowed-origins=*
9+
basyx.cors.allowed-methods=GET,POST,PATCH,DELETE,PUT,OPTIONS,HEAD
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
server.port=8081
2+
3+
basyx.backend=InMemory
4+
5+
basyx.environment=file:aas
6+
7+
basyx.cors.allowed-origins=*
8+
basyx.cors.allowed-methods=GET,POST,PATCH,DELETE,PUT,OPTIONS,HEAD
9+
10+
basyx.aasrepository.feature.registryintegration=http://aas-registry:8080
11+
basyx.submodelrepository.feature.registryintegration=http://sm-registry:8080
12+
basyx.aasrepository.feature.discoveryintegration=http://aas-discovery:8081
13+
14+
basyx.externalurl=http://localhost:8081
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
basyx:
2+
cors:
3+
allowed-origins: '*'
4+
allowed-methods: GET,POST,PATCH,DELETE,PUT,OPTIONS,HEAD
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
basyx:
2+
cors:
3+
allowed-origins: '*'
4+
allowed-methods: GET,POST,PATCH,DELETE,PUT,OPTIONS,HEAD
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
services:
2+
# Node-RED
3+
nodered:
4+
build: ./nodered
5+
container_name: nodered
6+
ports:
7+
- "1880:1880"
8+
volumes:
9+
- ./nodered:/data
10+
depends_on:
11+
aas-env:
12+
condition: service_healthy
13+
mosquitto:
14+
condition: service_healthy
15+
restart: unless-stopped
16+
17+
# MQTT Broker
18+
mosquitto:
19+
image: eclipse-mosquitto:2.0.15
20+
container_name: mosquitto
21+
ports:
22+
- 1883:1883
23+
volumes:
24+
- ./mosquitto/config:/mosquitto/config
25+
restart: unless-stopped
26+
healthcheck:
27+
test: ["CMD-SHELL", mosquitto_sub -p 1883 -t 'topic' -C 1 -E -i probe -W 3]
28+
interval: 5s
29+
retries: 3
30+
start_period: 1s
31+
timeout: 10s
32+
33+
# MQTT Client
34+
mqtt-client:
35+
build: ./mqtt-client
36+
container_name: mqtt-client
37+
depends_on:
38+
- mosquitto
39+
restart: unless-stopped
40+
41+
aas-env:
42+
image: eclipsebasyx/aas-environment:2.0.0-SNAPSHOT
43+
container_name: aas-env
44+
volumes:
45+
- ./basyx/aas-env.properties:/application/application.properties
46+
- ./aas:/application/aas
47+
ports:
48+
- 8081:8081
49+
restart: unless-stopped
50+
depends_on:
51+
aas-registry:
52+
condition: service_healthy
53+
sm-registry:
54+
condition: service_healthy
55+
aas-discovery:
56+
condition: service_healthy
57+
58+
aas-registry:
59+
image: eclipsebasyx/aas-registry-log-mem:2.0.0-SNAPSHOT
60+
container_name: aas-registry
61+
ports:
62+
- 8082:8080
63+
volumes:
64+
- ./basyx/aas-registry.yml:/workspace/config/application.yml
65+
restart: unless-stopped
66+
67+
sm-registry:
68+
image: eclipsebasyx/submodel-registry-log-mem:2.0.0-SNAPSHOT
69+
container_name: sm-registry
70+
ports:
71+
- 8083:8080
72+
volumes:
73+
- ./basyx/sm-registry.yml:/workspace/config/application.yml
74+
restart: unless-stopped
75+
76+
aas-discovery:
77+
image: eclipsebasyx/aas-discovery:2.0.0-SNAPSHOT
78+
container_name: aas-discovery
79+
ports:
80+
- 8084:8081
81+
volumes:
82+
- ./basyx/aas-discovery.properties:/application/application.properties
83+
restart: unless-stopped
84+
85+
aas-ui:
86+
image: eclipsebasyx/aas-gui:SNAPSHOT
87+
container_name: aas-ui
88+
ports:
89+
- "3000:3000"
90+
environment:
91+
AAS_DISCOVERY_PATH: "http://localhost:8084/lookup/shells"
92+
AAS_REGISTRY_PATH: "http://localhost:8082/shell-descriptors"
93+
SUBMODEL_REGISTRY_PATH: "http://localhost:8083/submodel-descriptors"
94+
AAS_REPO_PATH: "http://localhost:8081/shells"
95+
SUBMODEL_REPO_PATH: "http://localhost:8081/submodels"
96+
CD_REPO_PATH: "http://localhost:8081/concept-descriptions"
97+
restart: unless-stopped
98+
depends_on:
99+
aas-env:
100+
condition: service_healthy
105 KB
Loading
102 KB
Loading

0 commit comments

Comments
 (0)