Skip to content

Commit

Permalink
bchydro: Add additional columns
Browse files Browse the repository at this point in the history
BC Hydro data exports now include energy inflow and outflows (among
other things). This commit adjusts the namedtuple that is used when
importing the data to take those new columns into account.

Note that after this change, the net consumption (e.g. inflows minus
outflows) is stored in the database.
  • Loading branch information
Injabie3 committed Dec 31, 2024
1 parent adc626f commit 1e7d749
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions bchydro/bchydro-db.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@
(
"user",
"accId",
"meterNum",
"timestamp",
"usage",
"timeOfDayPeriod",
"inflow",
"outflow",
"netConsumption",
"demand",
"powerFactor",
"estUsage",
Expand Down Expand Up @@ -89,11 +93,11 @@ def _saveHourlyUsageToDb(self) -> None:
self.logger.info("Saving hourly data")
for row in self.data:
try:
usage = float(row.usage)
usage = float(row.netConsumption)
except ValueError:
self.logger.error(
"Unable to convert usage to float, got %s, " "skipping %s",
row.usage,
row.netConsumption,
row.timestamp,
)
continue
Expand Down

0 comments on commit 1e7d749

Please sign in to comment.