Hello,
I would download a CSV file with Lua but I can't because HTTP response is application/octet-stream Content-Type. So when I parse the content is zero. I want to address one by one the lines of that file.
--[[
%% properties
%% globals
--]]
-- Replace the value with ID of this virtual module
selfId=fibaro:getSelfId();
ip = fibaro:get(selfId, 'IPAddress');
ECO = Net.FHttp(ip)
local response, status, errorCode = ECO:GET("/protect/download/xdata.csv")
fibaro:debug(response)
If I take a network trace, although we note that the content is a Content-Type: application / octet-stream
GET /protect/download/xdata.csv HTTP/1.1
Host: 192.168.1.10
Connection: keep-alive
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36
Accept-Encoding: gzip, deflate, sdch
Accept-Language: fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4
HTTP/1.1 200 OK
Connection: close
Content-Type: application/octet-stream
Cache-Control: no-cache
ANNEE,MOIS,JOUR,T1_BASE,T1_HCHP,T1_HCHC,T1_EJPHN,T1_EJPHPM,T1_BBRHPJB,T1_BBRHCJB,T1_BBRHPJW,T1_BBRHCJW,T1_BBRHPJR,T1_BBRHCJR,T1_PMAX,T1_ISOUSC,T1_IMAX,Counter1,T2_BASE,T2_HCHP,T2_HCHC,T2_EJPHN,T2_EJPHPM,T2_BBRHPJB,T2_BBRHCJB,T2_BBRHPJW,T2_BBRHCJW,T2_BBRHPJR,T2_BBRHCJR,T2_PMAX,T2_ISOUSC,T2_IMAX,Counter2
2015,1,21,0,437439,233912,0,0,0,0,0,0,0,0,0,45,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2024300,
2015,1,22,0,445749,251266,0,0,0,0,0,0,0,0,0,45,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2024300,
Regards,