Skip to content

Commit

Permalink
Rename the entities (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
klaasnicolaas authored Aug 27, 2021
1 parent afe8fab commit 3d4d18f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
22 changes: 11 additions & 11 deletions omnikinverter/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ class Inverter:
"""Object representing an Inverter response from Omnik Inverter."""

serial_number: str | None
inverter_model: str | None
inverter_firmware: str | None
inverter_current_power: int | None
inverter_energy_today: float | None
inverter_energy_total: float | None
model: str | None
firmware: str | None
current_power: int | None
energy_today: float | None
energy_total: float | None

@staticmethod
def from_js(data: dict[str, Any]) -> Inverter:
Expand All @@ -25,7 +25,7 @@ def from_js(data: dict[str, Any]) -> Inverter:
data: The data from the Omnik Inverter.
Returns:
A Inverter object.
An Inverter object.
"""

def get_values(position):
Expand All @@ -41,9 +41,9 @@ def get_values(position):

return Inverter(
serial_number=get_values(0),
inverter_model=get_values(3),
inverter_firmware=get_values(2),
inverter_current_power=get_values(5),
inverter_energy_today=get_values(6),
inverter_energy_total=get_values(7),
model=get_values(3),
firmware=get_values(2),
current_power=get_values(5),
energy_today=get_values(6),
energy_total=get_values(7),
)
7 changes: 7 additions & 0 deletions test_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ async def main():
) as omnik:
inverter: OmnikInverter = await omnik.inverter()
print(f"Omnik Inverter: {inverter}")
print()
print(f"Serial Number: {inverter.serial_number}")
print(f"Model: {inverter.model}")
print(f"Firmware: {inverter.firmware}")
print(f"Current Power: {inverter.current_power}")
print(f"Energy Production Today: {inverter.energy_today}")
print(f"Energy Production Total: {inverter.energy_total}")


if __name__ == "__main__":
Expand Down

0 comments on commit 3d4d18f

Please sign in to comment.