Skip to content

Commit

Permalink
Switch generation back to new API
Browse files Browse the repository at this point in the history
  • Loading branch information
JRascagneres committed Aug 3, 2023
1 parent abb034c commit d8659b8
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions custom_components/national_grid/coordinators/national_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,28 +351,28 @@ def get_generation_old(


def get_generation_combined(api_key: str, now_utc_full: datetime, today_utc: str):
# grid_generation = get_generation(
# now_utc_full,
# )
grid_generation = get_generation(
now_utc_full,
)

now_utc_formatted_datetime = now_utc_full.strftime("%Y-%m-%d %H:%M:%S")
two_hours_ago_utc_formatted_datetime = (now_utc_full - timedelta(hours=2)).strftime(
"%Y-%m-%d %H:%M:%S"
)

grid_generation = get_generation_old(
api_key, two_hours_ago_utc_formatted_datetime, now_utc_formatted_datetime
)
# grid_generation = get_generation_old(
# api_key, two_hours_ago_utc_formatted_datetime, now_utc_formatted_datetime
# )

national_grid_data = get_national_grid_data(today_utc, now_utc_full)
if national_grid_data is None:
return UnexpectedDataError("National Grid ESO data None")

grid_generation["wind_mwh"] += int(national_grid_data["EMBEDDED_WIND_GENERATION"])
grid_generation["solar_mwh"] = int(national_grid_data["EMBEDDED_SOLAR_GENERATION"])
grid_generation["pumped_storage_mwh"] += -int(
national_grid_data["PUMP_STORAGE_PUMPING"]
)
# grid_generation["pumped_storage_mwh"] += -int(
# national_grid_data["PUMP_STORAGE_PUMPING"]
# )

return grid_generation

Expand Down

0 comments on commit d8659b8

Please sign in to comment.