Skip to content

Send monthly electricity usage reports from SolarCity, aligned to Orange & Rockland utility billing cycles.

License

Notifications You must be signed in to change notification settings

Aldaviva/DadsEnergyReporter

Repository files navigation

Dad's Energy Reporter

Send monthly electricity usage reports from SolarCity, aligned to Orange & Rockland billing cycles.

Problem

My parents' house gets its electricity from both Orange & Rockland, a public utility company, and two arrays of roof-mounted solar panels leased from SolarCity.

My dad wants to know how many kilowatt-hours of electricity were generated by the solar panels compared to how many were bought from the utility each month, so that he can tell how much of an impact the solar panels are making on his electricity cost.

Challenges

  • SolarCity provides a web application, MySolarCity, that shows how much electricity was generated using a reporting tool called PowerGuide. You can view graphs for a given day, month, or year. Unfortunately, PowerGuide reports are always aligned to the start of the report period, for example, month reports always start on the 1st of the month. This is a problem because…
  • Orange & Rockland billing cycles never begin on the 1st of the month. In fact, the billing date is completely unpredictable. The most common billing date is the 17th, but only 42% of the past two years of bills actually ended on the 17th, and they have varied between the 15th and 21st with no discernible pattern.
  • When there's a lot of sunlight, the solar panels can generate all of the electricity the house needs in a month. Any surplus electricity is sent back to the utility company, which counts as a credit on your utility bill. In order to properly calculate how much energy the house consumed, this surplus amount is required. Unfortunately, Orange & Rockland's site does not expose this surplus amount in the Green Button XML, Green Button CSV, Billing History HTML, or View Bills HTML. It only appears in the actual PDF of the bill that gets mailed to the house.

Solution

I wrote a program that can be run periodically to send an email report of electricity usage statistics for both Orange & Rockland and SolarCity.

Algorithm

  1. Log in to Orange & Rockland
  2. Log in to MySolarCity
  3. Download ESPI Green Button Data from Orange & Rockland
  4. Extract the start and end date and billing amount from the Green Button data for the most recent billing interval
  5. Download the PDF of the latest bill earlier than the billing interval end date
  6. Extract the energy consumed from the bill PDF, which may be negative if the solar panels generated surplus electricity
  7. Download PowerGuide measurements from MySolarCity
  8. Extract the kWh generated from the PowerGuide data for the most recent billing interval
  9. Send an email report containing this information, as well as the sum of the electricity generated and bought which gives the total house usage
  10. Log out of Orange & Rockland and MySolarCity
  11. Persist the billing date to avoid resending the report for the same billing interval the next time this program runs
  12. Exit

Usage

  1. Make sure you have .NET Framework 4.7 or later installed
  2. Download the latest release (the ZIP file, but not the source code one)
  3. Extract the ZIP file
  4. Create a settings file according to Settings
  5. Run DadsEnergyReporter.exe
  6. Check your email for the usage report

Settings

Settings are stored using JSON in %LOCALAPPDATA%\Dad's Energy Reporter\settings.json.

Example

{
  "SolarCityUsername": "solarcityUser",
  "SolarCityPassword": "solarcityPass",
  "OrangeRocklandUsername": "oruUser",
  "OrangeRocklandPassword": "oruPass",
  "ReportSenderEmail": "sender@mail.com",
  "SmtpHost": "mail.com",
  "SmtpPort": 25,
  "SmtpUsername": "hargle",
  "SmtpPassword": "blargle",
  "ReportRecipientEmails": [
    "recipient1@mail.com",
    "recipient2@mail.com"
  ],
  "HttpProxy": null
}

Properties

All properties are required unless they have a default value.

  • SolarCityUsername is the email address you use to log in to MySolarCity.
  • SolarCityPassword is the password you use to log in to MySolarCity.
  • OrangeRocklandUsername is the username you use to log in to Orange & Rockland My Account.
  • OrangeRocklandPassword is the password you use to log in to Orange & Rockland My Account.
  • ReportSenderEmail is the email address that will appear in the From field of report emails that are sent to you.
  • ReportRecipientEmails is an array of one or more email addresses to which report emails will be sent.
  • SmtpHost is the hostname or IP address of the server that you use to send outgoing email. The server must support STARTTLS authentication.
  • SmtpPort is the TCP port number of the server that you use to send outgoing email, by default 25.
  • SmtpUsername is the username that you use to log in to the server that sends your outgoing email. Required, no anonymous SMTP allowed.
  • SmtpPassword is the password that you use to log in to the server that sends your outgoing email. Required, no anonymous SMTP allowed.
  • HttpProxy is an optional HTTP forward proxy for this program to use when making outbound connections. The value can be a string containing the hostname or IP address and port of the proxy server, e.g. "192.168.1.100:8888", or null if this program should instead make direct HTTP requests, which is the default.
  • MostRecentReportBillingDate is used by this program to keep track of the billing date of the billing cycle that most recently triggered the generation of a report. If you are setting up this program for the first time, omit this field from your settings. The value is stored as an ISO-8601 datetime string, e.g. "2017-08-16T04:00:00Z". The default behavior when this value is missing is to interpret it as if no reports have ever been sent, so if you want to force a report to be resent, remove this key-value pair from your settings.

Project Information