Trying to write three values to influxdb database  [Solved]

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
xury
Posts: 48
Joined: Monday 10 December 2018 23:32
Target OS: Linux
Domoticz version:
Location: Poland
Contact:

Trying to write three values to influxdb database

Post 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
}
xury
Posts: 48
Joined: Monday 10 December 2018 23:32
Target OS: Linux
Domoticz version:
Location: Poland
Contact:

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

Post by xury »

Ok i figured out. It should be new line without carriage return:
\n - good
\r\n wrong
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest