mcolyer / smartermeter

A ruby library to access PG&E SmartMeter data
http://matt.colyer.name/projects/smartermeter/
MIT License
48 stars 15 forks source link

Not working for me on Mac #9

Closed dcj closed 13 years ago

dcj commented 13 years ago

I cloned and installed this yesterday on my Mac. I can log into PGE using regular browser with same credentials.

$ smartermeter I, [2011-04-03T11:39:54.851681 #85124] INFO -- : Attempting to fetch data for: 2011-04-02 I, [2011-04-03T11:39:54.851828 #85124] INFO -- : Logging in as MY-USERNAME E, [2011-04-03T11:39:56.500586 #85124] ERROR -- : Login failed. E, [2011-04-03T11:39:56.500678 #85124] ERROR -- : #<Mechanize::Page

A bunch of stuff

E, [2011-04-03T11:39:56.508779 #85124] ERROR -- : If this happens repeatedly your login information may be incorrect E, [2011-04-03T11:39:56.508849 #85124] ERROR -- : Remove ~/.smartermeter and restart to re-configure smartermeter. I, [2011-04-03T11:39:56.508909 #85124] INFO -- : Successfully fetched:

Ideas?

mcolyer commented 13 years ago

I'll see if I can reproduce it. Which version of ruby are you using?

dcj commented 13 years ago

$ ruby --version ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin10] dcjnotebook-3 $ which ruby /opt/local/bin/ruby

mcolyer commented 13 years ago

Did you happen to upgrade from a previous version of smartermeter? If so, try removing the .smartermeter file and reconfigure it (as there was a bug in earlier versions). Otherwise I'm not sure what could be causing the issue as it seems to work perfectly on my mac.

mcolyer commented 13 years ago

@dcj, When you login into your PG&E account in a browser do you see a link for "Hourly/Daily Usage" under the "Usage" menu in the sidebar?

I just had another user try to use smartermeter with an account that didn't have hourly energy data which resulted in the same type of error.

dcj commented 13 years ago

Yes, when I log in, and expand usage, i see usage history and hourly/daily usage.

still can't get it to work :-(

mcolyer commented 13 years ago

I looked at the log you sent earlier again and it really looks like there is an authentication issue, as PG&E responds with a login page after smartermeter attempts to login (which usually means the attempted login is incorrect).

dcj commented 13 years ago

I logged into the PGE site, and changed my password, rm'ed my .smartermeter file, and tried again Now I do not get the auth issue, put here is what I see:

$ smartermeter I, [2011-05-06T14:35:56.742844 #3922] INFO -- : Attempting to fetch data for: 2011-05-05 I, [2011-05-06T14:35:56.742990 #3922] INFO -- : Logging in as yapleejackson I, [2011-05-06T14:36:12.468690 #3922] INFO -- : Logged in as yapleejackson I, [2011-05-06T14:36:12.468791 #3922] INFO -- : Fetching 2011-05-05 I, [2011-05-06T14:36:17.905724 #3922] INFO -- : Verifying 2011-05-05 I, [2011-05-06T14:36:17.909858 #3922] INFO -- : Incomplete 2011-05-05 I, [2011-05-06T14:36:17.909904 #3922] INFO -- : Successfully fetched:

It just hangs there. After several minutes, I killed it, edited my .smartermeter file to specify a known existing directory within my home directory, and re-ran the app, again it hangs, and I do not see any data show up in the data directory....

:data_dir: /Users/dcj/etc/energyusage/pge

dcjnotebook-3 $ ls -lAFd /Users/dcj/etc/energyusage/pge drwxr-xr-x 2 dcj staff 68 Apr 2 18:20 /Users/dcj/etc/energyusage/pge/

What is supposed to happen? Does it pop up some GUI? That is not happening for me. Could be a ruby environment issue, or something. Any advice appreciated!

mcolyer commented 13 years ago

Actually that's the expected operation. It means everything is working correctly. It's designed to be run as a long running process which periodically checks for new data (currently once every hour).

Now the reason you don't have any new data is because it takes a while for PG&E to upload yesterday's data (I've seen cases as long as three days). So if you're patient and let it run it will download the data when it becomes available. Alternatively you can modify the date it starts downloading data in the .smartermeter file.

Let me know if that makes sense so I can go ahead and close this issue out.

dcj commented 13 years ago

working fine. I guess in retrospect, it was all "user error" of one kind or another. Very sorry to bother you. Thank you for making this software available.

dcj commented 13 years ago

The original issue got solved. Then it was working fine for a week or two. Then it stopped working again. It just won't log into the site for me anymore. Yes, I have checked my credentials, etc. Very perplexing :-(

mcolyer commented 13 years ago

If you login to the site and go to your usage data, can you see a graph of your recent hourly usage data? I tried to do that and my data is no longer appearing. I am wondering if your issue isn't related.

dcj commented 13 years ago

From a regular web browser: Go to pge.com Log in Expand "Usage" in left hand navigation column, so that two sub items are now visible: Usage History and Hourly/Daily Usage. Select Hourly/Daily Usage Must now click on "I understand - proceed" on disclosure page. Now I am finally on the SmartMeter Usage with graph of daily energy usage, and options to create different graphs, download, etc.

Perhaps PGE has changed the navigation structure of their site (must now agree to disclosure EVERY time?) which broke your scraper? Is it possible that your scraper can provide more context about how far it got through the navitation/scraping process?

dcj commented 13 years ago

After I agree to the disclosure, I am on this page:

https://www.pge.com/csol/actions/billingDisclaimer.do

When I first click on "hourly/daily usage" I am on this page:

https://www.pge.com/csol/actions/billingDisclaimer.do?actionType=hourly

I just tried forcing my browser to go to the post-agreement page, and it wouldn't, they must be setting a cookie or doing something with the session to prevent navigation to detailed usage data without clicking on the "i agree" button...

mcolyer commented 13 years ago

I'm confused. Were you able you able to see the hourly usage graph? On my account it says the data is missing.

I know the crawler is still working and authenticating as it gets a csv file from pge but all of the fields in it are missing data and have just a dash instead. On Jun 10, 2011 9:57 AM, "dcj" < reply@reply.github.com> wrote: