Page 1 of 1

Trying to write three values to influxdb database

Posted: Monday 02 March 2020 22:52
by xury
Hi I trying to write at least three values to influxdb database using domoticz.openURL and multiple points to multiple series at the same time by separating each point with a new line as described on https://docs.influxdata.com/influxdb/v1 ... ting_data/
But only the last value "Dom_faza3" is saved:

Code: Select all

return {
	on = {
	    devices = { 35 }
	},
	
	execute = function(domoticz, item)
	    local totalcurrent_str = domoticz.devices(35) -- three phase current sensor1
        local totalcurrent_fer = domoticz.devices(65) -- three phase current sensor2
        local totalcurrent_dom = domoticz.devices(69) -- subtraction 1-2 three phase sensor3

totalcurrent_dom.updateCurrent(
            	totalcurrent_str.current1 - totalcurrent_fer.current1,
            	totalcurrent_str.current2 - totalcurrent_fer.current2,
            	totalcurrent_str.current3 - totalcurrent_fer.current3
				)

domoticz.openURL({
         url = 'http://127.0.0.1:8086/write?db=domoticz&u=domoticz&p=domoticz&precision=ms',
         method = 'POST',
      --   headers = 'application/x-www-form-urlencoded',
     --    callback = 'trigger',
         postData = 'Dom_faza1 value='..totalcurrent_dom.current1..'\r\n'..'Dom_faza2 value='..totalcurrent_dom.current2..'\r\n'..'Dom_faza3 value='..totalcurrent_dom.current3
         
      })
	end
}

Re: Trying to write three values to influxdb database  [Solved]

Posted: Monday 02 March 2020 23:07
by xury
Ok i figured out. It should be new line without carriage return:
\n - good
\r\n wrong