Hi,
I am quite new to that topic. I am trying since days to sort that out but I can’t find the right syntax.
I have values in my MQTT server:
PWR_MPII = 14
PWR_L1 = 576.7000122070312
PWR_L2 = 466.6000061035156
PWR_L3 = 2283.39990234375
PWR_SB5-1 = 0
PWR_SB5-2 = 0
PWR_SBS5 = 0
Sometimes the L1, L2, L3 values are without decimal points.
So I have integer and float values.
I tried the following code to import them:
[[inputs.mqtt_consumer]]
name_override = "mqtt_home"
servers = ["tcp://myip:1883"]
topics = [
"victron/PWR_L1",
"victron/PWR_L2",
"victron/PWR_L3",
]
qos = 0
connection_timeout = "60s"
max_undelivered_messages = 1
persistent_session = false
client_id = "telegraf_victron_mqtt"
username = "xxx"
password = "xxx"
data_format = "value"
data_type = "float"
interval = "5s"
[inputs.mqtt_consumer.tags]
destination = "Victron_bucket"
[[inputs.mqtt_consumer]]
name_override = "mqtt_home"
servers = ["tcp://myip:1883"]
topics = [
"victron/PWR_MPII",
"victron/PWR_SB5-1",
"victron/PWR_SB5-2",
"victron/PWR_SBS5",
]
qos = 0
connection_timeout = "60s"
max_undelivered_messages = 1
persistent_session = false
client_id = "telegraf_victron_mqtt2"
username = xxx"
password = "xxx"
data_format = "value"
data_type = "integer"
interval = "5s"
[inputs.mqtt_consumer.tags]
destination = "Victron_bucket"
Unfortunately this still throws errors:
2023-01-20T07:26:09Z I! [inputs.mqtt_consumer] Connected [tcp://myip:1883]
2023-01-20T07:26:09Z I! [inputs.mqtt_consumer] Connected [tcp://myip:1883]
2023-01-20T07:26:19Z E! [outputs.influxdb_v2] When writing to [http://myip:8086]: 500 Internal Server Error: internal error: unexpected error writing points to database: field type conflict
2023-01-20T07:26:19Z E! [agent] Error writing to outputs.influxdb_v2: failed to send metrics to any configured server(s)
2023-01-20T07:26:29Z E! [outputs.influxdb_v2] Failed to write metric to Victron_bucket (will be dropped: 422 Unprocessable Entity): unprocessable entity: failure writing points to database: partial write: field type conflict: input field "value" on measurement "mqtt_home" is type integer, already exists as type float dropped=1
I tried with type conversion and deleted the data values in the bucket completey - but I don’t get it to work.
Can someone please help me?