wk275 / qbTools-v2

Tooling environment for Qbus and MQTT via Nodered.
GNU General Public License v3.0
2 stars 0 forks source link

Qbus entities that have no location set, trigger error when writing to InfluxDB #3

Closed asulonn closed 1 year ago

asulonn commented 1 year ago

When Qbus entities have no location set, it triggers an error when they are reported to InfluxDB:

[error] [Stackhero-InfluxDB-v2-write:0c01db4h7bn9ae3d] Error: 400 on http://influxdbv2:8086/api/v2/write?org=Thuis&bucket=qbus&precision=ms: {"code":"invalid","message":"unable to parse 'q_Reserve_LF7,location= value=0 2639645823529': missing tag value"}

I solved the issue by changing the code line in subflow "Qbus InfluxDB" => Function node "Create influx data" => line 15 From: let tags = { location: collection.location }; To: let tags = { location: (collection.location !== "" ? collection.location : "Undefined") };

wk275 commented 1 year ago

Will be changed in v2.3.4: to let tags = { location: (collection?.location ? collection.location : undefined) };

Is it possible to test this change at your site because this error condition is not produced at my site. txs

asulonn commented 1 year ago

What you suggested triggered the following error: TypeError: Cannot read properties of undefined (reading 'replace')

The quotes were missing. The code below did work: let tags = { location: (collection?.location ? collection.location : "Undefined") };