solarlog-cli 0.1.0__tar.gz → 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: solarlog_cli
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: Python library to access the Solar-Log
5
5
  Project-URL: Repository, https://github.com/dontinelli/solarlog_cli.git
6
6
  Project-URL: Issues, https://github.com/dontinelli/solarlog_cli/issues
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "solarlog_cli"
3
- version = "0.1.0"
3
+ version = "0.1.1"
4
4
  authors = [
5
5
  { name="dontinelli", email="73341522+dontinelli@users.noreply.github.com" },
6
6
  ]
@@ -64,7 +64,7 @@ class Client:
64
64
  content_type = response.headers.get("Content-Type", "")
65
65
 
66
66
  if response.status != 200:
67
- msg = f"The server responded with error code {response.status} while fetching data from Solar-Log at {self.host}."
67
+ msg = f"The server responded with error code {response.status} while fetching data from Solar-Log at {self.host}.\n{url}\n{header}\n{json_payload}"
68
68
  text = await response.text()
69
69
  raise SolarLogUpdateError(
70
70
  msg,
@@ -47,6 +47,21 @@ class SolarLogConnector:
47
47
  data |= await self.client.get_energy()
48
48
  data |= {"devices": await self.update_inverter_data()}
49
49
  # print(f"extended data updated: {data}")
50
+
51
+ #calculated values (for downward compatibility)
52
+ if data.get("power_dc") != 0:
53
+ data |= {"efficiency": data.get("power_ac") / data.get("power_dc")}
54
+ if data.get("power_ac") != 0:
55
+ data |= {"usage": data.get("consumption_ac") / data.get("power_ac")}
56
+ data |= {"power_available": data.get("power_ac") - data.get("consumption_ac")}
57
+ else:
58
+ data |= {"usage": 0.0}
59
+ data |= {"power_available": 0.0}
60
+ data |= {"alternator_loss": data.get("power_dc") - data.get("power_ac")}
61
+
62
+ if data.get("total_power") != 0:
63
+ data |= {"capacity": - data.get("power_dc") / data.get("total_power")}
64
+
50
65
  return data
51
66
 
52
67
  async def update_device_list(self) -> dict[int, dict[str, str | bool]]:
File without changes
File without changes
File without changes