Help with parse values from a csv-file

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

Moderator: leecollings

Post Reply
User avatar
McMelloW
Posts: 434
Joined: Monday 20 November 2017 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.1
Location: Harderwijk, NL
Contact:

Help with parse values from a csv-file

Post by McMelloW »

Hello to all,

Code: Select all

;HR Solar ADVANCED controller [Regler];;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Date / Time;Systemdatum;Temperatur Sensor 1;Temperatur Sensor 2;Temperatur Sensor 3;Temperatur Sensor 4;Temperatur Sensor 5;Temperatur VFS/RPS (S6);TAGE;Volumenstrom V40;Volumenstrom VFS (S6);Volumenstrom Flowrotor (S7);Druck RPS (S6);Drehzahl Relais 1;Drehzahl Relais 2;Drehzahl Relais 3;Drehzahl Relais 4;PWM A;PWM B;Wärmemenge;SW-Version;Betriebssekunden Relais 1;Betriebssekunden Relais 2;Betriebssekunden Relais 3;Betriebssekunden Relais 4;Urlaubsfunktion;Blockierschutz 1;Blockierschutz 2;Blockierschutz 3;Initalisieren;Befüllung;Stabilisieren;Pumpenverzögerung;Überwärmeabfuhr;Nachlauf;Thermische Desinfektion;Speicherkühlung;Systemkühlung;Spreizung;Frostschutz;Kollektorkühlung;Einheit Temperatur;Einheit Durchfluss;Einheit Druck;Einheit Leistung;Einheit Energie;Speichermaximaltemperatur;Neustarts;Fehlermaske;WAMA (Counter);TWAMA
2018-01-06T13:30:26+01:00;06.01.2018 13:29:27;24,2;14,0;888,8;888,8;888,8;999,9;71;0;0;0;99,99;100;0;0;0;31;0;0;1,00;663248;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;888,8
This csv file is the output, after formatting, of the Resol KM2 module of my Solar Boiler. I need some values from row 3 and send it to devices. Sorry about my ignorance, but have no idea how you can parse some of these values. Is there anybody who has some experience with this. I hope to do this in dzVents. That is why I post this here

Very odd searching this forum on "csv" with or without quotes results in zero hits.
Greetings McMelloW
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: Help with parse values from a csv-file

Post by dannybloe »

Yeah, some weirdo in the phpBB community decided that people should not be allowed to search for 3-letter words. Totally insane. You can search the domoticz forums using google: 'csv site:domoticz.com'.

Having said that: http://lua-users.org/wiki/LuaCsv
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
User avatar
Egregius
Posts: 2592
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: Help with parse values from a csv-file

Post by Egregius »

If you like to use php I can help you, quite easy there.
User avatar
McMelloW
Posts: 434
Joined: Monday 20 November 2017 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.1
Location: Harderwijk, NL
Contact:

Re: Help with parse values from a csv-file

Post by McMelloW »

Egregius wrote: Sunday 07 January 2018 22:46 If you like to use php I can help you, quite easy there.
Thanks for your offer. But I have no idea what php is?

Actually I was looking for something in dzVents or lua. A kind of function like readLuaFromJsonFile(fileName) for csv files. Don't know or something like that exist?
Greetings McMelloW
User avatar
McMelloW
Posts: 434
Joined: Monday 20 November 2017 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.1
Location: Harderwijk, NL
Contact:

Re: Help with parse values from a csv-file

Post by McMelloW »

dannybloe wrote: Sunday 07 January 2018 16:12 Yeah, some weirdo in the phpBB community decided that people should not be allowed to search for 3-letter words. Totally insane. You can search the domoticz forums using google: 'csv site:domoticz.com'.

Having said that: http://lua-users.org/wiki/LuaCsv
Thanks for the search tips. Is there something like readLuaFromJsonFile(fileName) for csv-files in dzVents?
Greetings McMelloW
User avatar
Egregius
Posts: 2592
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: Help with parse values from a csv-file

Post by Egregius »

McMelloW wrote: Monday 08 January 2018 12:31 But I have no idea what php is?
PHP is a programming language just like LUA (but better :lol: )

In PHP something like this would already do the job:

Code: Select all

<?php
$data=str_getcsv(file_get_contents('http://192.168.2.10/status.htm'),"\r\n");
$x=0;
foreach($data as $d){
	$x++;
	if($x==3){
		$i=str_getcsv($d,";");
		//Do something with the $i array...
	}
}
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest