• Recent
    • Tags
    • Popular
    • Register
    • Login
    1. Home
    2. Turbo
    3. Best

    Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website
    • Profile
    • Following 0
    • Followers 1
    • Topics 31
    • Posts 105
    • Best 10
    • Controversial 0
    • Groups 0

    Best posts made by Turbo

    • RE: Unit VAR is shown as VA

      Greetings:

      I gave up on using the built in Units in Mango. They seem to be.. Sort of broken and generally annoying, since there never seems to be the right M/k/u/m type for whatever I'm doing-- Megawatts, kilowatts, whatever. The Best Practice seems to be to just use the Text Renderer Properties, and set the Suffix to Whatever unit you want.

      I tried using the built-in units a number of ways, but I got tired of dealing with the little "dot" for multiplied units which really aren't. I don't remember which unit, but it was something like kwh showing as kw<dot>h.. It's not kilowatt TIMES hours.. Anyways. I've run into trouble with import/export also using built-in units, where m^2 doesn't import right under some conditions (for example). Don't have these troubles using the "text renderer properties" Suffix box

      Yeah. The general practice seems to be "use the text renderer properties"... Makes your life easier.

      posted in Mango feedback
      TurboT
      Turbo
    • Caught a Sad USB to Serial Converter using "Log IO" function...

      Greetings, all:

      I've been using USB to Serial converters on my little Linux Based Mango devices for my business. I've had varying luck by brand, and I figured this is as good a place as any to talk about by mest brand so far, and some troubles they've had.

      The ones I use are the DTech USB 2.0 to RS 422/ RS 485 adapters. These units are based on the FTDI Chipset, and I generally have Good Luck. I've probably installed clost to 50 of these things, with so far 3 failures- One due to a direct lightning hit, and the other two Very Odd, Indeed.

      It's this "very odd indeed" one that I want to comment on, as a sort of Use Case for how Super Useful the "Log IO" function can be in Mango. I was doing final testing on a product that was too ship, and found that the Modbus Serial data source was behaving all weirdly-- Sometimes polling correctly, but generally Failing Wholesale.

      I was just about geared about to post a mango thread about wondering if the latest Modbus module had some bugs in it, but lo and behold, the "Log IO" showed me something was weird.

      So:
      The poll should look like this (Using the CAS Modbus Scanning Tool, if you ever need a Modbus Doodad, that's a great little test tool)
      [22:21:24] => Poll: C8 04 00 00 00 14 E1 9C
      [22:21:25] <= Response: C8 04 28 00 6E 00 9A 08 8D 08 84 08 81 08 8F 08 87 08 A1 00 D4 01 AF 20 E2 00 0E 00 21 00 20 00 00 00 6C 00 00 00 00 00 00 09 28 AD 11

      Mango was seeing this:
      2019/08/29-22:12:21,943 O c80400000014e19c
      2019/08/29-22:12:21,955 I 6feeffffffd73d8efe
      2019/08/29-22:12:22,023 I c80428006e00a708da08d808da
      2019/08/29-22:12:22,025 I 08e708da
      2019/08/29-22:12:22,026 I 08f5
      2019/08/29-22:12:22,027 I 00
      2019/08/29-22:12:22,027 I d401
      2019/08/29-22:12:22,028 I c320
      2019/08/29-22:12:22,049 I e1000a002a00250000007000000000000008f8eb71

      I was thinking-- OKay, maybe there's a bug in the serial driver? You can see Mango originating the proper request "c80400000014e19c " which is a read input registers starting at 0 for 20.

      Then, Mess starts coming back into the device almost immediatly after. You can see the start of my Slave device talking back, "c80428006e00a708da08d808da" .. But before that is this "6feeffffffd73d8efe"

      Turns out that Mess was coming from the RS485 chip-- It looks almost as if the Serial device server isn't actually swapping RX/TX direction (It's a single duplex, 19200 link for this connection), and is scrambling itself up. So I plugged in that USB adapter into my Windows Box, and CAS Modbus Scanner says the same mess:
      [22:19:12] => Poll: C8 04 00 00 00 14 E1 9C
      [22:19:12] <= Response: 6F EE FF FF FF D7 3D 8E FE C8 04 28 00 6E 00 8F 08 6E 08 69 08 5E 08 71 08 65 08 7E 00 D4 01 B6 20 E2 00 0B 00 11 00 0D 00 00 00 6E 00 00 00 00 00 00 09 20 B2 34

      There's the valid poll, followed by the Huge Mess of Whatever.

      This was a brand new converter, right out of the box. If I have a chance, I'll look at it under the microscope and see if I can figure out why it's broken, just for my own edification.

      So: Anyways, lesson learned here: If Mango is showing Bizarre Things with Serial, check your USB adapter first.. I had another one of these adapters fail sort of randomly, and that one is here on the floor next to me. I'll see if this one has the same random problem.

      Speaking of this, does anyone have any other trustworthy but sub $50 USB to Serial 485 devices? There seems to be a certain lack of these things out there that don't suck, and I use a LOT of 485... I've used several brands, and these DTech ones are the least achy-breaky of the ones I've tried. If my projects had higher budgets, I'd be getting Name Branded Units , but I can't justify $300 converters on these devices...

      Cheers,
      -Greg Linder

      posted in How-To
      TurboT
      Turbo
    • RE: Modbus Data Source Modbus Read Data / Write Data/ Point Locator not working right.

      Thanks for the quick updates: @CraigWeb @Jared-Wiltshire

      This fixed the Modbus tools, and I just tested it, so we're good to go. Thanks for that. These tools are Super Useful, as even thought Modbus has been around for longer than I've been alive, people who implement it still can't agree if it's 0-indexed or 1-indexed, or what the actual difference is between holding and input registers are.

      Also, I verified the flashing save Icon issue with multiple tabs... I think I noticed this before, but in my exhausted stupor the previous night I was sort of not thinking straight.

      Thanks!

      posted in User help
      TurboT
      Turbo
    • Can we please get copy and paste back for data sources?

      Greetings, all: In Mango V3 it was possible to copy/paste data sources: Doing so would create a new data source with randomly generated XID's and the points and stuff as well.

      Apparently, in Mango V4, this functionality is no longer present. I made continuous, epic, use of copy and paste for data sources.

      I realize I can Export Json -> Change XID -> Create New Data Source -> Assign XID to JSON -> Import JSON, but this seems like something that maybe should be automated within Mango.

      Does Mango V4 have a way to copy and paste data sources, that I'm not aware of, or is this really a feature that was removed from V3 to V4? I really want there to be a "copy data source" option in the little burger box where the "Export" and "Export with Points" options are. Exporting, JSON, importing by hand in 2022 seems weird to me for "copy and paste" since Mango has had this feature from V1.X up, being removed in V4.

      Unless I'm wrong, and it's hidden somewhere: I was using the "legacy" view back in Mango V3.X, but that legacy view is gone in Mango V4. Are there plans to put copy and paste back in for data sources?

      Cheers,
      -Greg

      posted in Wishlist
      TurboT
      Turbo
    • RE: Getting total kWh from W readings

      @nino-kurtalj

      I calculate this using rollups- You can use the integral rollup type on watts over the time you want. Mango will give you this in watt seconds. Then you can divide that by 3,600 to get watt hours, then scale it as needed.

      Better is to read the kwh raw value out of your metering device, though, if that works for you.

      Here's an example:

      // This runs every hour on the hour to calculate last hours' energy
      var energy = 0;
      
      
      // This sets up and returns 1 hour integral on power
      var values = [];
      var endDate = CONTEXT.getTimestamp();
      var startDate = endDate - CONTEXT.millisInPast(HOURS, 1); // Last 1 HOUR
      var pointToQuery = [ POWER.getDataPointWrapper().getId() ];
      PointValueQuery.rollupQuery( pointToQuery, startDate, endDate, 
        function( value, index ) {
          values.push(value);
        }, com.serotonin.m2m2.Common.Rollups.INTEGRAL, 1, com.serotonin.m2m2.Common.TimePeriods.HOURS);
          
      
      energy = values[0] / 3600000;
      
      
      my = energy;
      
      return my;
      

      I'm not sure if this is the right way to do this, but it works for me.

      posted in How-To
      TurboT
      Turbo
    • RE: Mango V4.4.2 Serial Data Source Escaping CR LF Characters Wrong?

      @MattFox For other folks who come to this thread, I was able to use the Prologix GPIB Ethernet Adapter: https://prologix.biz/product/gpib-ethernet-controller/

      I have a working set of Mango Configs that I've got working to talk SCPI using the GPIB <-> Ethernet device servers to make this work. I originally tried to get this working with the Serial data source, but ran into a host of issues related to this.

      Mango's quite versatile, but apparently the Serial data source chokes on SCPI-style commands- One reason was noted by @MattFox earlier in the thread, but it's also part of a problem with SCPI: Mango expects all data sources to return data, and some (many) SCPI commands don't actually generate an acknowledgement.

      The GPIB <-> Ethernet adapter has the same problem, but the timeouts are faster, and you can use a trick in the Prologix device (++auto 1) to basically stream data into mango in Real Time.

      The Mango config I put together for this is quite large, but if you're looking for SCPI interfacing, I'd imagine this script would work well for Native Ethernet as well as Vintage GPIB devices using an Etherent <-> GPIB device.

      The Prologix one I linked above is the more affordable of the choices- you can just telnet into it, and issue commands, and it spits stuff back. It's actually quite cool.

      posted in User help
      TurboT
      Turbo
    • RE: Data Point - No Update "Alarm"

      @mihairosu Heya: Is there a reason you're not using the "no update" event style type built into the Mango event creation stuff? That will let you just let Mango do that- We use these alarms extensively to detect "stuck" data points:

      daea8489-e4d8-4827-8130-159ee59d3e63-image.png

      posted in User help
      TurboT
      Turbo
    • RE: Using Serial Data Source as MBUS device

      @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:
      79470b9a-a3e7-4957-a605-7c7910570af7-image.png

      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.

      posted in User help
      TurboT
      Turbo
    • RE: Using Serial Data Source as MBUS device

      @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).

      posted in User help
      TurboT
      Turbo
    • RE: Documentation update for SSL / Certbot support for Mango V4.5?

      @Turbo

      Okay: I've figured something out here-
      It seems (to me) like the files in /opt/mango/bin (that you use to set up certbot/ etc) don't seem to be aware of the /opt/mango-data/ files, and don't appear to be updated based on the settings in the

      This just cost me a huge number of hours:

      The instructions for getting the certbot set up (here)
      https://docs-v4.radixiot.com/ssl

      talks about running "/opt/mango/bin/genkey.sh"

      but Genkey doesn't seem to know where the (new) mango.properties default file is (in /opt/mango-data/ by default install from the install script).

      This seems to be present in all the SSL config scripts in /opt/mango/bin- They don't seem to know what is in /opt/mango-data/mango.service (which calls out Environment="mango_config=/opt/mango-data/mango.properties")

      This means if you do anything manually (like installing CertBot), it seems that the shell scripts all seem to default to /opt/mango , and put the key files there instead of in /opt/mango-data/. When you run a manual key creation ("/opt/mango/bin/genkey.sh") it doesn't appear to know what you put in for the password / etc in mango.properties.

      To get us back online, I was able to get the scripts to work by just doing:
      export MA_ENV_PROPERTIES=/opt/mango-data/mango.properties
      then running the genkey.sh, and the files were in the right place.

      Without exporting the variable, the genkey.sh (and the certbot deploy) uses Something Else (not /opt/mango-data/mango.properties, which the Mango V4.5 install script creates).

      I think the scripts may need some tweaking to work with the new Mango file pathnames.

      I (still) don't have my certbot working, since when it runs, it puts the keystore file in /opt/mango, and not in /opt/mango-data/, which is where the service start/stop script wants to find it. I used up all my certs (you have a limit of 5 per few day time period to renew), so I'll try this again once I get this done.

      I'm running this on Ubuntu 22.04 LTS, using BASH as my shell, and I'm running these scripts as superuser.

      This is relevant, as I think the certbot scripting inside Mango uses the "renew" functions in /etc/letsencrypt-

      and each site has a conf file that includes the renew_hook, so it's going to expect to be able to run that certbot-deploysh script. How can I make sure make the certbot stuff works now that that config file is moved to /opt/mango-data?

      Or has this been addressed already?
      This may be as simple as hook="EXPORT MANGO_CONFIG=/opt/mango-data/mango.properties /opt/mango/bin/certbot-deploy.sh

      .. But I don't know. The Mango V4.5 documentation for setting up CERTBOT seems to have very little to do with how this actually needs to be done.

      Cheers,
      -Greg

      posted in User help
      TurboT
      Turbo