Page 1 of 1

Datalogger by meteo sensor

Posted: Sunday 15 November 2015 18:02
by maxmizer
Hi I bought a few weeks ago, Raspberry, Arduino and the transceiver 433 mhz ....
I had a station La Crosse with some sensors.
I installed on Pi: Domoticz who sees all sensors.

I managed with this guide: viewtopic.php?f=15&t=839&p=59415&hilit=upload#p59415
to upload data to Wunderground .
Also discharge data from Wunderground as written here: https: //www.domoticz.com/wiki/Virtual_weather_devices

This afternoon I have dedicated myself to the log to a file, and I share my work.
certainly I formatted the data, so that my program can process and print out a PDF.

Script: Script_time_log.lua

Code: Select all


file = io.open("/tmp/logfiletemp.txt", "a")

utc_dtime = os.date("!%m-%d-%y %H:%M:%S",os.time())

month = string.sub(utc_dtime, 1, 2)
day = string.sub(utc_dtime, 4, 5)
year = string.sub(utc_dtime, 7, 8)
hour = string.sub(utc_dtime, 10, 11)
minutes = string.sub(utc_dtime, 13, 14)
seconds = string.sub(utc_dtime, 16, 17) 

timestring = year .. "/" .. month .. "/" .. day .. " " .. hour .. ":" .. minutes .. ":" .. seconds

Code = '00'
WindMeter = 'Airspeed'
AriaSpeed = string.format("%.2f", (otherdevices_windspeed[WindMeter]/0.1)*0.223693629205)
AriaDir = string.format("%.0f", otherdevices_winddir[WindMeter])
AriaTemp = string.format("%3.1f", otherdevices_temperature[WindMeter])
Outside_Temp_Hum = 'UTEst'
TempEst = string.format("%3.1f", otherdevices_temperature[Outside_Temp_Hum])
UREst = otherdevices_humidity[Outside_Temp_Hum]
Outside_Temp_Hum_Ovest = 'UTOvest'
Temp_Ovest = string.format("%3.1f", otherdevices_temperature[Outside_Temp_Hum_Ovest])
UR_Ovest = otherdevices_humidity[Outside_Temp_Hum_Ovest]
Barometer = 'Barometro'
Pressione = string.format("%4.2f", otherdevices_barometer[Barometer])
RainMeter = 'Pluviometro'
Pluviometro = string.format("%2.2f", otherdevices_rain[RainMeter])
Pyra = 'SolarWu'

-- This line should be one line
file:write(Code,',',timestring,',',AriaSpeed,',',AriaDir,',',AriaTemp,',',Temp_Ovest,',',UR_Ovest,',',TempEst,',',UREst,',',Pressione,',',Pyra,',',Pluviometro,'\n')
file:close()
Output data:

Code: Select all

00,15/11/15 16:52:00,0.00,112,12.4,19.8,62,12.0,80,1019.00,SolarWu,0.00
00,15/11/15 16:53:00,0.00,34,12.4,19.8,62,12.0,80,1019.00,SolarWu,0.00
00,15/11/15 16:54:00,0.00,349,12.4,19.9,62,12.0,80,1019.00,SolarWu,0.00
00,15/11/15 16:55:00,0.00,315,12.4,19.9,62,12.0,80,1019.00,SolarWu,0.00
It would be good if someone could write the file to an FTP server