mschlenstedt / LoxBerry-Plugin-Weather4Lox

A LoxBerry Plugin: http://plugins.loxberry.de/plugin/weather4lox/
Apache License 2.0
10 stars 10 forks source link

Wundeground grabber replaces an older line instead of the current data #80

Closed pietiepb closed 1 year ago

pietiepb commented 1 year ago

Since the update of 4.10.0.1 does not replace the current record but an older one. When changing the default weather service the row of current data gets updated with the weatherdata but any subsequent updates of the wunderground grabber keep updating an older row.

08.12.2022 07:21:06 TASK STARTED Weather4Lox GRABBER_WUNDERGROUND process started INFO: LoxBerry Version 2.2.2.2 ( is_raspberry.cfg ) INFO: Weather 4 Loxone Version 4.10.0.1 INFO: Loglevel: 7 This is /opt/loxberry/bin/plugins/weather4lox/grabber_wu.pl Version 4.10.0.1 INFO: Getting public API key from Wunderground Website URL: https://www.wunderground.com/dashboard/pws/ILIEVE5 Status: 200 OK OK: Data fetched successfully. Public API Key is: e1f10a1e78da46f5b10a1e78da96f525 INFO: Fetching Data for Station ILIEVE5 URL: https://api.weather.com/v2/pws/observations/current?apiKey=e1f10a1e78da46f5b10a1e78da96f525&stationId=ILIEVE5&format=json&units=m&numericPrecision=decimal Status: 200 OK OK: Data fetched successfully for ILIEVE5 INFO: Saving new Data for Timestamp Thu Dec 8 07:21:03 2022 to database. Data to request: cur_prec_today, cur_prec_1hr, cur_uvi, cur_w_dir, cur_w_ch, cur_w_gu, cur_dp, cur_hu, cur_pr, cur_w_dirdes, cur_sr, cur_tt_fl, cur_w_sp, cur_tt Copying current.dat to current.dat.tmp INFO: Reading current.dat.tmp Old line: 1670453159|Wed, 07 Dec 2022 23:45:59 +0100|CET|Europe/Brussels|+0100||Belgium|-9999|51.150622|3.62585|-9999|2.8|2.8|97|West|249|0.6|1.8|2.8|1014.32|2.4|10.0|0|-9999|0|1.8|3|clear|1|Regen, Licht bewolkt|100|-9999|50|-9999|08|36|16|38|-9999|70.1|100|0.00 Response from cur_prec_today (value 1.8) is set to column 25 Response from cur_prec_1hr (value 1.8) is set to column 26 Response from cur_uvi (value 0) is set to column 24 Response from cur_w_dir (value 270) is set to column 15 Response from cur_w_ch (value 2.7) is set to column 18 Response from cur_w_gu (value 3.5) is set to column 17 Response from cur_dp (value 2.2) is set to column 20 Response from cur_hu (value 96) is set to column 13 Response from cur_pr (value 1014.32) is set to column 19 Response from cur_w_dirdes (value West) is set to column 14 Response from cur_sr (value 0) is set to column 22 Response from cur_tt_fl (value 2.7) is set to column 12 Response from cur_w_sp (value 1.8) is set to column 16 Response from cur_tt (value 2.7) is set to column 11 New line: 1670453159|Wed, 07 Dec 2022 23:45:59 +0100|CET|Europe/Brussels|+0100||Belgium|-9999|51.150622|3.62585|-9999|2.7|2.7|96|West|270|1.8|3.5|2.7|1014.32|2.2|10.0|0|-9999|0|1.8|1.8|clear|1|Regen, Licht bewolkt|100|-9999|50|-9999|08|36|16|38|-9999|70.1|100|0.00 OK: Current Data saved successfully. 08.12.2022 07:21:11 TASK FINISHED

As you can see, the old record updated is no the current timestamp.

My default weatherservice was openweather so I also had the issue as in #79 maybe this is somehow relate to having an out of date row?

pietiepb commented 1 year ago

It was idd related to the openweather fetch failing. Once that was fixed updates went ok.