-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PR] Pacific Power Webscraper proof of concept #21
Conversation
got through login of iframe (https://stackoverflow.com/questions/46529201/puppeteer-how-to-fill-form-that-is-inside-an-iframe) got to usage details page next: need to look into puppeteer with dropdown menus. Reference this for "hovering mouse" on graph - #5 |
need to add function for automating clicking on another date for possible missed uploads or upload errors |
New approach
The bug is that sometimes the frontend (pacificpower seems to be built with AngularJS, so state issue?) shows "no data" even when data is present, returning to previous meter and coming back to original meter forces a "refresh" |
Summary of TODOEnergy Dashboard Backend
MySQL
Update Webscraper (wait until above 2 sections checked)
Energy Dashboard Backend
Future Optimizations
|
Pacific Power Meters UploadI added a meterslist.json for meters that we are currently displaying on the frontend, but all meters with daily data are being uploaded to the database. If there is not a match in meterslist.json for the Pacific Power ID, the meter_id in the database will be null. If the PPM gets added to the front end in the future, we can easily update all corresponding entries with the newly added meter_id and we will be able to display all the data that's been collected right away (will need to turn off safe mode):
See the commit for the Energy Dashboard here: The solar meters and pacific power meters are differentiated on the backend with a type that is sent in the upload request. I tested with both Pacific Power Meters and Solar Meters and both work. To test, run the backend in the "add-pacific-power-meters" commit on the Energy Dashboard and set the DASHBOARD_API in the PacificPower env file to http://127.0.0.1:3000 |
Sounds good. I'm still not 100% sure if it's better to include the meter table's ID value in the pacific_power_data table, or if a join on the download would be fine performance wise, so let's come back to that after download is implemented. |
… arg for uploading - Changed date logic to grab the date for the power usage, so that the date will always reflect the data - Removed references to db_meter_id, as the EDB backend will grab data via pacific_power_meter_id instead of db_meter_id - Added a command line argument (--no-upload) for easier testing
Added a function to check if latest date shown in pacificpower matches yesterday's date. After this webscraper is pushed to AWS Cloudwatch, we can set up cloudwatch to check for that log message. Otherwise, PR look pretty good to me. |
I think this PR just generally good to go, with caveats that I still got 2 meters (74264319 and 77293450) missing data from yesterday (only showing up to 2 days ago), as late as 2 PM. I think the error will be easier to address after we have a bigger amount of data in the database, so I think we can start on the uploads on AWS and come back to fix the date mismatch / "unavailable" data issues later. |
EDIT - This first comment will be where I list general info about this PR
General Requirements
Running the code
npm i
from withinPacificPower
directory, then see belownode readPP.js
.env
inPacificPower
directoryHow it works
false
as noted here to see it working in real timemat-option
value in PacificPower site source code, Usage in Kwh, PacificPower meter ID)Next steps