Thanks for the information @arjanvanb. Yeah, it’s meant to be ttn uplink. That’s solved that problem, so I’m getting “t” and “h” printed in the debug console successfully.
I’m now getting stuck with the measurement. I’ve tried to read up documentation, including the official article and I initially thought it was as simple as putting a value in the InfluxDB output node which is same in name to the variables in the function and it’d work, but it’s obviously not the case, nor does it seem consistent with other articles. This belief was based on previous experience when I only had a single value that I was transmitting.
At the moment my error, if I put “temperature” in the “Measurement” box my error is:
Error: A 400 Bad Request error occurred: {"error":"unable to parse 'temperature value=undefined': invalid boolean"}
This is the same if I enter, “t”, “h”, or “humidity” and is the one I mentioned before, but now it has become clearer it doesn’t have anything to do with the ten event and uplink mixup. From my understanding I need to specify the measurement which makes sense, however I am currently unsure as to how I do this.
The Javascript I currently have in the function is below, which you suggested:
return {
t: msg.payload_fields.temperature,
h: msg.payload_fields.humidity
};
I have also set the number of outputs to 2.
If you scroll down in that article I linked above, it does show how they used measurements, however they only have a single value being returned, being msg.payload. Is this an alternative process to sending two values?
I have also found this Github article which shows the Javascript in the function which shows another way to go about doing this. They say that:
The receiving database needs to know
name of measurement
Which makes sense, however what is the measurement value it requires?
Going by this Github post, I tried the the following code in the function node:
var t = msg.payload_fields.temperature
var h = msg.payload_fields.humidity
return {
temperature: t,
humidity: h
}
It gave the values for temperature and humidity, however I still got the same error, no matter what if the measurement was “t”, “temperature”, “h” or “humidity”:
Error: A 400 Bad Request error occurred: {"error":"unable to parse 'temperature value=undefined': invalid boolean"}
Also, do I need to use 2 InfluxDB outputs for temperature and then humidity? I’ve seen this in a few examples I’ve looked up, so my current assumption is yes.