i have a esp32 with a DHT22 Sensor on it and let it send via mosquito in my node-red installation. Everything works fine so far.
Now I try to keep that data to visualise it via Grafana. I want to store it in an influx database/ bucket but I don't have any luck to find out how to do that.
Can someone help me here please, im pretty new to all that stuff and a bit lost right now.
thanks, I didn't tell clearly I have a connecting to influx (through the influx out node) and I also can see my topics there, but my values are not there, so something must be wrong with my data format.
Without knowing what structure you've set in your InfluxDB data, we cannot know the answer.
Have a search through the forum for an old post by me that recommends some settings and structures for storing sensor data (for home automation but it could be for anything). It shows some recommended ways of using tags and values.
That's what I get as "pure" Data from my ESP / Sensor.
I googled couple hours now and couldn't find anything that`d help me how to format / handle my data.
I plugged the "influx-out" node directly to the Tasmota node and also tried to ask chat-gpt (with not really helpful results). Both attempts gave me just the keys in my bucket in influx but no value in it.
So im looking for someone to tell me how its usually done or where I can read it.
Click on the influx out node and then the little book tab in the right hand pane. That will tell you the valid formats for writing with that node. In addition the node's readme has a number of examples which should help. node-red-contrib-influxdb (node) - Node-RED
I wanted first to understand how to save any value. If I could save them all together it’d be better I guess. But now I have something to start with.
I’d really appreciate if you could tell me how to do that.
When I gave influx the value without the number conversion, I get the error that it’s a string and no visualisation is possible.
Note how TempUnit has quotes around it identifying that it is a string. Connect a debug node showing what is going into your function and show us what it says.
For adding multiple values to a measurement, from the help text:
If msg.payload is an object containing multiple properties, the fields will be written to the measurement.
So if you want to write temperature, humidity and pressure you want the payload to contain
You can do that with a Change node configured like this
I suggest that whenever you are preparing data for influx (or any db) that, before connecting the influxdb out node, you first feed the data into a debug node and make sure it looks correct. As you have probably discovered it can be a pain getting rid of incorrectly formatted data in the db (string instead of number for example).
I'd go further than that. I have a single output for my sensor data to InfluxDB and right before it, I have a function node that validates the inputs and refuses to post it unless it is correct (values are numbers and tags are strings).