Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP32-MQTT-JSONSCADA- MONGODB flow #116

Open
Nolan-29 opened this issue Aug 7, 2023 · 17 comments
Open

ESP32-MQTT-JSONSCADA- MONGODB flow #116

Nolan-29 opened this issue Aug 7, 2023 · 17 comments

Comments

@Nolan-29
Copy link

Nolan-29 commented Aug 7, 2023

Dear companion,

Here am working on project , My Sensor data (Temperature and Speed ) get from module and its connected through mqtt protocol. now so I want to see that data on JSON-SCADA Display Viewer which is in .SVG file .

In SVG file I created my Own layout Shape and also i done Tag . Now the

Que 1. how my .svg file and inside Tag will communicate to my Real time Data with help of MQTT Protocol Driver.

Que 2 : I need some details about Json-Scada and MQTT protocol connection. below i attached image reference

que 3 : How to set configuration between MongoDB , MQTT Protocol Connection and tag ID

Que 4: Should i add MongoDB Library In my Arduino Code or Not for storing data ? Or only Mqtt config is Enough ? Like just giving mqtt broker details in my arduino code as im getting my data in mqtt broker frome there I'm confused about sending data to json scada
mogodb
mqtt screen

hope i explained you as much understandable if not pls excuse and am expecting your valid reply...:)

@riclolsen
Copy link
Owner

riclolsen commented Aug 7, 2023

First try to connect the device to a MQTT broker and then JSON-SCADA to the broker.
After configuring connection, restart the service JSON_SCADA_mqttsparkplugclient.
If you do not see data, check logs.

To see mqtt logs do this:
Go to windows services and stop JSON_SCADA_mqttsparkplugclient
Or do in cmd as admin
net stop JSON_SCADA_mqttsparkplugclient
cd C:\json-scada\src\mqtt-sparkplug
\json-scada\platform-windows\nodejs-runtime\node.exe index.js 1 3

Does your device has Sparkplug B? If not do not use spBv1.0 topics.

@Nolan-29 Nolan-29 closed this as completed Aug 7, 2023
@Nolan-29 Nolan-29 reopened this Aug 7, 2023
@Nolan-29
Copy link
Author

Nolan-29 commented Aug 7, 2023

My device(esp32) is connected to Mqtt broker and then broker is receiving the data.From there to how to connect with json scada?

@riclolsen
Copy link
Owner

riclolsen commented Aug 7, 2023

https://github.com/riclolsen/json-scada/blob/master/src/mqtt-sparkplug/README.md

Basically put the broker address in endpointURLs, and list topics in topics parameter. Username and password if necessary.

Restart the service JSON_SCADA_mqttsparkplugclient.

@Nolan-29
Copy link
Author

Nolan-29 commented Aug 7, 2023

Given like that only what u mentioned, now If json scada is connected to mqtt broker where have to see that ?
In MongoDB vice should i do any Configuration ??

@riclolsen
Copy link
Owner

Better look first at the logs.

To see mqtt logs do this:
Go to windows services and stop JSON_SCADA_mqttsparkplugclient
Or do in cmd as admin
net stop JSON_SCADA_mqttsparkplugclient
cd C:\json-scada\src\mqtt-sparkplug
\json-scada\platform-windows\nodejs-runtime\node.exe index.js 1 3

@Nolan-29
Copy link
Author

Nolan-29 commented Aug 8, 2023

Getting like this

Screenshot (70)

@riclolsen
Copy link
Owner

Odd unexpected error on MongoBD changestream!
I am not sure what can be the problem. Please retry. Uninstall/Reinstall JSON-SCADA if necessary.
If possible, post your protocolConnections contents from mongodb.

The log should be something like this
C:\json-scada\src\mqtt-sparkplug>\json-scada\platform-windows\nodejs-runtime\node.exe index.js 1 3
2023-08-08T21:44:28.792Z - Config - Config File: ../../conf/json-scada.json
2023-08-08T21:44:28.797Z - Config - {json:scada} - MQTT-Sparkplug-B Client Driver Version 0.1.5
2023-08-08T21:44:28.798Z - Config - Instance: 1
2023-08-08T21:44:28.798Z - Config - Log level: 3
2023-08-08T21:44:28.799Z - MongoDB - Connecting to MongoDB server...
2023-08-08T21:44:28.838Z - MongoDB - Connected correctly to MongoDB server
2023-08-08T21:44:28.854Z - Connection - Connection Number: 1200
2023-08-08T21:44:28.859Z - Auto Key - Initial value: 1200000022
2023-08-08T21:44:28.859Z - Redundancy - Process Inactive
2023-08-08T21:44:28.865Z - Redundancy - Node activated!
2023-08-08T21:44:33.874Z - Redundancy - Process Active
2023-08-08T21:44:33.886Z - MQTT Client - Creating client...
2023-08-08T21:44:33.887Z - MQTT Client - Try connecting to mqtt://test.mosquitto.org:1883

2023-08-08T21:44:34.629Z - SparkplugClientLib - packetreceive: {"cmd":"connack","retain":false,"qos":0,"dup":false,"length":2,"topic":null,"payload":null,"sessionPresent":false,"returnCode":0}
2023-08-08T21:44:34.632Z - SparkplugClientLib - Client has connected
2023-08-08T21:44:34.632Z - MQTT Client - Event: Connected to broker
2023-08-08T21:44:34.632Z - MQTT Client - Subscribing topic: spBv1.0/Edge Nodes/#

@Nolan-29
Copy link
Author

Nolan-29 commented Aug 9, 2023

Getting like this.
Now where to see the data coming from my device in json scada?
Screenshot (83)

@riclolsen
Copy link
Owner

riclolsen commented Aug 10, 2023

Connection to mongo and broker are ok now.
Remove spBv1.0 from topics list. Put there your topic filter (or # for all topics).
Leave publishTopicRoot and groupId empty or it will publish JSON-SCADA data to the broker.

@Nolan-29
Copy link
Author

here im getting data from mqtt broker to mongodb so , do i need postgres or can i directly send these json payload to display viewer to observe changes in svg file?

@riclolsen
Copy link
Owner

You have to use the tags created in mongodb by the MQTT driver. Use the tags to markup objects in the SVG files.
See example SVG files and demo tags.

@Nolan-29
Copy link
Author

Nolan-29 commented Aug 18, 2023

Demo Tags in admin page and MongoDB real-time data ID , all related to opc-UA only.
Is there any example tag for Mqtt (spark plug) ? If mean can u please share example!! Also still not clear about MongoDB data how to Fetch in json Scada !!

@Nolan-29
Copy link
Author

One more doubt , We need just 12 set of parameters only , so can we edit the schema as per our customise or we have use as per demo only ???

@riclolsen
Copy link
Owner

When the data is already loaded by the protocol driver to MongoDB it doesn't matter the protocol anymore, values acquired will flow to SVG as requested identified by the "tag" field from the mongo document. In fact, the demo SVG presents IEC-104 data only, not OPC. So, it is just a matter of studying the demo SVG files.
I didn't quite get your last question.
You can use JSON-PATH syntax to extract properties in the "topics" parameter or use "topicsScripted" to extract the data from a topic with a script. Each individual data value must be in a distinct tag to be displayed in the SVG.
See
https://github.com/riclolsen/json-scada/blob/master/src/mqtt-sparkplug/README.md

@Nolan-29
Copy link
Author

SAGE (Cepel) HTML/SVG Displays (SAGE-web) where it is?

@riclolsen
Copy link
Owner

This is specific to displays created for the Brazilian SCADA SAGE. It is possible to convert those displays to SVG and animate in JSON-SCADA.

@riclolsen
Copy link
Owner

I have detected problems with the MQTT driver in version 0.29, now fixed in version 0.30!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants