Aller au contenu

Rechercher dans la communauté

Affichage des résultats pour les étiquettes 'CSV'.



Plus d’options de recherche

  • Rechercher par étiquettes

    Saisir les étiquettes en les séparant par une virgule.
  • Rechercher par auteur

Type du contenu


Forums

  • Bienvenue
    • Nouveau ? Présentez-vous
    • Le bistrot
    • Mon installation domotique
    • Annonces et suggestions
  • La Home Center et ses périphériques
    • La Home Center pour les nuls
    • HC 2 & Lite
    • HC 3
    • Modules Fibaro
    • Modules Z-wave
    • Périphériques et matériels autres
    • Plugins
    • Quick App
    • Multimédia (audio, vidéo ...)
    • Chauffage et Energie
    • Actionneurs & Ouvrants (Portail, volets, piscines, ...)
    • Eclairage
    • Applications Smartphones et Tablettes
  • Autres solutions domotiques
    • Box / Logiciel
    • Modules Nice (433 & 866 MHz)
    • Modules Zigbee
    • GCE Electronics
    • Modules Bluetooth Low Energy
  • Objets connectés
    • Les Assistants Vocaux
    • Netatmo
    • Philips Hue
    • DIY (Do It Yoursel)
  • Sécurité
    • Alarmes
    • Caméras
    • Portiers
    • Serrures
  • Informatique / Réseau
    • Tutoriels
    • Matériels Réseaux
    • Matériels Informatique
    • NAS
    • Virtualisation
  • Les bonnes affaires
    • Sites internet
    • Petites annonces

Rechercher les résultats dans…

Rechercher les résultats qui…


Date de création

  • Début

    Fin


Dernière mise à jour

  • Début

    Fin


Filtrer par nombre de…

Inscription

  • Début

    Fin


Groupe


Jabber


Skype


Ville :


Intéret :


Version

3 résultats trouvés

  1. Bonsoir, Grâce à l'Eco-Devices, on peut suivre ses consommations d'électricité. Aussi, aujourd'hui je met à jour manuellement un tableur en copiant les infos depuis le fichier CSV (http://@IP/protect/download/xdata.csv). J'aimerais automatiser le traitement mais GCE ne fournit pas ces informations via l'API. Donc est-il possible de parser un fichier CSV en LUA pour calculer une estimation de prochaine facture grâe à mon eco-Devices. J'ai essayé de telecharger le fichier pour commencer mais cela ne fonctionne pas. --[[ %% 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) fibaro:debug("####Debut#########################") -- check for error if errorCode == 0 then if tonumber(status) == 200 then -- enregistrement du retour de l API dans une table fibaro:debug(response) else fibaro:debug("HTTP response status: "..status); end else fibaro:debug("Communication error"); fibaro:log("Communication error"); fibaro:call(selfId, "setProperty", "ui.Msg.value", "Comm. error", os.date("%d %b - %X")); end --[[ -- local citylist = {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} -- local citylist = "ANNEE,MOIS,JOUR,T1_BASE" local citylist = {} for line in citylist do local city, region, coalition, coordinate_x, coordinate_y = line:match("%s*(.-),%s*(.-),%s*(.-),%s*(.-),%s*(.-)") citylist[#citylist + 1] = { city = city, region = region, coalition = coalition, coordinate_x = coordinate_x, coordinate_y = coordinate_y } end –]] function ParseCSVLine (line,sep) local res = {} local pos = 1 sep = sep or ',' while true do local c = string.sub(line,pos,pos) if (c == "") then break end if (c == '"') then -- quoted value (ignore separator within) local txt = "" repeat local startp,endp = string.find(line,'^%b""',pos) txt = txt..string.sub(line,startp+1,endp-1) pos = endp + 1 c = string.sub(line,pos,pos) if (c == '"') then txt = txt..'"' end -- check first char AFTER quoted string, if it is another -- quoted string without separator, then append it -- this is the way to "escape" the quote char in a quote. example: -- value1,"blub""blip""boing",value3 will result in blub"blip"boing for the middle until (c ~= '"') table.insert(res,txt) assert(c == sep or c == "") pos = pos + 1 else -- no quotes used, just look for the first separator local startp,endp = string.find(line,sep,pos) if (startp) then table.insert(res,string.sub(line,pos,startp-1)) pos = endp + 1 else -- no separator found -> use rest of string and terminate table.insert(res,string.sub(line,pos)) break end end end return res end text = ParseCSVLine (response,",") fibaro:debug("####Fin#########################") Je n'ai rien qui s'affiche comme si la variable response était vide : Merci
  2. darklite44

    Telechargement Csv En Lua

    Bonjour à tous, J'ai un souci pour télécharger un fichier CSV en LUA. En effet, le contenu n'est pas dans directement le body de la réponse HTTP. Du coup lorsque je parse, le contenu est nul. --[[ %% 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) fibaro:debug("####Debut#########################") -- check for error if errorCode == 0 then if tonumber(status) == 200 then -- enregistrement du retour de l API dans une table fibaro:debug(response) else fibaro:debug("HTTP response status: "..status); end else fibaro:debug("Communication error"); fibaro:log("Communication error"); fibaro:call(selfId, "setProperty", "ui.Msg.value", "Comm. error", os.date("%d %b - %X")); end fibaro:debug(response) Ce qui me donne en retour : [DEBUG] 09:20:40: ####Debut######################### Si je prend une trace réseau, on remarque bien que le contenu est un 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,
  3. Bonsoir, J'utilise le module OWL "OWL+ USB" : http://theowl.com/index.php/energy-monitors/standalone-monitors/owl-usb/, pour ma consommation d'électricité. J'aimerais pouvoir intégrer les données remontées (via fichier CSV) dans mon installation domotique HC2. Quelqu'un aurait-il une idée de comment procéder? Merci bien
×