• AldoRamos

    We have several temperatures we collect, some in Fahrenheit, some in Celsius with the display unit converted to Fahrenheit.

    Is there a practical way for selecting which units to display, on a custom page for example, depending on the user's locale (or preference) etc.?

    posted in How-To read more
  • 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