[Ovmsdev] OvmsMetricVector<string> causing console.log error

Derek Caudwell d.caudwell at gmail.com
Sun Sep 6 18:07:14 HKT 2020


Hi,

I am trying to resolve the ovms web interface throwing an "undefined" error
because the following metric is defined with OvmsMetricVector<string> and
does not get quoted when parsed to JSON.parse(ev.data) in ovms.js.

Output from console error log:
"xnl.v.c.duration.label":[full.l2,full.l1,full.l0,range.l2,range.l1,range.l0]

However, when using
JSON.print(OvmsMetrics.GetValues("xnl.v.c.duration.label")) a properly
formed json string is returned:
  "xnl.v.c.duration.label": [
    "full.l2",
    "full.l1",
    "full.l0",
    "range.l2",
    "range.l1",
    "range.l0"
  ]

Can this be corrected at the ev.data source or use JSON.print on ev.data
before parsing it?

Kind regards
Derek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20200906/959045c4/attachment.html>


More information about the OvmsDev mailing list