Skip to content

Commit

Permalink
Fix grid services data mapping which relates to VPP events
Browse files Browse the repository at this point in the history
  • Loading branch information
mcbirse committed Dec 20, 2023
1 parent 4d4d649 commit 9a4d007
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions pypowerwall/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,13 +313,9 @@ def poll(self, api):
grid_status = "SystemGridConnected"
else: # off_grid or off_grid_unintentional
grid_status = "SystemIslandedActive"
if lookup(power, ("response", "grid_status")) == "Active":
grid_services_active = True
else:
grid_services_active = False
data = {
"grid_status": grid_status, # SystemIslandedActive or SystemTransitionToGrid
"grid_services_active": grid_services_active
"grid_services_active": lookup(power, ("response", "grid_services_active")) # true when participating in VPP event
}

elif api == '/api/site_info/site_name':
Expand Down Expand Up @@ -481,7 +477,7 @@ def poll(self, api):
solar_power = lookup(power, ("response", "solar_power"))
battery_power = lookup(power, ("response", "battery_power"))
load_power = lookup(power, ("response", "load_power"))
grid_power = lookup(power, ("response", "grid_power"))
grid_services_power = lookup(power, ("response", "grid_services_power"))
grid_status = lookup(power, ("response", "grid_status"))
grid_services_active = lookup(power, ("response", "grid_services_active"))
battery_count = lookup(config, ("response", "battery_count"))
Expand Down Expand Up @@ -510,7 +506,7 @@ def poll(self, api):
"instantaneous_max_apparent_power": 0,
"hardware_capability_charge_power": 0,
"hardware_capability_discharge_power": 0,
"grid_services_power": grid_power,
"grid_services_power": grid_services_power,
"system_island_state": grid_status,
"available_blocks": battery_count,
"available_charger_blocks": 0,
Expand Down

0 comments on commit 9a4d007

Please sign in to comment.