I’m running zigbee2mqtt, mosquitto, telegraf and influxdb in docker containers, and have configured telegraf inputs.mqtt_consumer to receive JSON format messages from some topics in mosquitto and write them to influxdb. I’m using Grafana to view the resulting data (I hope it’s not heretical to mention anything other than Chronograf here… ).
Telegraf drops the boolean field and just stores linkquality, battery and voltage to influxdb.
Is there some way I could configure Telegraf to convert the boolean field to an int (1 for true, 0 for false) so that I can chart these values in Grafana?
I’ve tried to do it with processors.converter, processors.regex and processors.enum, none of which had any effect.
You do not need to convert your boolean to an integer. You need to tell the JSON parser that you want it to process the non-number fields using json_string_fields
You can see the sample output below, and you can find my example code here.
I can’t map those strings into integers using a query?
How can I configure Telegraf to store all true/false from MQTT as 1/0?
Also, is there a way to just store everything as a field without having to list all the field names?
If I add some new sensor I don’t want to lose data just because those names are not set up.