Reading sensor in file .csv
Moderator: Telldus
-
- Posts: 34
- Joined: Fri Mar 17, 2023 9:45 am
Reading sensor in file .csv
Hello,
I would like to use the possibiliter sensor of Nexahome with the data weather of my station which are in a file .csv.
How to be caught there?
I tested weather_msn which functions well with a URL but I do not arrive at reading in a file on the PC.
If somebody has an idea, thank you in advance.
I would like to use the possibiliter sensor of Nexahome with the data weather of my station which are in a file .csv.
How to be caught there?
I tested weather_msn which functions well with a URL but I do not arrive at reading in a file on the PC.
If somebody has an idea, thank you in advance.
Re: Reading sensor in file .csv
Download the latest NexaHome version and put a bsh file in the "Sensor Path" field,Jean-Julien wrote:I would like to use the possibiliter sensor of Nexahome with the data weather of my station which are in a file .csv.
How to be caught there?
I tested weather_msn which functions well with a URL but I do not arrive at reading in a file on the PC.
If somebody has an idea, thank you in advance.
e.g. C:\apps\nexahome\sensor.bsh
Code: Select all
String csvFile = "C:\\apps\\nexahome\\weather.csv";
int findRow = 2;
int findColumn = 1;
String delimiter = ",;\t ";
int currentRow = 1;
int currentColumn = 1;
boolean found = false;
try {
BufferedReader in;
in = new BufferedReader(new FileReader(csvFile));
String line = null;
do {
line = in.readLine();
if (line != null) {
if (currentRow == findRow) {
StringTokenizer st = new StringTokenizer(line, delimiter);
if (st.countTokens() >= findColumn) {
while (currentColumn < findColumn) {
st.nextToken();
currentColumn++;
}
outAppend(st.nextToken());
found = true;
} else {
line = null;
}
}
currentRow++;
}
} while(line != null && !found);
if (line == null) {
errAppend("Unable to find value!");
}
in.close();
} catch(Exception e) {
errAppend(e.getMessage());
}
http://nexahome.se/NexaHome_1.7.0.jar
/Henrik
Last edited by hekj on Sat Aug 18, 2012 12:11 pm, edited 1 time in total.
-
- Posts: 34
- Joined: Fri Mar 17, 2023 9:45 am
Reading sensor in file .csv continuation
Hello,
First of all, thank you to have answered my message,
but I do not have the desired result.
I explain:
I copied script, named it sensor.bsh
In script, I modified the access path to the .csv and the following lines because my file csv has 2 lines and is like that:
2010-04-07,11:56,0,15.4,38,0,2,1.0,NA
Number,Time,T Trend,Temperature,Humidity(%),H Trend,Comfort Zone,Dew Point,Heat Index
It is the column 3 which interests me (15.4)
String csvFile = "C:\\nexahome\\sensor1-1day.csv";
int findRow = 1;
int findColumn = 3;
String delimiter = ",";
these lines should be modified:
int currentRow = 1;
int currentColumn = 1;
I charged version 1.7 with Nexahome
In Nexahome I put the way of sensor.bsh in Sensor Path And I do not have a result in Sensor Value.
What is that I did not understand?
Thank you for your answer
First of all, thank you to have answered my message,
but I do not have the desired result.
I explain:
I copied script, named it sensor.bsh
In script, I modified the access path to the .csv and the following lines because my file csv has 2 lines and is like that:
2010-04-07,11:56,0,15.4,38,0,2,1.0,NA
Number,Time,T Trend,Temperature,Humidity(%),H Trend,Comfort Zone,Dew Point,Heat Index
It is the column 3 which interests me (15.4)
String csvFile = "C:\\nexahome\\sensor1-1day.csv";
int findRow = 1;
int findColumn = 3;
String delimiter = ",";
these lines should be modified:
int currentRow = 1;
int currentColumn = 1;
I charged version 1.7 with Nexahome
In Nexahome I put the way of sensor.bsh in Sensor Path And I do not have a result in Sensor Value.
What is that I did not understand?
Thank you for your answer
-
- Posts: 34
- Joined: Fri Mar 17, 2023 9:45 am
Reading sensor in file .csv continuation (2) ready
Hello
That was put has to function with 18:00.
How starts the “Starting vent processing”?
I think that it is that which did not make it possible the program to launch out.
Thank you still.
The finality is to be able to close the shutters in the event of important rain automatically.
That was put has to function with 18:00.
How starts the “Starting vent processing”?
I think that it is that which did not make it possible the program to launch out.
Thank you still.
The finality is to be able to close the shutters in the event of important rain automatically.
Re: Reading sensor in file .csv continuation (2) ready
Change the findColumn value to 4 in order to get the temperature (15.4).Jean-Julien wrote:2010-04-07,11:56,0,15.4,38,0,2,1.0,NA
Do you need a "temperature guard" function that turns device on/off continuously?Jean-Julien wrote:Hello
That was put has to function with 18:00.
How starts the “Starting vent processing”?
I think that it is that which did not make it possible the program to launch out.
Thank you still.
The finality is to be able to close the shutters in the event of important rain automatically.
/Henrik
-
- Posts: 34
- Joined: Fri Mar 17, 2023 9:45 am
Reading sensor in file .csv continuation 3
Hello
Starting vent processing is active every minute, the file csv is thus read sufficiently often.
But I did not understand what starts this action. It is true that if there were a button for launching this process….
Let us suppose that a heating appliance starts according to the outside temperature and that another apparatus functions according to the wind, or of the rain.
It is possible that Nexahome takes into account several files of the .bsh type at the same time.
Thank you for your answer
Starting vent processing is active every minute, the file csv is thus read sufficiently often.
But I did not understand what starts this action. It is true that if there were a button for launching this process….
Let us suppose that a heating appliance starts according to the outside temperature and that another apparatus functions according to the wind, or of the rain.
It is possible that Nexahome takes into account several files of the .bsh type at the same time.
Thank you for your answer
You should use the alredy existing "temperature guard" software that I now have modified so you can enter row/column/delimiter:Jean-Julien wrote:Starting vent processing is active every minute, the file csv is thus read sufficiently often.
But I did not understand what starts this action. It is true that if there were a button for launching this process….
Let us suppose that a heating appliance starts according to the outside temperature and that another apparatus functions according to the wind, or of the rain.
It is possible that Nexahome takes into account several files of the .bsh type at the same time.
Thank you for your answer
http://telldus.se/forum/viewtopic.php?t=239&start=222
http://www.telldus.se/forum/viewtopic.p ... c&start=45
1) Download and unpack:
http://hem.bredband.net/hekj/nexahome/N ... dGuard.zip
2) Open a windows command prompt and enter the following command in order to switch device 5 on/off when temperature goes over/below 25:
3) Repeat step 2 for every device you want to controll.java NexaHomeCmdGuard "file:///c:/nexahome/sensor1-1day.csv?row=1&column=4&delimiter=," 25 gt 60 3600 --on 5 c:\nexahome\NexaHome.xml
/Henrik
-
- Posts: 34
- Joined: Fri Mar 17, 2023 9:45 am
Lecture sensor dans fichier .csv continuation
Hello,
Large mercy, the solution in line of order functions well.
I put the order in a file .bat and a click of a mouse and that go.
I modified cooling into 30.180 and that makes a renewal every 5 minutes.
Otherwise the file sensor.bsh functions, I have a data in the been worth column “sensor” but the order is not activated, I do not arrive has to find the formula which is appropriate.
I however copied from the directions for use for example: for One sensor formulated >=9#00: 00 for Off sensor formulated <=8#00: 00 but that does not do anything when the conditions are met.
I have evil to read the forums, English and Swedish is really foreign languages for me, which I send to you is of French translated by google!!
Cordially
Large mercy, the solution in line of order functions well.
I put the order in a file .bat and a click of a mouse and that go.
I modified cooling into 30.180 and that makes a renewal every 5 minutes.
Otherwise the file sensor.bsh functions, I have a data in the been worth column “sensor” but the order is not activated, I do not arrive has to find the formula which is appropriate.
I however copied from the directions for use for example: for One sensor formulated >=9#00: 00 for Off sensor formulated <=8#00: 00 but that does not do anything when the conditions are met.
I have evil to read the forums, English and Swedish is really foreign languages for me, which I send to you is of French translated by google!!
Cordially
Bonjour Jean-Julien
C'est mon ami qui m'a aidé a traduire le texte qui suit du suédois.
La fonction interne a NexaHome qui gére les données venant des sensors, ne peut être utilisée que pour executer une seule commande ON ou OFF. C'est a dire ne peut pas en permanence traiter les valeurs des sensors.
Tu dois donc utiliser NexaHomeCmdGuard.
Si j'ai bien compris ton message, tu as reussi a faire tourner ton programme.
Explication des parametres du programme:
1) "file:///c:/nexahome/sensor1-1day.csv?row=1&column=4&delimiter=,"
Nom du fichier, ligne, colonne et delimiteur.
2) 25
La valeur seuil
3) gt
Plus grand que
4) 60
Interval de lecture des données en secondes
5) 3600
Interval de lecture de données minimum en secondes
6) --on
La commande qui doit être executer si la condition de l'equation est remplie
7) 5
Unité (Device)
8 ) c:\nexahome\NexaHome.xml
Le chemin du fichier de configuration NexaHome
/Henrik
C'est mon ami qui m'a aidé a traduire le texte qui suit du suédois.
La fonction interne a NexaHome qui gére les données venant des sensors, ne peut être utilisée que pour executer une seule commande ON ou OFF. C'est a dire ne peut pas en permanence traiter les valeurs des sensors.
Tu dois donc utiliser NexaHomeCmdGuard.
Si j'ai bien compris ton message, tu as reussi a faire tourner ton programme.
Explication des parametres du programme:
1) "file:///c:/nexahome/sensor1-1day.csv?row=1&column=4&delimiter=,"
Nom du fichier, ligne, colonne et delimiteur.
2) 25
La valeur seuil
3) gt
Plus grand que
4) 60
Interval de lecture des données en secondes
5) 3600
Interval de lecture de données minimum en secondes
6) --on
La commande qui doit être executer si la condition de l'equation est remplie
7) 5
Unité (Device)
8 ) c:\nexahome\NexaHome.xml
Le chemin du fichier de configuration NexaHome
/Henrik
-
- Posts: 34
- Joined: Fri Mar 17, 2023 9:45 am
Reading sensor in file .csv continuation
Grand merci pour votre français.
Il est vrai que les traductions automatiques apportent des surprises
Bonjour de la Bourgogne
Large thank you for your French.
It is true that the automatic translations bring surprises Hello of Burgundy
Il est vrai que les traductions automatiques apportent des surprises
Bonjour de la Bourgogne
Large thank you for your French.
It is true that the automatic translations bring surprises Hello of Burgundy