krommetje Super User
Joined: December 29 2004 Location: Netherlands
Online Status: Offline Posts: 695
|
Posted: February 08 2013 at 04:15 | IP Logged
|
|
|
Here is an update:
been working on a macro to import temperature, humidity and dewpoint from a TEMPERHUM USB key and here is howto:
Go into OPTIONS of the temperhum software and set logging to CSV into the directory of your desire.
TEMPERHUM software writes a filename like this:
2013-2-8 9h34m8s.csv
I need a workaround for this to give the log a filename which is easier tom work with, how I still have to figure out...
the macro I have created up until now:
Code:
insert into macroheader values ('TEMPERTEST','TEMPERTEST',1,0,1);
insert into macrodetail values ('TEMPERTEST',1,26,'',NULL,'START',1,'','');
insert into macrodetail values ('TEMPERTEST',2,27,'',NULL,'if(ph_fileexists("c:\logs\2013-2 -1 10h8m23s.txt") = 0,"WAIT","")',1,'','');
insert into macrodetail values ('TEMPERTEST',3,15,'[LOCAL1]',NULL,'ph_readfile("c:\logs\2013-2-8 9h34m8s.csv")',0,'','');
insert into macrodetail values ('TEMPERTEST',4,38,'',0,'ph_deletefile("2013-2-8 9h34m8s.csv") ',1,'','');
insert into macrodetail values ('TEMPERTEST',5,10,'TEMPER1',NULL,'RIGHT(ph_getvar_s(1,1),40 )',0,'','');
insert into macrodetail values ('TEMPERTEST',6,10,'TEMPER',NULL,'DEC(LEFT(right("{TEMPER1}" , 40),5))',0,'','');
insert into macrodetail values ('TEMPERTEST',7,10,'TEMPERHUMID',NULL,'DEC(right(left("{TEMP ER1}", 13),5))',0,'','');
insert into macrodetail values ('TEMPERTEST',8,10,'TEMPERDEWPOINT',NULL,'DEC(right(left("{T EMPER1}", 18),4))',0,'','');
insert into macrodetail values ('TEMPERTEST',9,38,'',0,'ph_writefile("c:\logs\temperhist.lo g",0,ph_getvar_s(1,1))',1,'','');
insert into macrodetail values ('TEMPERTEST',10,26,'',NULL,'WAIT',1,'','');
insert into macrodetail values ('TEMPERTEST',11,31,'',NULL,'60',1,'','');
insert into macrodetail values ('TEMPERTEST',12,27,'',NULL,'"START"',1,'','');
|
|
|
the macro is pretty straightforward: I read the file and store it in [LOCAL1] then I store the last 40 chars of the file in a GV named TEMPER1. Then I filter out the needed values and store them I their seperate GV's
like I said: I need a workaround for the filename, once PH restarts or the temperhum software restarts, the filename changes as well....
edit: check the code for spaces added by the board software!
Edited by krommetje - February 08 2013 at 04:17
|