Skip to content

Commit

Permalink
Fix "invalid float value for field 'voltage': undefined"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jalle19 committed Jun 24, 2024
1 parent 8f760fc commit f4273de
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/publisher/influxdb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,16 @@ export class InfluxDBPublisherImpl implements PublisherImpl {
.tag('name', data.characteristics.name)
.tag('sensorType', data.characteristics.sensor.type)
.tag('phase', data.characteristics.phase)
.floatField('voltage', data.voltage)
.floatField('frequency', data.frequency)
.timestamp(data.timestamp)

if (data.voltage !== undefined) {
characteristics.floatField('voltage', data.voltage)
}

if (data.frequency !== undefined) {
characteristics.floatField('frequency', data.frequency)
}

this.writeApi.writePoint(characteristics)
}

Expand Down

0 comments on commit f4273de

Please sign in to comment.