Skip to content

Commit

Permalink
fix: Fix single value connection size (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
GuyKh authored Sep 2, 2024
1 parent e1a0d27 commit b4e5eb4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions iec_api/iec_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,9 @@ async def get_power_size(self, connection: Optional[str] = None) -> float:

connection = device_details.counter_devices[0].connection_size.representative_connection_size

if 'X' not in connection: # Solve cases where the connection size is "25"
connection = "1X" + connection

return await static_data.get_power_size(self._session, connection)

async def get_usage_calculator(self) -> UsageCalculator:
Expand Down
4 changes: 3 additions & 1 deletion iec_api/static_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ async def get_power_size(session: ClientSession, connection: str) -> float:
await _get_connection_to_power_size(session)

connection_to_power_size_map = cache[key]
power_size = connection_to_power_size_map[connection]

# If connection is not found, return 0
power_size = connection_to_power_size_map.get(connection, 0)

vat = await _get_vat(session)
return round(power_size * (1 + float(vat)), 2)

0 comments on commit b4e5eb4

Please sign in to comment.