• MattFox

    Normally yes but I am not certain if $window or $location is injected into the $scope...

    posted in User help read more
  • MattFox

    SUCCESSS!

    [
      {
        "cached": true,
        "dataType": "ALPHANUMERIC",
        "value": "{\"serialNo\":\"SERIAL\",\"timestamp\":1582254900000,\"water\":{\"volume\":\"205612\",\"flow\":{\"avg\":27}}}",
        "timestamp": 1582254900000,
        "annotation": null
      },
      {
        "cached": true,
        "dataType": "ALPHANUMERIC",
        "value": "{\"serialNo\":\"SERIAL\",\"timestamp\":1582254000000,\"water\":{\"volume\":\"205584\",\"flow\":{\"avg\":28}}}",
        "timestamp": 1582254000000,
        "annotation": null
      },
      {
        "cached": true,
        "dataType": "ALPHANUMERIC",
        "value": "{\"serialNo\":\"SERIAL\",\"timestamp\":1582253100000,\"water\":{\"volume\":\"205556\",\"flow\":{\"avg\":28}}}",
        "timestamp": 1582253100000,
        "annotation": null
      },
      {
        "cached": true,
        "dataType": "ALPHANUMERIC",
        "value": "{\"serialNo\":\"SERIAL\",\"timestamp\":1582252200000,\"water\":{\"volume\":\"205529\",\"flow\":{\"avg\":27}}}",
        "timestamp": 1582252200000,
        "annotation": null
      },
      {
        "cached": true,
        "dataType": "ALPHANUMERIC",
        "value": "{\"serialNo\":\"SERIAL\",\"timestamp\":1582251300000,\"water\":{\"volume\":\"205501\",\"flow\":{\"avg\":28}}}",
        "timestamp": 1582251300000,
        "annotation": null
      },
      {
        "cached": true,
        "dataType": "ALPHANUMERIC",
        "value": "{\"serialNo\":\"SERIAL\",\"timestamp\":1582250400000,\"water\":{\"volume\":\"205474\",\"flow\":{\"avg\":27}}}",
        "timestamp": 1582250400000,
        "annotation": null
      },
      {
        "cached": true,
        "dataType": "ALPHANUMERIC",
        "value": "{\"serialNo\":\"SERIAL\",\"timestamp\":1582249500000,\"water\":{\"volume\":\"205446\",\"flow\":{\"avg\":28}}}",
        "timestamp": 1582249500000,
        "annotation": null
      },
      {
        "cached": true,
        "dataType": "ALPHANUMERIC",
        "value": "{\"serialNo\":\"SERIAL\",\"timestamp\":1582248600000,\"water\":{\"volume\":\"205419\",\"flow\":{\"avg\":27}}}",
        "timestamp": 1582248600000,
        "annotation": null
      },
      {
        "cached": true,
        "dataType": "ALPHANUMERIC",
        "value": "{\"serialNo\":\"SERIAL\",\"timestamp\":1582247700000,\"water\":{\"volume\":\"205391\",\"flow\":{\"avg\":28}}}",
        "timestamp": 1582247700000,
        "annotation": null
      },
      {
        "cached": true,
        "dataType": "ALPHANUMERIC",
        "value": "{\"serialNo\":\"SERIAL\",\"timestamp\":1582246800000,\"water\":{\"volume\":\"205363\",\"flow\":{\"avg\":28}}}",
        "timestamp": 1582246800000,
        "annotation": null
      }
    ]
    

    If you're out my way, i'll buy you a drink!

    posted in User help read more
  • MattFox

    Done I'll monitor this when it comes through in the next 30 minutes. Thanks for your support here!

    posted in User help read more
  • MattFox

    Shoot that was only 1.... man oh man

    posted in User help read more
  • MattFox

    @terrypacker said in Multiple point values inserted via API all use latest timestamp inside metapoint:

    UPDATE: I just remembered that even if you are using a cache it may not be large enough to hold what you are inserting. When inserting a lot of values if they don't go into the cache immediately they can get put into the Batch Queue for writing to the DB. If that happens you won't get them if your script is executing. If I am correct then increasing the queue size on the context point will allow you to retain enough values in memory while they burst in.

    oh is that referring to the Default cache size?

    posted in User help read more
  • MattFox

    Sorry Terry, but I did as you instructed prior to ensure all would go in:

    var ts = CONTEXT.timestamp;
    var start = getSeasonStart(Number(ts));	
    	 var end = new Date(Number(ts));
    	 var value = volume.pointValueAt(ts,true);
    	 
    //	 var xid= volume.getDataPointWrapper().xid;
       // var tags = volume.getDataPointWrapper().tags;
        var stats = volume.getStats( start.getTime(), end.getTime(),true);
    		data={"serialNo": "serial",   //  "id to identify the unit that reports the data
               "timestamp": ts, // timestamp in UTC ISO!!!
                "water": {
                  "volume": String(stats.sum/1000) // volume in m3
                ,"flow":{
    		        "avg":value.doubleValue?value.doubleValue*(1/(15*60)).toFixed(3) : 0
    		        }
    		    }
    		};
    	LOG.info(volume.time);LOG.info(volume.value);
    	//var out = buildPost(JSON.stringify(data));
    	LOG.info(start);
    	LOG.info(CONTEXT.timestamp);
    LOG.info(volume.last(5, true)); 
    return JSON.stringify(data);
    

    posted in User help read more
  • MattFox

    Thanks Terry, we'll find out in the next 20 or so minutes when the next batch fires in!
    EDIT: Voila, hrm should have just let it be those logs...

    	LOG.info(volume.time);LOG.info(volume.value);
    	//var out = buildPost(JSON.stringify(data));
    	LOG.info(start);
    	LOG.info(CONTEXT.timestamp);
    LOG.info(volume.last(5, true));
    
    
    INFO 2020-02-21 14:44:47,798 - 1582246800000
    INFO 2020-02-21 14:44:47,877 - [PointValueTime(27000.0@2020/02/21 14:30:00.000), PointValueTime(28000.0@2020/02/21 14:15:00.000), PointValueTime(28000.0@2020/02/21 14:00:00.000), PointValueTime(27000.0@2020/02/21 13:45:00.000), PointValueTime(28000.0@2020/02/21 13:30:00.000)]
    
    INFO 2020-02-21 14:44:48,675 - //1582248600000
    INFO 2020-02-21 14:44:48,700 - //27000.0
    INFO 2020-02-21 14:44:48,713 - //[Date 2019-06-30T12:00:00.000Z]
    
    INFO 2020-02-21 14:44:48,738 - 1582247700000
    INFO 2020-02-21 14:44:48,766 - [PointValueTime(27000.0@2020/02/21 14:30:00.000), PointValueTime(28000.0@2020/02/21 14:15:00.000), PointValueTime(28000.0@2020/02/21 14:00:00.000), PointValueTime(27000.0@2020/02/21 13:45:00.000), PointValueTime(28000.0@2020/02/21 13:30:00.000)]
    
    INFO 2020-02-21 14:44:48,910 - //1582248600000
    INFO 2020-02-21 14:44:48,910 - //27000.0
    INFO 2020-02-21 14:44:48,910 - //[Date 2019-06-30T12:00:00.000Z]
    
    INFO 2020-02-21 14:44:48,910 - 1582248600000
    INFO 2020-02-21 14:44:48,910 - [PointValueTime(27000.0@2020/02/21 14:30:00.000), PointValueTime(28000.0@2020/02/21 14:15:00.000), PointValueTime(28000.0@2020/02/21 14:00:00.000), PointValueTime(27000.0@2020/02/21 13:45:00.000), PointValueTime(28000.0@2020/02/21 13:30:00.000)]
    
    INFO 2020-02-21 14:45:52,386 - //1582249500000
    INFO 2020-02-21 14:45:52,386 - //28000.0
    INFO 2020-02-21 14:45:52,386 - //[Date 2019-06-30T12:00:00.000Z]
    
    INFO 2020-02-21 14:45:52,386 - 1582249500000
    INFO 2020-02-21 14:45:52,386 - [PointValueTime(28000.0@2020/02/21 14:45:00.000), PointValueTime(27000.0@2020/02/21 14:30:00.000), PointValueTime(28000.0@2020/02/21 14:15:00.000), PointValueTime(28000.0@2020/02/21 14:00:00.000), PointValueTime(27000.0@2020/02/21 13:45:00.000)]
    
    

    It honestly looks like it's not updating the way it should be...

    posted in User help read more
  • MattFox

    I'll look for you right now:
    Original Point

    [
      {
        "cached": true,
        "dataType": "NUMERIC",
        "value": 27000,
        "timestamp": 1582245900000,
        "annotation": ""
      },
      {
        "cached": true,
        "dataType": "NUMERIC",
        "value": 28000,
        "timestamp": 1582245000000,
        "annotation": ""
      },
      {
        "cached": true,
        "dataType": "NUMERIC",
        "value": 27000,
        "timestamp": 1582244100000,
        "annotation": ""
      },
      {
        "cached": true,
        "dataType": "NUMERIC",
        "value": 27000,
        "timestamp": 1582243200000,
        "annotation": ""
      },
      {
        "cached": true,
        "dataType": "NUMERIC",
        "value": 28000,
        "timestamp": 1582242300000,
        "annotation": ""
      },
    
    

    Meta point:

    [
      {
        "cached": true,
        "dataType": "ALPHANUMERIC",
        "value": "{\"serialNo\":\"SERIAL\",\"timestamp\":1582245900000,\"water\":{\"volume\":\"205336\",\"flow\":{\"avg\":27}}}",
        "timestamp": 1582245900000,
        "annotation": null
      },
      {
        "cached": false,
        "dataType": "ALPHANUMERIC",
        "value": "{\"serialNo\":\"SERIAL\",\"timestamp\":1582245900000,\"water\":{\"volume\":\"205336\",\"flow\":{\"avg\":27}}}",
        "timestamp": 1582245000000,
        "annotation": null
      },
      {
        "cached": false,
        "dataType": "ALPHANUMERIC",
        "value": "{\"serialNo\":\"SERIAL\",\"timestamp\":1582245900000,\"water\":{\"volume\":\"205336\",\"flow\":{\"avg\":27}}}",
        "timestamp": 1582244100000,
        "annotation": null
      },
      {
        "cached": false,
        "dataType": "ALPHANUMERIC",
        "value": "{\"serialNo\":\"SERIAL\",\"timestamp\":1582245900000,\"water\":{\"volume\":\"205336\",\"flow\":{\"avg\":27}}}",
        "timestamp": 1582243200000,
        "annotation": null
      },
      {
        "cached": false,
        "dataType": "ALPHANUMERIC",
        "value": "{\"serialNo\":\"SERIAL\",\"timestamp\":1582242300000,\"water\":{\"volume\":\"205226\",\"flow\":{\"avg\":28}}}",
        "timestamp": 1582242300000,
        "annotation": null
      },
      {
        "cached": false,
        "dataType": "ALPHANUMERIC",
        "value": "{\"serialNo\":\"SERIAL\",\"timestamp\":1582242300000,\"water\":{\"volume\":\"205226\",\"flow\":{\"avg\":28}}}",
        "timestamp": 1582241400000,
        "annotation": null
      },
      {
        "cached": false,
        "dataType": "ALPHANUMERIC",
        "value": "{\"serialNo\":\"SERIAL\",\"timestamp\":1582242300000,\"water\":{\"volume\":\"205226\",\"flow\":{\"avg\":28}}}",
        "timestamp": 1582240500000,
        "annotation": null
      },
      {
        "cached": false,
        "dataType": "ALPHANUMERIC",
        "value": "{\"serialNo\":\"SERIAL\",\"timestamp\":1582239600000,\"water\":{\"volume\":\"205143\",\"flow\":{\"avg\":28}}}",
        "timestamp": 1582239600000,
        "annotation": null
      },
    

    posted in User help read more
  • MattFox

    This is what swagger shows from a latest point values export:

    [
      {
        "cached": true,
        "dataType": "ALPHANUMERIC",
        "value": "{\"serialNo\":\"serialHERE\",\"timestamp\":1582242300000,\"water\":{\"volume\":\"205226\",\"flow\":{\"avg\":28}}}",
        "timestamp": 1582242300000,
        "annotation": null
      },
      {
        "cached": false,
        "dataType": "ALPHANUMERIC",
        "value": "{\"serialNo\":\"serialHERE\",\"timestamp\":1582242300000,\"water\":{\"volume\":\"205226\",\"flow\":{\"avg\":28}}}",
        "timestamp": 1582241400000,
        "annotation": null
      },
      {
        "cached": false,
        "dataType": "ALPHANUMERIC",
        "value": "{\"serialNo\":\"serialHERE\",\"timestamp\":1582242300000,\"water\":{\"volume\":\"205226\",\"flow\":{\"avg\":28}}}",
        "timestamp": 1582240500000,
        "annotation": null
      },
      {
        "cached": false,
        "dataType": "ALPHANUMERIC",
        "value": "{\"serialNo\":\"serialHERE\",\"timestamp\":1582239600000,\"water\":{\"volume\":\"205143\",\"flow\":{\"avg\":28}}}",
        "timestamp": 1582239600000,
        "annotation": null
      },
    

    Timestamp for when the point is saved definitely shows the correct timestamp for when the meta point stores it, but the rest doesn't line up...
    EDIT: I'm half wondering if i have to go back to making it do individual puts... but that seems like murder on this system...

    posted in User help read more