I have bought an ConnectPort X2 Wireless M-Bus kit and I followed the started guide.
so I’m registered in iDigi Device Cloud and I added my X2 m-bus to the device list.
At the end I loaded to x2 the MBus_sample that I created with DigiPython that reads m-bus wirelless packet from network and send its to cloud server.
If I open the files that the program send to cloud server I see that data of the message is a string like this:
My doubt is…what rappresent this string?? how I can translate it to read correct message??
I am not sure but for me that looks like a base64 string. I think that when binary data is pushed from the X2 to iDigi, it is converted to Base64 to avoid data loss.
This is the binary data I get after decoding that string using base64:
44 a2 05 60 26 00 54 01 37 72 62 26 00 54 a2 05 00 1b 4d 00 30 05 67 d4 7c 93 23 3d b5 4b f5 11 8b bb 58 d6 3d 48 7c c7 56 70 4c f9 fd b8 1c 04 30 80 82 bd c9 73 31 5f 32 a6 5a 32 41 27 fc 99 dc 81 2e d9 79 d8
I don’t know if this follows the mBus protocol, maybe you have now to interpret each byte (or I may be completly wrong and mbus uses a special data encryption and it is not base64!).
OK! it’s corretc! Thanks!!
Do you know if it is possible comunicate with X2 in local network? with LAN connection for example??
Glad it was helpful
Sure, you can communicate with the X2 in local network using sockets. You can implement the server/client protocol in 2 ways:
1.- You can create a server socket on the X2 listening for connections in a known port and then connect to that socket from the PC and ask for data.
2.- You can create the server socket on your PC listening for connections in a known port and make the X2 to connect to that socket each time you want to transmit data.
In both cases you will need to create a small communication protocol to transfer the data. This way you will know that a packet is received with a determinate lenght and data, something like this:
[MAGIC COOKIE/HEADER][DATA LENGTH]DATA
[DATA] -> [COMMAND ID][PAYLOAD LENGTH][PAYLOAD]
OK! thanks a lot for all!!