• E
    etantonio

    Hy, I can't understand why using Firefox or Edge or Chrome I've the following wrong representation of the datasource page (mango 2.8.8)

    0_1589815080093_3ba37115-f01f-4aca-815d-dbba7ba97045-immagine.png

    instead using old Internet Explorer it is ok

    0_1589815633071_e667d266-31f0-43a4-8778-8c5ad6e205ef-immagine.png

    I think it is due to some update in these browsers because in the past I had no problem with Firefox or Edge or Chrome on the datasource page.

    Thanks for your help,
    Antonio

    posted in Mango Automation general Discussion read more
  • E
    etantonio

    Hy,
    concerning mango 2.8.8 I'm using the following script to show the production of each month of the year

    <div ng-if="energy ==2">
            <ma-point-values point-xid="FML01-energy-smart" point="energyYear" values="energyYearValues"
              from="theTimeNow | moment:'startOf':'year'"
              to="theTimeNow | moment:'endOf':'year'" rollup="DELTA" rollup-interval="1 months">
            </ma-point-values>
            <ma-serial-chart style="height: 250px; width: 98%" series-1-values="energyYearValues"
              default-balloon-text="Monthly Energy: [[value]] kWh" export="true" balloon="true"
              series-1-point="energyYear" series-1-color="#277527" default-type="column" time-format="MMM"
              options="{export: {'dateFormat': 'MM/YYYY', 'fileName': 'Energy in year'},
              valueAxes:[{title:'[kWh]', gridColor:'#444343', axisColor:'#444343',titleColor:'#165A87'}],
              titles:[{text:'Energy chart',color:'#165A87'}],
              categoryAxis:{gridColor:'#444343', axisColor:'#444343', startEffect:'elastic'}
              }">
            </ma-serial-chart>
    

    but the result is not as expected, in fact for example today it is shown only the production of today (300kWh) and not the sum of all January month (8000kWh):

    0_1580479408753_f893baef-f599-4c11-9545-a91f214a8f5d-immagine.png

    Any idea about where's the problem?

    posted in Mango Automation general Discussion read more
  • E
    etantonio

    It's not working for me, I'll solve this repeating the page for any "trackerRowColumn" in the plant instead of creating a template to use for all the plant, thanks anyway.
    Antonio

    posted in Mango Automation general Discussion read more
  • E
    etantonio

    It seems that the first time the page is executed the

    <ma-point-values point-xid="{{plantNameAcronym.value}}_TRK-{{trackerRowColumn.value}}_FML01-power-smart"

    becomes:

    <ma-point-values point-xid="TER_TRK-6.4_FML01-power-smart"

    but ma-point-values is evaluated just when I switch from a graph type to the other.

    I've tried to use ng-init in an outer div to evaluate the point xid before but the result is always a blank graph.

    posted in Mango Automation general Discussion read more
  • E
    etantonio

    Hi,
    I've a chart where I want to show the power of an inverter, this is a template page named "home.html" I want to use it for several different inverter, so I calculate the datapoint xid using other two datapoints "plantNameAcronym" and "trackerRowColumn":

    <div flex layout="column" layout-gt-sm="row" layout-align="space-between" ng-init="live=1; energy=0">
      <md-card flex="100" flex-gt-sm="50">
    
        <md-card-title>
          <md-button ng-class="{'selected': live === 1, 'not-selected':live!==0}" ng-mousedown="live=1; from=theTimeNow">LIVE</md-button>
          <mdp-date-picker mdp-placeholder="Day" ng-click="live=0" mdp-open-on-click="" mdp-format="ll" ng-model="from"></mdp-date-picker>
        </md-card-title>
    
    
        <md-card-content class="graph-content">
          <div ng-if="live ==0">
            <ma-point-values point-xid="{{plantNameAcronym.value}}_TRK-{{trackerRowColumn.value}}_FML01-power-smart" point="powerPast" values="powerPastValues"
                  from="from | moment:'startOf':'day' | moment:'add':3:'hours'"
                  to="from | moment:'endOf':'day'" rollup="LAST" rollup-interval="1 minutes">
             </ma-point-values>
          
          
             <ma-serial-chart style="height: 250px; width: 98%" series-1-values="powerPastValues" series-1-color="#F88F24" series-1-point="powerPast" series-1-type="line"
                legend="false" default-balloon-text="Power: [[value]] kW" balloon="true" export="true"  stack-type="regular"
                options="{export: {'dateFormat': 'DD/MM/YYYY H:mm ', 'fileName': 'Power'},
                titles:[{text:'Power chart',color:'#165A87'}],
                valueAxes:[{title:'[kW]', gridColor:'#444343', axisColor:'#444343',titleColor:'#165A87'}],
                categoryAxis:{gridColor:'#444343', axisColor:'#444343', startEffect:'elastic'}
                    }">
            </ma-serial-chart>
          </div>
    
          <div ng-if="live ==1">
            <ma-point-values point-xid="{{plantNameAcronym.value}}_TRK-{{trackerRowColumn.value}}_FML01-power-smart" point="powerLive" values="powerLiveValues"
              from="theTimeNow | moment:'startOf':'day' | moment:'add':3:'hours'"
              to="theTimeNow" rollup="LAST" rollup-interval="1 minutes">
            </ma-point-values>
    
            <ma-serial-chart style="height: 250px; width: 98%" series-1-values="powerLiveValues" series-1-color="#F88F24" series-1-point="powerLive" series-1-type="line"
              legend="false" default-balloon-text="Power: [[value]] kW" balloon="true" export="true"  stack-type="regular"
              options="{export: {'dateFormat': 'DD/MM/YYYY H:mm ', 'fileName': 'Power'},
              titles:[{text:'Power chart',color:'#165A87'}],
              valueAxes:[{title:'[kW]', gridColor:'#444343', axisColor:'#444343',titleColor:'#165A87'}],
              categoryAxis:{gridColor:'#444343', axisColor:'#444343', startEffect:'elastic'}
              }">
            </ma-serial-chart>
          </div>
        </md-card-content>
      </md-card>
          </div>
    

    instead in another file customized for each inverter (6.4 in this case) I've something like this:

    <ma-get-point-value point-xid="TER_TRK-6.4_ConfigRPI-tracker-rowColumn" point="trackerRowColumn"></ma-get-point-value>
    <ma-get-point-value point-xid="TER_TRK-6.4_ConfigRPI-plantNameAcronym" point="plantNameAcronym"></ma-get-point-value>
    <div ng-include="'templates/home.html'"></div>
    

    My problem is that on first loading (live=1) the graph is not showed

    0_1580222892428_3cf14b86-3940-4d82-b7ae-d20b58a38adf-immagine.png

    but clicking on "Day" an then again on "Live" the graph is showed correctly

    0_1580222974610_5edd3313-d77c-44d3-b981-7cf2213b0c24-immagine.png

    is seems to be an initialization problem but I can't realize where's the problem, using directly point-xid="TER_TRK-6.4_FML01-power-smart" works without problems:

    <ma-point-values point-xid="TER_TRK-6.4_FML01-power-smart" point="powerLive" values="powerLiveValues"
              from="theTimeNow | moment:'startOf':'day' | moment:'add':3:'hours'"
              to="theTimeNow" rollup="LAST" rollup-interval="1 minutes">
            </ma-point-values>
    

    Any idea about how to solve the problem?
    Thanks,
    Antonio

    posted in Mango Automation general Discussion read more
  • E
    etantonio

    Hi,
    I'm using mango 2.8.8,
    I would like to avoid such logs in ma.log

    WARN  2019-10-31 22:27:08,989 (com.serotonin.m2m2.rt.publish.PublishQueue.sizeCheck:101) - Publisher queue Pub_TRK-0.1 discarded 64 entries 
    WARN  2019-10-31 22:27:13,990 (com.serotonin.m2m2.rt.publish.PublishQueue.sizeCheck:101) - Publisher queue Pub_TRK-0.1 discarded 57 entries
    

    this is the publisher configuration:

    0_1573135838713_5d8edb9e-2acf-42b2-a4f6-88b1a62dfbd8-immagine.png

    is there a way to avoid such logs?

    posted in How-To read more
  • E
    etantonio

    yes, you're right, the following code it's ok. thanks,

    var ssdao = new com.serotonin.m2m2.db.dao.SystemSettingsDao();
       ssdao.setValue("emailFromName", "Etantonio");
    

    instead for excelReport:

    var voExcelReport = com.infiniteautomation.mango.excelreports.dao.ExcelReportTemplateDao.instance.getByXid("My_DailyReport")
    voExcelReport.setName("Etantonio")
    com.infiniteautomation.mango.excelreports.dao.ExcelReportTemplateDao.instance.save(voExcelReport);  
    

    Antonio

    posted in Mango Automation general Discussion read more
  • E
    etantonio

    At the end I choose to use a scripting datasource to update datasource properties:

    var dsvoMain = com.serotonin.m2m2.db.dao.DataSourceDao.instance.getByXid("FML01-main");
        dsvoMain.host = "172.16.0.12";
        com.serotonin.m2m2.db.dao.DataSourceDao.instance.saveDataSource(dsvoMain);
    

    and the same for the publisher:

    var voPublisher = com.serotonin.m2m2.db.dao.PublisherDao.instance.getByXid("Pub_TRK-0.1")
        voPublisher.port              = "8811";
        com.serotonin.m2m2.db.dao.PublisherDao.instance.savePublisher(voPublisher);
    

    but I can't update instead systemSettings,
    I've tried with the following:

    com.serotonin.m2m2.db.dao.SystemSettingsDao.setValue("emailFromName", "Etantonio");
    

    but the result is:

    0_1572511885915_c97ce613-c790-42db-ab07-72ec0ef03a57-immagine.png

    but the method seems to be there in

    https://github.com/infiniteautomation/ma-core-public/blob/2.8.x/Core/src/com/serotonin/m2m2/db/dao/SystemSettingsDao.java

    0_1572511990311_1ce1aedf-d313-4853-bcbe-f25636247fd2-immagine.png

    do you have an idea about where's the problem?

    And also, there's a similar way to update excelReport properties on table excelReportTemplates?

    Thanks, Antonio

    posted in Mango Automation general Discussion read more
  • E
    etantonio

    OK, thanks anyway, I will search for a different approach to change datasource properties from outside Mango 2.8. I've tried to read the blob with the following python script:

    #!/usr/bin/python3
    
    import pymysql
    import json
    
    def write_file(data, filename):
        with open(filename, 'wb') as f:
            f.write(data)
    
    
    def read_blob(filename):
        # select photo column of a specific author
        query = "SELECT data FROM mangoTerlizzi.dataSources where xid='FML01-main'"
    
        try:
            # Open database connection
            db = pymysql.connect("localhost","user","pwd","mangoTerlizzi" )
    
            # prepare a cursor object using cursor() method
            cursor = db.cursor()
    
            # execute SQL query using execute() method.
            cursor.execute(query)
            
            # Fetch a single row using fetchone() method.
            data = cursor.fetchone()[0]
      
            # write blob data into a file
            write_file(data, filename)
            
            with open(filename) as json_file:
              data = json.load(json_file)
       
        except Error as e:
            print(e)
     
        finally:
            cursor.close()
            db.close()
            
                    
    
    read_blob("datasourceDescription.json")
    

    but maybe it is not all the stuff, in fact I've the following error:

    solergy@Tracker_0-1:~ $ python3 dbConnection.py
    Traceback (most recent call last):
      File "dbConnection.py", line 34, in read_blob
        data = json.load(json_file)
      File "/usr/lib/python3.5/json/__init__.py", line 265, in load
        return loads(fp.read(),
      File "/usr/lib/python3.5/codecs.py", line 321, in decode
        (result, consumed) = self._buffer_decode(data, self.errors, final)
    UnicodeDecodeError: 'utf-8' codec can't decode byte 0xac in position 0: invalid start byte
    

    posted in Mango Automation general Discussion read more