• ThomasEinasto

    Hi @Phillip-Weeks ,

    One can create a new usermodule component to handle like ng-init.

    userModule.component('gettime', {
        bindings:{
            timestampIn: '@?',
            tsFormat: '@?',
            newDateo: '=?',
            newDates: '=?'
        },
        controller:['$scope',
            function($scope){
    
                $scope.$watch('$ctrl.timestampIn', () => {
    
                    let dateobject = moment(this.timestampIn);
                    
                    let datestring = moment(this.timestampIn).format(this.tsFormat);
                    
                    if (typeof this.timestampIn !== "undefined"){
                        
                            this.newDateo = dateobject;
                            this.newDates = datestring;
                            
                            //console.log(typeof(this.newDateo)); << returns dateobject
                            //console.log(typeof(this.newDates)); << returns string
                    }
                    
                }, true);
            
            
        }]
        
    });
    
    

    new-dateo is date object which you should be able to use as your date.from / date.to variable.
    new-dates is date string which is formatted like you want based on momentjs format function.

    Usage in dashboard:

    <gettime timestamp-in="10/05/2019 22:10:10" ts-format="DD/MM/YYYY HH:mm:ss" new-dateo="js" new-dates="jss"></gettime>
    
    {{js}}
    <br>
    {{jss}}
    

    Result in dashboard:

    Sat Oct 05 2019 22:10:10 GMT+0300
    05/10/2019 22:10:10
    

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

    @ORU_david To put 74 ° you should probably write 740 but I am not sure if the value put into the modbus request is actually a 2 byte integer or a floating point,

    i.e does Mango parseInt the value after multiplier + additive before putting it into the modbus request or not..

    IAS staff could be of more help on that.

    posted in How-To read more
  • ThomasEinasto

    If we are talking about MC6 Test Stat: MC6 Stat - Space temp point then following is related.

    Transcript from modbus documentation:
    See here for more info: http://www.simplymodbus.ca/exceptions.htm
    03 (03 hex) Illegal Data Value
    A value contained in the query data field is not an allowable value for the slave. This indicates a fault in the structure of remainder of a complex request, such as that the implied length is incorrect. It specifically does NOT mean that a data item submitted for storage in a register has a value outside the expectation of the application program, since the MODBUS protocol is unaware of the significance of any particular value of any particular register.

    Please see that your multiplier and additive is actually as it should. Device responds to mango that the value you want to write is not allowed.

    Edit: I looked at your previous point and it seems that we are actually talking about the same point. If you click on info icon on the datapoint edit page you can see documentation related to multiplier and additive.

    The Multiplier and Additive fields can be used when trivial value conversions are required. Numeric values read from the network are calculated as follows: (raw value) * multiplier + additive. The reverse is applied when a numeric value is written to the network.

    So generally speaking. You have to consider the multiplier you set to the point and also modbus 2 byte integers take integer values not floating values.

    posted in How-To read more
  • ThomasEinasto

    Hi @ORU_david

    What does your browser console say?

    i.e do you get any errors there ex: permission rights etc?

    Do any events also happen in events table?

    i.e modbus error exceptions illegal data value or something similar?

    Then we can help more.

    posted in How-To read more
  • ThomasEinasto

    Hi Bela,

    I assume you are trying to use the new UI dashboards?

    If so take a look at /ui/examples/basics/style-via-value

    Following is there:

    <style>
        .default {
            background-color: black;
            color: white;
        }
    
        .good {
            background-color: green;
        }
    
        .warn {
            background-color: orange;
        }
    
        .bad {
            background-color: red;
        }
    </style>
    
    <ma-filtering-point-list ng-model="myPoint" auto-init="true" data-type="NUMERIC"></ma-filtering-point-list>
    
    <h3>CSS class based on range (numeric points)</h3>
    <div class="default" ng-class="{'good': myPoint.value < 100, 'warn': myPoint.value >= 100 &amp;&amp; myPoint.value < 200, 'bad': myPoint.value >= 200}">
        <label>Point value:</label>
        <ma-point-value point="myPoint"></ma-point-value>
    </div>
    
    <h3>CSS class based on exact value (multistate/binary points)</h3>
    <div class="default" ng-class="{'good': myPoint.value === 0, 'warn': myPoint.value === 1, 'bad': myPoint.value === 2}">
        <label>Point value:</label>
        <ma-point-value point="myPoint"></ma-point-value>
    </div>
    
    <h3>Hide/show based on value</h3>
    <div class="default good" ng-show="myPoint.value === 0">
        <label>Point value:</label>
        <ma-point-value point="myPoint"></ma-point-value>
    </div>
    <div class="default bad" ng-hide="myPoint.value === 0">
        <label>Point value:</label>
        <ma-point-value point="myPoint"></ma-point-value>
    </div>
    
    <h3>Switch based on value</h3>
    <div ng-switch="myPoint.value">
        <div ng-switch-when="0">Point is zero</div>
        <div ng-switch-when="1">Point is one</div>
        <div ng-switch-default>Point has other value</div>
    </div>
    

    Here is documentation about the directive used in example. https://docs.angularjs.org/api/ng/directive/ngClass

    Example about your case.

    <style>
    
        .default {
            background-color: black;
            color: white;
        }
    
        .ONclass{
            background-color: green;
        }
    
        .OFFclass {
            background-color: orange;
        }
    
    
    </style>
    <!-- Get our point from Mango -->
    <ma-get-point-value point-xid="MQTTdeviceXID" point="MQTTdevice"></ma-get-point-value>
    
    <div class="default" ng-class="{'ONclass': MQTTdevice.value === 'ON', 'OFFclass': MQTTdevice.value === 'OFF'}">
        <label>Point value:</label>
        <ma-point-value point="MQTTdevice"></ma-point-value>
    </div>
    
    

    One can also do it another way without using class but using ngStyle i.e https://docs.angularjs.org/api/ng/directive/ngStyle

    <!-- Get our point from Mango -->
    <ma-get-point-value point-xid="MQTTdeviceXID" point="MQTTdevice"></ma-get-point-value>
    
    <!-- if ON then green else red -->
    <div class="default" ng-style="{ background-color: MQTTdevice.value == 'ON' ? 'green' : 'red' }">
        <label>Point value:</label>
        <ma-point-value point="MQTTdevice"></ma-point-value>
    </div>
    
    

    posted in User help read more
  • ThomasEinasto

    Dear Jared

    Sorry for the confusion.

    If this solution is used then output for <ma-point-values> and <ma-point-statistics> is not present on the page which is why I asked the question in the first place.

    Simple markup of the start of the page:

    <ma-get-point-value point="S1_S1" point-xid="ID28S1" ng-init="cableid = 1"></ma-get-point-value>
    <ma-get-point-value point="S1_S2" point-xid="ID28S2"></ma-get-point-value>
    <ma-get-point-value point="S1_S3" point-xid="ID28S3"></ma-get-point-value>
    <ma-get-point-value point="S1_S4" point-xid="ID28S4"></ma-get-point-value>
    
    
    <ma-get-point-value point="S1_S1_2" point-xid="ID29S1"></ma-get-point-value>
    <ma-get-point-value point="S1_S2_2" point-xid="ID29S2"></ma-get-point-value>
    <ma-get-point-value point="S1_S3_2" point-xid="ID29S3"></ma-get-point-value>
    <ma-get-point-value point="S1_S4_2" point-xid="ID29S4"></ma-get-point-value>
    
    <div ng-if="cableid == 1">
        
    <ma-point-values point="S1_S1" values="point1Values" from="dateBar.from" to="dateBar.to" rollup="{{dateBar.rollupType}}" rollup-interval="{{dateBar.rollupIntervals}} {{dateBar.rollupIntervalPeriod}}">
    </ma-point-values>
    <ma-point-values point="S1_S2" values="point2Values" from="dateBar.from" to="dateBar.to" rollup="{{dateBar.rollupType}}" rollup-interval="{{dateBar.rollupIntervals}} {{dateBar.rollupIntervalPeriod}}">
    </ma-point-values>
    <ma-point-values point="S1_S3" values="point3Values" from="dateBar.from" to="dateBar.to" rollup="{{dateBar.rollupType}}" rollup-interval="{{dateBar.rollupIntervals}} {{dateBar.rollupIntervalPeriod}}">
    </ma-point-values>
    <ma-point-values point="S1_S4" values="point4Values" from="dateBar.from" to="dateBar.to" rollup="{{dateBar.rollupType}}" rollup-interval="{{dateBar.rollupIntervals}} {{dateBar.rollupIntervalPeriod}}">
    </ma-point-values>
    <ma-point-values point="S1_S5" values="point5Values" from="dateBar.from" to="dateBar.to" rollup="{{dateBar.rollupType}}" rollup-interval="{{dateBar.rollupIntervals}} {{dateBar.rollupIntervalPeriod}}">
    </ma-point-values>
    <ma-point-statistics point="S1_S1" from="dateBar.from" to="dateBar.to" statistics="statsObj1"></ma-point-statistics>
    <ma-point-statistics point="S1_S2" from="dateBar.from" to="dateBar.to" statistics="statsObj2"></ma-point-statistics>
    <ma-point-statistics point="S1_S3" from="dateBar.from" to="dateBar.to" statistics="statsObj3"></ma-point-statistics>
    <ma-point-statistics point="S1_S4" from="dateBar.from" to="dateBar.to" statistics="statsObj4"></ma-point-statistics>
    </div>
    
    <div ng-if="cableid == 2">
        
    <ma-point-values point="S1_S1_2" values="point1Values" from="dateBar.from" to="dateBar.to" rollup="{{dateBar.rollupType}}" rollup-interval="{{dateBar.rollupIntervals}} {{dateBar.rollupIntervalPeriod}}">
    </ma-point-values>
    <ma-point-values point="S1_S2_2" values="point2Values" from="dateBar.from" to="dateBar.to" rollup="{{dateBar.rollupType}}" rollup-interval="{{dateBar.rollupIntervals}} {{dateBar.rollupIntervalPeriod}}">
    </ma-point-values>
    <ma-point-values point="S1_S3_2" values="point3Values" from="dateBar.from" to="dateBar.to" rollup="{{dateBar.rollupType}}" rollup-interval="{{dateBar.rollupIntervals}} {{dateBar.rollupIntervalPeriod}}">
    </ma-point-values>
    <ma-point-values point="S1_S4_2" values="point4Values" from="dateBar.from" to="dateBar.to" rollup="{{dateBar.rollupType}}" rollup-interval="{{dateBar.rollupIntervals}} {{dateBar.rollupIntervalPeriod}}">
    </ma-point-values>
    <ma-point-values point="S1_S5_2" values="point5Values" from="dateBar.from" to="dateBar.to" rollup="{{dateBar.rollupType}}" rollup-interval="{{dateBar.rollupIntervals}} {{dateBar.rollupIntervalPeriod}}">
    </ma-point-values>   
    
    <ma-point-statistics point="S1_S1_2" from="dateBar.from" to="dateBar.to" statistics="statsObj1"></ma-point-statistics>
    <ma-point-statistics point="S1_S2_2" from="dateBar.from" to="dateBar.to" statistics="statsObj2"></ma-point-statistics>
    <ma-point-statistics point="S1_S3_2" from="dateBar.from" to="dateBar.to" statistics="statsObj3"></ma-point-statistics>
    <ma-point-statistics point="S1_S4_2" from="dateBar.from" to="dateBar.to" statistics="statsObj4"></ma-point-statistics>  
    
    
    </div>
    
    
    {{point1Values}}
    
    {{statsObj1}}
    
    
    

    I should see values at the bottom of the page which are related to cableid = 1, shouldn't I ?

    <ma-get-point-value> is working correctly and shows the latest values via

    {{S1_s1.value}}
    

    If I bring these directives out of the <div ng-if="cableid==1"> or <div ng-if="cableid==2"> then the output for <ma-point-values> and <ma-point-statistics> work as they should.

    Also:

    core is 3.6.4, advanced components is 3.6.0

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

    Dear staff,

    I have a question for creating my page. So I have created a page where I have a local variable inside the page which can be switched by a click of a button.

    So i would like to put <ma-point-values> and <ma-point-statistics> inside a div which is created using ng-if. i.e something like this.

    <div ng-if="cableid == 1">
        
    <ma-point-values point="S1_S1" values="point1Values" from="dateBar.from" to="dateBar.to" rollup="{{dateBar.rollupType}}" rollup-interval="{{dateBar.rollupIntervals}} {{dateBar.rollupIntervalPeriod}}">
    </ma-point-values>
    <ma-point-values point="S1_S2" values="point2Values" from="dateBar.from" to="dateBar.to" rollup="{{dateBar.rollupType}}" rollup-interval="{{dateBar.rollupIntervals}} {{dateBar.rollupIntervalPeriod}}">
    </ma-point-values>
    <ma-point-values point="S1_S3" values="point3Values" from="dateBar.from" to="dateBar.to" rollup="{{dateBar.rollupType}}" rollup-interval="{{dateBar.rollupIntervals}} {{dateBar.rollupIntervalPeriod}}">
    </ma-point-values>
    <ma-point-values point="S1_S4" values="point4Values" from="dateBar.from" to="dateBar.to" rollup="{{dateBar.rollupType}}" rollup-interval="{{dateBar.rollupIntervals}} {{dateBar.rollupIntervalPeriod}}">
    </ma-point-values>
    <ma-point-values point="S1_S5" values="point5Values" from="dateBar.from" to="dateBar.to" rollup="{{dateBar.rollupType}}" rollup-interval="{{dateBar.rollupIntervals}} {{dateBar.rollupIntervalPeriod}}">
    </ma-point-values>
    <ma-point-statistics point="S1_S1" from="dateBar.from" to="dateBar.to" statistics="statsObj1"></ma-point-statistics>
    <ma-point-statistics point="S1_S2" from="dateBar.from" to="dateBar.to" statistics="statsObj2"></ma-point-statistics>
    <ma-point-statistics point="S1_S3" from="dateBar.from" to="dateBar.to" statistics="statsObj3"></ma-point-statistics>
    <ma-point-statistics point="S1_S4" from="dateBar.from" to="dateBar.to" statistics="statsObj4"></ma-point-statistics>
    </div>
    
    <div ng-if="cableid == 2">
        
    <ma-point-values point="S1_S1_2" values="point1Values" from="dateBar.from" to="dateBar.to" rollup="{{dateBar.rollupType}}" rollup-interval="{{dateBar.rollupIntervals}} {{dateBar.rollupIntervalPeriod}}">
    </ma-point-values>
    <ma-point-values point="S1_S2_2" values="point2Values" from="dateBar.from" to="dateBar.to" rollup="{{dateBar.rollupType}}" rollup-interval="{{dateBar.rollupIntervals}} {{dateBar.rollupIntervalPeriod}}">
    </ma-point-values>
    <ma-point-values point="S1_S3_2" values="point3Values" from="dateBar.from" to="dateBar.to" rollup="{{dateBar.rollupType}}" rollup-interval="{{dateBar.rollupIntervals}} {{dateBar.rollupIntervalPeriod}}">
    </ma-point-values>
    <ma-point-values point="S1_S4_2" values="point4Values" from="dateBar.from" to="dateBar.to" rollup="{{dateBar.rollupType}}" rollup-interval="{{dateBar.rollupIntervals}} {{dateBar.rollupIntervalPeriod}}">
    </ma-point-values>
    <ma-point-values point="S1_S5_2" values="point5Values" from="dateBar.from" to="dateBar.to" rollup="{{dateBar.rollupType}}" rollup-interval="{{dateBar.rollupIntervals}} {{dateBar.rollupIntervalPeriod}}">
    </ma-point-values>   
    
    <ma-point-statistics point="S1_S1_2" from="dateBar.from" to="dateBar.to" statistics="statsObj1"></ma-point-statistics>
    <ma-point-statistics point="S1_S2_2" from="dateBar.from" to="dateBar.to" statistics="statsObj2"></ma-point-statistics>
    <ma-point-statistics point="S1_S3_2" from="dateBar.from" to="dateBar.to" statistics="statsObj3"></ma-point-statistics>
    <ma-point-statistics point="S1_S4_2" from="dateBar.from" to="dateBar.to" statistics="statsObj4"></ma-point-statistics>  
    
    
    </div>
    

    This is required because on some pages we might have too many datapoints and then I assume that the UI would get sluggish and slow if all points are queried.

    So do I have to create a custom module which uses these directives? Because currently this is not working as I would like to.

    Thanks,
    Thomas

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

    Dear IAS staff,

    Is it possible to use <ma-heat-map> with multiple datapoints showing current measured heatmap?

    General idea is to use multiple datapoints and then arrange them into the heatmap to show measurement uniformity of that object.

    As an example found in the internet, this shows multiple sets of data on the x scale but one dataset would be sufficient if it is possible easily:

    0_1571397233557_b5aecc3a-05f5-4d1b-bbea-b1e2c75c81a0-image.png

    Edit: Actually quite stupid question because this can be solved with ng-style and HSL coloring. D3 styling just creates nice gradients which is nice.

    Example:

        <div ng-style="{'background-color': 'hsl('+ CPUTEMP1.value / 85 * 350 + ', 100%, 70.5%)'}" layout-fill>
        <span ng-bind="CPUTEMP1.value"></span>
        </div>
        <div ng-style="{'background-color': 'hsl('+ CPUTEMP2.value / 85 * 350 + ', 100%, 70.5%)'}" layout-fill>
        <span ng-bind="CPUTEMP2.value"></span>
        </div>
        <div ng-style="{'background-color': 'hsl('+ CPUTEMP3.value / 85 * 350 + ', 100%, 70.5%)'}" layout-fill>
        <span ng-bind="CPUTEMP3.value"></span>
        </div>
        <div ng-style="{'background-color': 'hsl('+ CPUTEMP4.value / 85 * 350 + ', 100%, 70.5%)'}" layout-fill>
        <span ng-bind="CPUTEMP4.value"></span>
        </div>
        <div ng-style="{'background-color': 'hsl('+ CPUTEMP5.value / 85 * 350 + ', 100%, 70.5%)'}" layout-fill>
        <span ng-bind="CPUTEMP5.value"></span>
        </div>
    

    Thanks
    Thomas

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

    @HSAcontrols

    Using nano is more comfortable in my opinon. It is also nice to install midnight-commander to your Linux env for easier navigation in the system.

    // Installing midnight commander via apt-get
    apt-get install mc
    
    // running midnight commander with sudo rights for editing system files
    sudo mc
    

    I also recommend configuring your midnight-commander so that when you leave your instance it stays in the directory you left it in, see here section "hold your horses" : http://klimer.eu/2015/05/01/use-midnight-commander-like-a-pro/

    The link also gives you an overview of what midnight commander has to offer.

    posted in Development general discussion read more