Hi, my PI was unexpectedly off for 10 hours tonight. I am missing data for that 10 hours, is it possible to pull missing data from HUB, AIR, SKY?
There is a script named backfill.js. It will download data from the WeatherFlow servers and populate tables AirBackfill and SkyBackfill.
run it as node backfill -device xxxx -date 0
device is the device_id of the Air or Sky. date is 0 for today, 1 for yesterday, 2 for two days ago, etc. The dates are UTC days.
Thank you. Records restored, transferred to original tables and after that I run dailystats.js which updated data in daily tables.
I happy to know it worked well for you.
Been a week since I last updated.
Stopped processes.
Did updates/upgrades on Pi then updatefiles, altertables, updatefiles, altertables.
Restarted the services
Min/Max values are not showing up in the Panel and getting some errors below.
TypeError: Cannot read property ‘device’ of undefined
at results.forEach.item (/home/pi/WFArchive/wfarchive/archive.js:886:67)
at Array.forEach ()
at Query. (/home/pi/WFArchive/wfarchive/archive.js:885:12)
at Query. (/home/pi/WFArchive/wfarchive/node_modules/mysql/lib/Connection.js:502:10)
at Query._callback (/home/pi/WFArchive/wfarchive/node_modules/mysql/lib/Connection.js:468:16)
at Query.Sequence.end (/home/pi/WFArchive/wfarchive/node_modules/mysql/lib/protocol/sequences/Sequence.js:83:24)
at Query._handleFinalResultPacket (/home/pi/WFArchive/wfarchive/node_modules/mysql/lib/protocol/sequences/Query.js:139:8)
at Query.EofPacket (/home/pi/WFArchive/wfarchive/node_modules/mysql/lib/protocol/sequences/Query.js:123:8)
at Protocol._parsePacket (/home/pi/WFArchive/wfarchive/node_modules/mysql/lib/protocol/Protocol.js:278:23)
at Parser.write (/home/pi/WFArchive/wfarchive/node_modules/mysql/lib/protocol/Parser.js:76:12)
TypeError: Cannot read property ‘device’ of undefined
at resolve (/home/pi/WFArchive/wfarchive/archive.js:1114:66)
at new Promise ()
at setDeviceData (/home/pi/WFArchive/wfarchive/archive.js:1111:9)
at insertObsAir (/home/pi/WFArchive/wfarchive/archive.js:393:4)
at ProcessHUBData (/home/pi/WFArchive/wfarchive/archive.js:166:3)
at Socket. (/home/pi/WFArchive/wfarchive/archive.js:79:8)
at emitTwo (events.js:126:13)
at Socket.emit (events.js:214:7)
at UDP.onMessage [as onmessage] (dgram.js:659:8)
(node:4165) UnhandledPromiseRejectionWarning: TypeError: Cannot read property ‘device’ of undefined
at resolve (/home/pi/WFArchive/wfarchive/archive.js:1118:66)
at new Promise ()
at setDeviceData (/home/pi/WFArchive/wfarchive/archive.js:1111:9)
at insertObsSky (/home/pi/WFArchive/wfarchive/archive.js:579:4)
at ProcessHUBData (/home/pi/WFArchive/wfarchive/archive.js:172:3)
at Socket. (/home/pi/WFArchive/wfarchive/archive.js:79:8)
at emitTwo (events.js:126:13)
at Socket.emit (events.js:214:7)
at UDP.onMessage [as onmessage] (dgram.js:659:8)
And a few server errors
ypeError: Cannot read property ‘updated’ of undefined
at fs.readFile (/home/pi/WFArchive/wfarchive/server.js:1020:99)
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)
TypeError: Cannot read property ‘end’ of undefined
at resolve (/home/pi/WFArchive/wfarchive/util.js:151:7)
at new Promise ()
at Object.sqlExit (/home/pi/WFArchive/wfarchive/util.js:150:9)
at onExit (/home/pi/WFArchive/wfarchive/server.js:690:7)
at process. (/home/pi/WFArchive/wfarchive/server.js:164:5)
at emitOne (events.js:121:20)
at process.emit (events.js:211:7)
at Signal.wrap.onsignal (internal/process.js:197:44)
Post a screenshot of the About page, please.
Shoot - I meant to do that…
Yes, says needs to update database - which I have done several times (did I miss a step?)
Anyway… Here ya go.
Did it one more time and now…
Datebase level: 1.7.14.027
If I run UpdateFiles then AlterTables it reverts back to Datebase level: 1.7.13.027
But run AlterTables one more time then Datebase level: 1.7.14.027
AlterTable Log says 1.7.14.027 multiple times so would guess there is a logic issue somewhere in the code that causes it to display 1.7.13.027 - just guessing though.
That is weird. I have re-uploaded both applications.
I want you to restart all processes. In a terminal window run:
pm2 reset all
pm2 stop all
pm2 start
Also, make sure config.json in now in the config folder and a copy is NOT in the archive folder.
Should I do an updatefiles or altertables somewhere too?
You can updatefiles. That will refresh the scripts. As far as I can tell they are correct. Are you still getting the error?
I think the problem was that there was a config.json in the root folder of the app - removed that one - and now only one in the config folder.
One problem down.
The other issue is the min/max information in the Panel went away.
I want you to delete all the logs and then do
pm2 stop all
pm2 start
Check the logs for errors.
If no errors, run
node dailystats
Thought we had it solved.
Getting error in Archive.err
TypeError: Cannot read property ‘device’ of undefined
at resolve (/home/pi/WFArchive/wfarchive/archive.js:1114:66)
at new Promise ()
at setDeviceData (/home/pi/WFArchive/wfarchive/archive.js:1111:9)
at insertObsAir (/home/pi/WFArchive/wfarchive/archive.js:393:4)
at ProcessHUBData (/home/pi/WFArchive/wfarchive/archive.js:166:3)
at Socket. (/home/pi/WFArchive/wfarchive/archive.js:79:8)
at emitTwo (events.js:126:13)
at Socket.emit (events.js:214:7)
at UDP.onMessage [as onmessage] (dgram.js:659:8)
Go to the Panel tab in the server and check all the data.
Good one.
Went to Panel Config all values looked correct.
Did a “Save”
Panel is happy now… got min/max data etc.
I think all is good now.
I will try to remember these debugging steps “just in case” for next time.
Thanks for the assistance.
Excellent. I have added logging to archive.js to ignore the error and report it.
Now I just need to climb up on roof and figure out why my Sky always thinks it is raining… Pretty sure the mount is a tad loose.
Hi,
I’ve had some decent rain today, Some light , Some heavy. (and medium) reported by the Weather flow app.
With any rain i see “Trace” in the rain panel. When there is no rain it displays the word “None” so it is changing.
Just an FYI - Station 4834 if you want to have a look.