FUXA
FUXA copied to clipboard
[Question] Parsing Object in the MQTT payload
Hi @unocelli , how can I parse data when the data format of my MQTT is in an object (nested object)? How can I drill down to that object so I can only choose one of its data?
The only way of doing it (at least how I did it) was to create a new option within TagOptions
and then define the mqttTagConverter function within FUXA scripts.
Note: all above require changing FUXA (programming)
Hi @bogdanvaduva ,
Thanks for suggesting. Care to share your code, client and server to achive this?
This is interesting. I actually managed it too (I adjust the server program) so simply add the "/" for every JSON key.
For example, if I have a JSON payload of data:{ temp: { value: 23.5 } }
I just simply set the address to be data/temp/value
But I am interested on scripting too. Thanks!
Regards, Henjoe
You can find the code at https://github.com/bogdanvaduva/FUXA-B
Thank you very much.
convert using a function is available only on my branch. sorry!
On Sunday, July 21, 2024 at 12:35:54 AM GMT+3, haslish ***@***.***> wrote:
@bogdanvaduva How do i get the convert using a function? My tag options dont look the same. Skarmbild.fran.2024-07-20.23-32-15.png (view on web) Skarmbild.fran.2024-07-20.23-34-54.png (view on web)
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>
Not yet included in the latest released (v1.9) but upon checking the Master branch (v1.2), frangoteam already included it. So expect on the sooner released we will have this functionalities.
Hi @henjoe , I see that you have implemented data through/to drill down, can you show the code you modified? Thank you very much.
Hi @henjoe , I see that you have implemented data through/to drill down, can you show the code you modified? Thank you very much.
I Actually copied the forked version with "data convertion". I realized it's a much better than what I had.
Have you try to define a script bind to the tag?
@unocelli i have not (thanks for the ideea), but I've wanted to save the values into the database and for that I've used device's option(s) (it was the whole reason for adding that option). Great job!