Hello. I wanted to ask a couple of questions about what I have seen of the template to understand how it works.
The template database is updated every 5 minutes, although I have set the CRON to run every minute. I understand that the current conditions are updated every minute, the data is saved in the cache, and after 5 minutes, the most relevant is stored in the database. Now, the current conditions block does not update precisely to the minute since I have the seconds enabled in the header, which varies a lot (46, 57, 36, for example). I don't know if this is the case or if I have something misconfigured. I also don't know if this can cause any data to be lost.
Another thing that I noticed, the Station Data block, prints the maximums and minimums with some delay compared to the actual value, which I understand is because the values are saved with some delay in the database. For example, under current conditions, I see a maximum gust of 50 km/h at 12:23, so it should appear in the database that this data is at 12:25 because it seems at 12:30 or 12:35.
Template update
-
- Expert
- Posts: 862
- Joined: Tue Jan 12, 2021 8:03 am
- Location: Italy
- Station model: WH2650
- Software: WH2650 (direct upload)
- Contact:
Re: Template update
You can check your cache/apiLog.txt file that contains a lot of infos ( it is generated by api.php every time it is called )
For example you can see the 'server time' ( the time that the api.php is called ) and the 'upload time' ( the timestamp of the data provided by the uploader itself ) this is an extract:
The server time ( when the cron job is fired ) is super stable, called every minute, while the uploader time is varying ( it depends on the datalogger I think ) and in the 'composition' of the two sampling times you may loose a data once in a while ( for example you have the 15:04 data repeated twice but don't have the data between 13:04 and 15:04 ).
This effect should be reduced if you could call the cron job every 30" or eliminated if your datalogger could call api.php every time a new data block is available
P.S.
I don't understand completely your second question
For example you can see the 'server time' ( the time that the api.php is called ) and the 'upload time' ( the timestamp of the data provided by the uploader itself ) this is an extract:
Code: Select all
server uploader delta
time time
13:02 12:11 -51
14:03 13:04 -59
15.08 15:04 -4
16:03 15:04 -59
17:03 17:02 -1
18:03 18:00 -3
19:02 18:58 -4
20:06 19:56 -10
21:03 20:54 -9
22:03 20:54 -69
23:02 22:46 -16
24:03 23:46 -17
This effect should be reduced if you could call the cron job every 30" or eliminated if your datalogger could call api.php every time a new data block is available
P.S.
I don't understand completely your second question
-
- Observer
- Posts: 17
- Joined: Thu Feb 24, 2022 1:51 pm
- Station model: Davis Vantage Pro 2
- Software: WeatherLink
Re: Template update
Hello. First of all, thanks for the information. Second, I understand what you're saying, although looking at the apiLog.txt file, I don't see the information you put in the sample extract, and I attached an example of what I see. The concept is clear to me, CRON calls when it corresponds to api.php, but the second difference is how long it takes to get the information from the data logger.
Regarding the second question, maybe it has to do with this, but I don't know. Today's minimum temperature was 12.7 ºC at 7:35. This data appears in the station console and in the Weatherlink API (I leave the extract below), but the template prints the minimum temperature at 7:45, 10 minutes later. That has happened to me with other data, for example, wind gust, even collected by the cache and dumped into the database 15 minutes later. I don't know if I explained myself this time.
WeatherLink API
apiLog.txt
Regarding the second question, maybe it has to do with this, but I don't know. Today's minimum temperature was 12.7 ºC at 7:35. This data appears in the station console and in the Weatherlink API (I leave the extract below), but the template prints the minimum temperature at 7:45, 10 minutes later. That has happened to me with other data, for example, wind gust, even collected by the cache and dumped into the database 15 minutes later. I don't know if I explained myself this time.
WeatherLink API
Code: Select all
<temp_day_high_f>65.7</temp_day_high_f>
<temp_day_high_time>1:20pm</temp_day_high_time>
<temp_day_low_f>54.8</temp_day_low_f>
<temp_day_low_time>7:35am</temp_day_low_time>
<temp_month_high_f>68.1</temp_month_high_f>
<temp_month_low_f>54.8</temp_month_low_f>
<temp_year_high_f>68.4</temp_year_high_f>
<temp_year_low_f>54.8</temp_year_low_f>
Code: Select all
Handling data from wlIP
update 'T' = 18.2
update 'H' = 67
update 'P' = 1018.1
update 'B' = 76
update 'W' = 24.1401
update 'G' = 37.01482
update 'R' = 0
update 'RR' = 0
update 'S' = 0
update 'U' = 1646750952 (2022-03-08 14:49:12)
update 'TIN' = 22.5
update 'HIN' = 53
update 'SW' = wlIP
Begin of common part of api script
Start handling live data
Checking if extra sensors should be logged
Extra sensor settings file not found.
Extra sensors data to save in db:
add live data: D: 11.9
add live data: DTime: 1646750943
add live data: A: 14.4
add live data: ATime: 1646750943
calculated D: 11.9
calculated A: 14.1
Save meteotemplateLive.txt: {"T":18.2,"H":67,"P":1018.1,"B":76,"W":24.1401,"G":37.01482,"R":0,"RR":0,"S":0,"U":1646750952,"TIN":22.5,"HIN":53,"SW":"wlIP","TTime":1646751006,"HTime":1646751006,"PTime":1646751006,"BTime":1646751006,"WTime":1646751006,"GTime":1646751006,"RTime":1646751006,"RRTime":1646751006,"STime":1646751006,"UTime":1646751006,"TINTime":1646751006,"HINTime":1646751006,"SWTime":1646751006,"D":11.9,"DTime":1646751006,"A":14.1,"ATime":1646751006}
Start data parsing
Parsing date; Server time: 2022-03-08 14:50:06
Validating date: 1646750952 (2022-03-08 14:49:12)
Date is valid; difference with server time is -54 s
Parsing temperature
Temperature: 18.2 C
Database units: C
Checking temperature is between limits specified in template Main settings.
Minimum temperature limit: -100 C
Maximum temperature limit: 100 C
Temperature is OK and within the allowed limits
Parsing maximum temperature
Parsing minimum temperature
Parsing humidity
Humidity: 67 percent
Checking humidity is between limits specified in template Main settings.
Minimum humidity limit: 0 %
Maximum humidity limit: 100 %
Humidity is OK and within the allowed limits
Parsing wind speed
Wind speed: 24.1401 kmh
Database wind speed units: kmh
Checking wind speed is between limits specified in template Main settings.
Minimum wind speed limit: 0 kmh
Maximum wind speed limit: 200 kmh
Wind speed is OK and within the allowed limits
Parsing wind gust
Wind gust: 37.01482 kmh
Database wind units: kmh
Checking wind gust is between limits specified in template Main settings.
Minimum wind gust limit: 0 kmh
Maximum wind gust limit: 200 kmh
Wind gust is OK and within the allowed limits
Parsing wind direction
Wind direction: 76 degrees
Wind direction is OK and within the allowed limits
Parsing daily cumulative precipitation
Precipitation: 0 mm
Database precipitation units: mm
Checking precipitation is between limits specified in template Main settings.
Minimum precipitation limit: 0 mm
Maximum precipitation limit: 800 mm
Precipitation is OK and within the allowed limits
Parsing rain rate
Rain rate: 0 mm/h
Database rain units: mm/h
Checking rain rate is between limits specified in template Main settings.
Minimum rain rate limit: 0 mm/h
Maximum rain rate limit: 500 mm/h
Rain rate is OK and within the allowed limits
Solar radiation sensor disabled in Main settings - skipping.
No extra sensors set to log to extra alldata table.
Cached data loaded from cache/apiCache.txt.
Parsing pressure
Pressure: 1018.1 hpa
Database pressure units: hpa
Checking pressure is between limits specified in template Main settings.
Minimum pressure limit: 950 hpa
Maximum pressure limit: 1100 hpa
Pressure is OK and within the allowed limits
Pressure is valid.
Calculated dew point: 11.9 C
Dew point ok.
Calculated apparent temperature: 14.1 C
Apparent temperature ok.
End time for database update based on timestamp of first cache data: 2022-03-08 14:45:14
Rounded end time for database update: 2022-03-08 14:50:00
Not yet time to update the db, saving new data to cache/apiCache.txt
Generating log file cache/apiLog.txt
ERRORS:
No max temperature data provided.
No min temperature data provided.
-
- Expert
- Posts: 862
- Joined: Tue Jan 12, 2021 8:03 am
- Location: Italy
- Station model: WH2650
- Software: WH2650 (direct upload)
- Contact:
Re: Template update
In the apiLog.txt you logged search for this part ( server time, uploader timestamp and difference ):
Ok, I understand what you say in your second question. According to my understanding of the meteotemplate database update you should have a maximum of 5 mins of time difference ( and not 10-15 mins ) between the 'meteotemplate time' and the 'console time'.
If you want to investigate further you could enable api.php logging and analyze the data saved later so to compare weather link log ( or uploader software log ) and meteotemplate log.
The api.php included in this mod has an option to enable api logging ( set $logGetPost = 1; it will log to cache/apiReqLog.txt )
Code: Select all
Start data parsing
Parsing date; Server time: 2022-03-08 14:50:06
Validating date: 1646750952 (2022-03-08 14:49:12)
Date is valid; difference with server time is -54 s
If you want to investigate further you could enable api.php logging and analyze the data saved later so to compare weather link log ( or uploader software log ) and meteotemplate log.
The api.php included in this mod has an option to enable api logging ( set $logGetPost = 1; it will log to cache/apiReqLog.txt )