Hi All
I have created a flow to pull data from a solar charge controller and send to MQTT then a String node to select the 'voltage' data from the string. I would like to input this data to Influxdb but im stuck on the code needed in the Function node to change the data into the right format for Influxdb.
Via a debug node the output from my String node is
Mppt/Sunsaver : msg.payload : string[5]
"24.89"
With the Function node how do I input this to Influxdb.
Live Reload
Mode:
Attempting to connect to /dev/ttyUSB0
Adc_vb_f = 25.60 V (1sec avg)
Adc_va_f = 33.89 V (1sec avg)
Adc_vl_f = 25.51 V (1sec avg)
Adc_ic_f = 1.41 A (1sec avg)
Adc_il_f = 1.13 A (1sec avg)
T_hs = 19 °C
T_batt = 11 °C
Adc_vb_f = 25.60 V (1sec avg)
Adc_va_f = 33.89 V (1sec avg)
Adc_vl_f = 25.50 V (1sec avg)
Adc_ic_f = 1.41 A (1sec avg)
Adc_il_f = 1.14 A (1sec avg)
T_hs = 19 °C
T_batt = 11 °C
Adc_vb_f = 25.60 V (1sec avg)
Adc_va_f = 33.89 V (1sec avg)
Adc_vl_f = 25.51 V (1sec avg)
Adc_ic_f = 1.41 A (1sec avg)
Adc_il_f = 1.10 A (1sec avg)
T_hs = 19 °C
T_batt = 11 °C
Power_out = 36.04 W
Vb_min_daily (resets after dark) = 24.15 V
Vb_max_daily (resets after dark) = 26.24 V
Ahc_daily (resets after dark) = 2.10 Ah
Ahl_da...
OK, in that case you will have to extract it using string manipulation, as you are doing. To convert the msg.payload string to a number all you need is a function node containing msg.payload = Number(msg.payload) return msg
If you want it be in a field called value in the Measurement that you configure in the Influx Out node then yes. The help text for the node describes the payload formats supported.
No its not a problem, the code that pulls the data from the Modbus unit every 5 seconds for 30 seconds, It maybe a bit messy but is accurate enough for what i want.