Using Serial Data Source as MBUS device
-
@Turbo Did you try restarting the datasource? I've got a stupid feeling the serial datasource is still broken...
-
@MattFox Yep. Multiple times. In fact, I'm going to restart Mango, then try restarting the data source as well.
-
@Turbo Notably, it appears is if Mango isn't trying to grab control of the serial port: I just tried restarting the serial port on the Serial data source, and it didn't even try. When I was doing this before, restarting the serial data source would take over control of the port.
I'm still watching my data stream up Minicom, regardless of how I set up the serial data source input.
Does the M-Bus data source work in Mango V3 still? I may roll back to that, as this is rapidly becoming critical path for me.
-
@Turbo get a free version and quickly find out. Alternatively, can you not redirect the output using socat and connecting to a tcp socket instead?
Whichever is quicker I guess...
Fox
-
@MattFox I've never used socat; I'm learning something new today! How does this work?
Also: Are there plans to bring MBUS back in Mango V4? We're bidding an epic pile of projects in the EU, and the fact that MBUS is mentioned on Mango's "supported drivers" page (https://radixiot.com/supported-protocols) is one of the reasons we got this job.
I didn't ever think about the fact that this would be removed in V04, until I went and checked up on it again.
Let me read about socat, as that may be a solution here.
-
-
@Turbo said in Using Serial Data Source as MBUS device:
Also: Are there plans to bring MBUS back in Mango V4? We're bidding an epic pile of projects in the EU, and the fact that MBUS is mentioned on Mango's "supported drivers" page (https://radixiot.com/supported-protocols) is one of the reasons we got this job.
I didn't ever think about the fact that this would be removed in V04, until I went and checked up on it again.@CraigWeb - need your input here
-
@MattFox I appreciate this; Could you maybe ping someone about if, in fact, the Serial data source in Mango is not working? Am I the only one who ever tries to do things this way?
-
@Turbo no I used to for radio transmitters over serial. I still do for small electronics projects.
But it is something that needs to be looked at.Fox
-
@MattFox Okay:
For folks that come through here, this appears to work for socat:
socat -d -d -d -d tcp-listen:4141,reuseaddr,fork file:/dev/ttyUSB0,nonblock,cs8,b2400,cstopb=0,raw,echo=0(that's got debugging turned on)
But these devices are "originate only" (M-Bus just sends, no listen, just talk), so now I'm trying to figure out to to get that data into mango..
Same thing as before: Just see "data source started" in the TCP data souirce log file, but my little socat command status is streamalating data.. I'm now working this angle.
If I can't get this figured out, I'll roll back to Mango V3 and see if that M-Bus in there still works for us.
-
@Turbo Also: This definitely works, btw, since if you telnet to that port I set up, you can see the data streaming in from the device. It's hex, though, not ascii, so it's not remotely human readable..
When I try and select "configuration in HEX" in the TCP data source setup, it won't let the box stay checked: Each time I check it, when I refresh the page, it comes back as unchecked again.
The adventure continues..
-
@Turbo Also: When you save the TCP Data source (usually) the Select Data Source list updates automatically when you create a new datasource: In this case, the new datasource is not automatically created. New clues coming in rapid-fire here.
-
@Turbo Well hot damn. The thing works.
So now I can socat data in as a TCP point.. That's cool.
For folks following along:
First, do this to forward the port:
socat -d -d -d -d tcp-listen:4141,reuseaddr,fork file:/dev/ttyUSB0,nonblock,cs8,b2400,cstopb=0,raw,echo=0
This is a 2400 baud device.
I set the timeout for 250, no delimeter, and then port 4141 (as above) and host of Localhost.Then, in the data point, I created a general placeholder with a read command of "00" and a value regex of (.*), value index 0
This appears to update properly.
Now to write a parser- This sure would be easier with the original M-Bus device.
Thanks for your help, @MattFox .
There also appears to be a bug (still) in the serial data source, at least when running on Linux- This test install is a raspberry pi, but we'll be deploying this on our IMX8's as usual, I hpoe.
-
@Turbo Ok. One more quick question on here: Since this device is (effectively) streaming data in - There isn't even a RX pin on the device we're talking to, is there a way to set up the tcpip connector to just store data as it comes in, rather than requiring the use of the "read" command before awaiting a response?
Right now, I'm just sending "00" out as a read command, but the device has no read command; It just spews data out. The read command forces a sync where none exists. I'd rather just have the tcpip point record the point when data comes into the point, rather than after the read command is issued.
If I disable "queryable" I get no data at all, but I enable queries, I end up missing every third packet, since there's no way to sync the "output only" nature of the M-Bus device with Mango's need to poll and record a response.
It kinda works, but I wonder if there's some secret to have Mango just store whatever comes in over that port?
-
@MattFox So: Turns out the socat solution works, but it's not really as straightforward as using the Serial device natively:
Can you poke around and see if the Serial data source needs some hugs? Using a TCP forward for a USB converter serial port seems a bit silly to me, when Mango has a raw Serial device interface that (should) do the same thing.I've now had no luck with the serial data source on my ARM based IMX8 machine over hardware serial or USB to 485 serial under V3 or V4, and now am seeing the same thing under V4 on a raspberry pi.
I'm happy to set up a screen share / demo video / something if you want to see what I'm seeing with this.
Thanks for your help, in any event, as we now have a (mostly) working MBus data source again, although in a somewhat ridiculously rube-goldbergesque way.
-
@Turbo sure I'll flick you a PM
-
@Turbo can you share the reason why you didn't use a Mbus to Modbus TCP converter in your cases? The only time I have to reqd data from Mbus devices, I use Anybus gateway, quite easy to use.
-
@tungthanh500 Budgets. The M-Bus to USB converter is $20, the M-Bus to modbus device is considerably more expensive. Our goal is also to keep the number of things "needing configuration" to an absolutely minimum:If we can do it in Mango, it saves us time and money (and spare parts inventory costs).
-
@Turbo
I didn't notice the MBUS driver has been dropped. That is bit disappointing. I have got a project with 50 MBUS meters. So I have to hook them into something else then spit them back out via BACnet IP then.the workaround you have mentioned is a bit painful to implement and to get working reliably.
-
@cwangv That's true- I'm happy to send you my code, if you want, when I get it working- It's just a scripted point that searches raw strings for the OBIS code and saves it in datapoints. This for energy meters, and so far, it works OK.
@CraigWeb any plans on bringing the M-Bus module in Mango V4? It's interesting, since it's still stated as "supported" on Mango's website: https://radixiot.com/supported-protocols
You only find out it's missing from V4 when you look at the documentation for Upgrade from V03 -> V04: https://docs-v4.radixiot.com/upgrade-to-v4 and scroll down to "unsupported modules"