FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
585 views 13 comments
by anonymous

Dear Sir/Madam,

On our TRB143 device we have the newest firmware: TRB1_R_00.07.04.2. The "Data to Server" is configured as follow (see the JSON format in attached datatoserver.png file). The M-Bus request configuration (see mbusrequestconfig.png file). This generates files being sent to Azure IoT hub which look as attached (invalid.json). This is an invalid JSON file. Is there a way of properly setting the "JSON format" in "Data to Server" configuration or in the M-Bus request configuration that will produce a valid JSON file? I can't achieve this, but will require the data within JSON file in an incorporated XML as in the file attahced (invalid.json)

Kind regards, Rafael

by anonymous
Thank you for your inputs. Your details have been forwarded to the developers.

I will inform you about further proceedings, once I receive them.

Best regards,
by anonymous

@janitor

based on the file you have attached above:

- read the string into variable

- find the position of "mbus": " and take the content after it until you reach the <\/MBusData>" this you can cut from the file and parse as an XML object. With this you may do whatever you want. In my case (Visual Studio and C# code) I can paste it from clipboard into my IDE as XML classes. Then I can use this classes to deserialize the XML into C# objects. Having this I'm fine. What's your case I'm not sure. If you need a valid JSON file to pass somewhere else you may then serialize the C# objects again, but this time into JSON string and paste it back to the place where the XML content in the file was. This way you should get a valid JSON file. 

- rest from the file is a valid JSON so can be parsed as JSON

@ZygimantasBliu,

speaking about the XML deserialization - could you answer mi the question which I put on your initial answer. This one?:

I see, could you maybe deliver me some schema for the XML or description how do you generate it from the MBus protocol? For example, in the starting thread I got plain texted: <Medium>Heat: Outlet</Medium>. What other full medium texts could I expect in the <Medium> markup? From the documentation here: 8 – Appendix – M-Bus I would have expected "Heat" instead of "Heat: Outlet" that you provide.

Kind regards,

Rafael

by anonymous
I personally do not understand the backend of the M-Bus, thus cannot provide you an answer, but have relayed your question as well. Awaiting for a reply from RnD.

Best regards,
by anonymous
@ Rafael Wiglenda,

aha moment! I did not even considered to expect string on the server instead of valid json. Good idea. I tested it and it reads ok, at least when I post a sample of json with xml data file.

I'm doing this as REST API with PHP/MySQL for testing as I need only 3 values (device id, energy, date) from xml. The end goal is to read energy data from a building once every two weeks and store values in DB and then export that as .csv so it can be fed into some other application (not mine).

In any case, thank you for your help. I hope it'll work when I truly test this with remote reading.
by anonymous

I got a reply from the developers. If changes were made to the current implementation of XML data inside JSON, it might break other clients' solutions.

Alternatively, JSON data type will be added to M-BUS master with 7.5 firmware release, thus please wait for a new firmware. 

A modified XML format can be added to M-Bus request configuration, but that would require custom development and is a paid service. To proceed further, you would need to contact your local sales representative.

Regarding @Rafael Wiglenda question about medium texts, what I got is as follows:

There can be multiple heat elements, so libmbus (library for the M-bus) just interprets data like this. It cam can changed, but that would require custom development as well.

Best regards,

1 Answer

0 votes
by anonymous
Hello,

Do I understand correctly, you want MBUS data output to be given in JSON rather than XML format?

At the moment, it is not possible.

JSON data type is planed to be implemented in the future. At the moment it is set to be included with 7.5 firmware release, though it might change, depending on the development proceedings.

Best regards,
by anonymous

Hi,

I see, could you maybe deliver me some schema for the XML or description how do you generate it from the MBus protocol? For example, in the starting thread I got plain texted: <Medium>Heat: Outlet</Medium>. What other full medium texts could I expect in the <Medium> markup? From the documentation here: 8 – Appendix – M-Bus I would have expected "Heat" instead of "Heat: Outlet" that you provide.

Kind regards,

Rafael