Posts: 3
Threads: 3
Joined: Apr 2022
Reputation:
0
05-28-2022, 06:54 PM
(This post was last modified: 11-08-2022, 09:42 PM by iliaslamprou.)
Dear,
Is there any example of how to configure the MQTT variables for data viewing?
The topic I'm reading returns the following JSON:
{
"results" : [ {
"name" : "Temperatura",
"value" : 24,
"timestamp" : 1653760447,
"description" : "",
"unit" : "°C"
} ]
}
How do I configure the variable to read the temperature value?
Posts: 365
Threads: 0
Joined: Apr 2022
Reputation:
13
05-29-2022, 07:07 PM
(This post was last modified: 05-29-2022, 07:15 PM by iliaslamprou.)
Hi,
I am sorry, I don't have a tutorial yet.
It is very easy to do it.
I have uploaded your json text to the hiveMQ broker to the topic: virtuino_test
1. Create a new project
2. Add the default Virtuino MQTT connection to the broker HiveMQ
3. Enter the sub topic: virtuino_test
4. Go to the broker variables. Select the variable V0. Select as sub topic the "virtuino_test" topic
5. On the field "Value Json path" enter the follow path
results[0]/name
Insert a "Value display" to read the V0
Then connect and check the results
The results[0] returns the first json item of the results array
The name returns the value of the json field name
Posts: 2
Threads: 0
Joined: Nov 2022
Reputation:
0
11-08-2022, 05:35 PM
Hi,
I have a similar problem. How to get value from array?
{
"dio" : {
"do" : [ 0, 1, 0, 0, 0, 1, 0 ],
"ro" : [ 0, 0, 0, 0, 0, 1, 0 ],
"di" : [ 0, 0, 1, 0, 1, 0, 0, 0 ]
}
}
I did this: dio/ro[0] (Error:No value for ro[0])
Posts: 2
Threads: 0
Joined: Nov 2022
Reputation:
0
11-09-2022, 04:54 AM
(This post was last modified: 11-09-2022, 11:53 PM by iliaslamprou.)
Hi iliaslamprou,
Thank you for the video. I forgot to say that I tried to do this in Virtuino MQTT in 1.0.36
Now I'll try to install Virtuino IoT.