• AldoRamos

    Thanks @phildunlap

    I did consider that my.lastValue would be returning current values, not historical. I have been working on a more complex function to work with that, but wasn't ready to post it, yet.

    However, the graph I posted was from data created in real-time (not history generation). And I explicitly purged all data before that run executed. I also typically purge and check the "Delete existing data in range" when generating history, to avoid the chance of running into such values.

    Here is the more complex time-traveler version (possibly buggy; I was just throwing stuff together, and haven't gone through with a fine-t0othed comb and debugged yet):

    //LOG.debug(my);
    //var lv = my.lastValue();
    LOG.debug("my.time:\t" + my.time);
    
    var lv = my.pointValueBefore(my.time);
    LOG.debug("lv:\t" + lv.value);
    var lastValue = ((null === lv) ? 0 : lv.value);
    LOG.debug("lastValue:\t" + lastValue);
    
    //var stats = power.past(MINUTE,1);
    var stats = power.getStats(my.time-60000, my.time);
    LOG.debug("stats:\t" + stats);
    
    if ((null === stats))
    {
    LOG.debug("stats:\tnull");
        return lastValue;
    }
    else if ((0 === stats.length) || (0 === stats.count))
    {
    LOG.debug("stats:\tempty");
    LOG.debug("power:\t" + power.pointValueAt(my.time));
        return lastValue + ((power.pointValueAt(my.time)/60)/1000);
    }
    else
    {
    LOG.debug("stats.average:\t" + stats.average);
        return lastValue + ((stats.average/60)/1000);
    }
    

    While I would like having a function I can use for generating history as well as runtime, I would expect at least the simple formula to work, and it would go a long way to helping debug the more complex version.

    posted in Scripting general Discussion read more
  • AldoRamos

    Calculating kWh (using the simple formula given as an example in the forum) and finding drops in the chart, which makes no sense. I have verified that the additive is positive, yet I still see a pattern I cannot explain.

    The formula is simple:

    return my.value + (power.past(MINUTE,1).average/60);
    

    But the result is unexpectedly jagged:
    0_1550697254184_e0eb3ea7-4eb9-47ef-8b12-c7adbce04759-image.png

    I expect this is due to the formula looking back too far for the previous (current) value, but I haven't had any luck calculating a better window. As an example, here is some of what I have been attempting:

    var prev = my.lastValue(0);
    var lastVal = (null === prev) ? my.value : prev.value;
    
    return lastVal + (power.value/60);
    

    FWIW, the data point is not set to update the context; instead, it's set to update every minute.

    Any clarification is greatly appreciated.

    Thanks,

    Aldo

    posted in Scripting general Discussion read more
  • AldoRamos

    I take it back, @MattFox ; apparently the CORS configuration IS necessary. Suddenly found it failing again, and sure enough enabling CORS did the trick.

    I really do go through these tests in a methodical manner, but somehow I'm losing the sequence today.

    Thanks to all who helped me get through this.

    posted in Dashboard Designer & Custom AngularJS Pages read more
  • AldoRamos

    @mattfox Yes, the proxy configuration is exactly what I needed. The CORS configuration didn't seem to help.

    posted in Dashboard Designer & Custom AngularJS Pages read more
  • AldoRamos

    I apologize for not mentioning the proxy. I didn't even think of it, since it had been working previously (and in development I often switch back and forth between proxy and VPN).

    I believe I upgraded from 3.4.1 (no longer have logs to confirm exactly). But I explicitly tested that page before & after to confirm this change in behavior.

    The ma.log shows nothing relevant (no entries except for JSON File Import Job.)

    @MattFox adding CORS configuration made no difference (except locking me out until I opened it up globally).

    Adding the following configuration to the VirtualHost configuration fixes it:

        RewriteEngine On
        RewriteCond %{HTTP:Connection} Upgrade [NC]
        RewriteCond %{HTTP:Upgrade} websocket [NC]
        RewriteRule /(.*) ws://internal.mangoserver.com:8080/$1 [P,L]
    
    

    I apologize for the confusion, but due to some similar issues with another Mango server, I explicitly tested it with this configuration before and after upgrading, which is why I listed the symptoms (and my diagnosis) as I did.

    Bottom line, it's working. Why? uhh.... It's working! ;-)

    posted in Dashboard Designer & Custom AngularJS Pages read more
  • AldoRamos

    Curious. I checked the console, and found the following error:

    WebSocket connection to 'wss://external.mangoserver.com/rest/v1/websocket/point-value' failed: Error during WebSocket handshake: Unexpected response code: 403
    

    This goes through an Apache proxy, which has been working fine up until this upgrade.

    So I connected directly using a VPN, and sure enough it works fine.

    This is a Mango installation running behind a firewall, for various reasons, using the proxy to make it visible to the world. What can be done to get the proxy working again?

    posted in Dashboard Designer & Custom AngularJS Pages read more
  • AldoRamos

    Just upgraded a system to 3.5.5 and noticed problems with several items, but the clearest example is to try the Live Values examples: http://localhost:8080/ui/examples/basics/live-values

    The drop-down datapoints is populated, but the “values” do not

    posted in Dashboard Designer & Custom AngularJS Pages read more
  • AldoRamos

    Heads up: this issue appears to have resurfaced; the same solution still works, but download the latest version: https://github.com/kriszyp/xstyle

    posted in Mango feedback read more
  • AldoRamos

    I didn't find this earlier when searching, but this seems to be similar to unable to discover a bacnet device on my network, specifically in the brief window of apparently successful operation when saving or enabling the publisher.

    posted in User help read more
  • AldoRamos

    We've been experiencing some interesting quirks getting BACnet talking between devices. We have tested between two separate Mango servers, and thought we'd resolved the issue, but when a customer ran into it, (Mango as BACnet publisher, 3rd party software client) I had to dig back in.

    To make a long story medium, our EdgeServer has multiple interfaces:

    • eth0 (Device Area Network) for industrial devices (PLCs, etc)
    • eth1 (LAN/WAN) for interwebz routing
    • wwan0 (4GLTE) for wireless interwebz

    As I was exploring, I noticed that default routes for both eth1 and wwan0. This is to be expected, since both get gateway settings from DHCP. What was unexpected was how the BACnet publisher was horribly unreliable when the wwan0 route had a lower metric (higher priority) than the eth1 route (client is on the LAN with eth1, same subnet). There is no way the gateway route should even come into play when there is an explicit route for the subnet. But when I changed the priorities of the default routes, the results speak for themselves.

    Any thoughts or explanations for this behavior? Suggestions? Has anyone come across this?

    posted in User help read more