Author Topic: Gateway v9.1.0 problem  (Read 115 times)

tunkmountainman

  • Newbie
  • *
  • Posts: 8
  • Country: us
Gateway v9.1.0 problem
« on: June 24, 2020, 11:39:15 AM »
After I switched to the latest gateway and updated my "userMetrics" to individual metrics, two of the four metric files load properly but two do not. gateway system log indicates a couple of different reasons for the failures. I have completely reworked these two with the same results. I will post a metric that works correctly and one who fails. The more I look at this the more confused I become. I would really appreciate a "New" set of eyes on this...Thanks ahead of time....Dennis
This metric works fine

Code: [Select]
exports.metrics = {
    Temp: {name:'Temp',regexp: /9954\:(-?\d+\.\d+)/i,value: '',duplicateInterval: 3600,unit: '0',pin: 1,graph: 1,graphValSuffix: 'F',graphOptions: {legendLbl: 'Temp',lines: {lineWidth: 1 }}}}

However this one will fail attempting to load

Code: [Select]
exports.metrics = {
 Volts: {name:'Volts',regexp: /9950\:([\d\.]+)/i,value: '',duplicateInterval: 3600,unit: 'volts',pin: 1,graph: 1,graphOptions: {legendLbl: 'Volts',lines: {lineWidth: 1},grid: backgroundColor: {colors: ['#000', '#03c', '#08c']}}yaxis: {min: 0,autoscaleMargin: 0.25,autoscaleBottom: false}}}

Code: [Select]
[06-24-20_08:27:09.421] [INFO]   LOADING METRICS MODULE [/home/pi/gateway/metrics/Dennis2Metrics/Volts.js]
[06-24-20_08:27:09.432] [ERROR]  FAIL LOADING METRICS MODULE [/home/pi/gateway/metrics/Dennis2Metrics/Volts.js]: Unexpected token :
/home/pi/gateway/metrics/Dennis2Metrics/Volts.js:4
   volts:{ name:'volts',regexp:/9950\:([\d\.]+)/,value: '',duplicateInterval:3600,unit:'Volts',pin:1,graph:1,graphValSuffix:V,graphOptions:{legendLl:'Volts',lines:{lineWidth: 1},grid:backgroundColor:{colors:['#000','#03c','#08c']}}yaxis:{min:0,autoscaleMargin:0.25, autoscaleBottom:false}}}
                                                                                                               

Thanks for your time

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6279
  • Country: us
    • LowPowerLab
Re: Gateway v9.1.0 problem
« Reply #1 on: July 13, 2020, 09:29:19 AM »
Looks like a syntax error, i think you're missing a comma before the "yaxis:".