Skip to content

Commit

Permalink
Merge pull request #66 from Jalle19/fixes
Browse files Browse the repository at this point in the history
Fix "invalid float value for field 'voltage': undefined"
  • Loading branch information
Jalle19 authored Jun 24, 2024
2 parents 8f760fc + f4273de commit ed4cd69
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 ed4cd69

Please sign in to comment.