solarlog-cli 0.2.0__tar.gz → 0.2.2__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.
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/PKG-INFO +1 -1
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/pyproject.toml +1 -1
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/src/solarlog_cli/solarlog_client.py +1 -1
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/src/solarlog_cli/solarlog_connector.py +11 -9
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/src/solarlog_cli/solarlog_models.py +5 -5
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/tests/__snapshots__/test_solarlog_cli.ambr +3 -3
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/.coverage +0 -0
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/.devcontainer/devcontainer.json +0 -0
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/.github/workflows/pylint.yml +0 -0
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/.github/workflows/python-publish.yml +0 -0
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/.github/workflows/ruff.yml +0 -0
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/.github/workflows/tests.yml +0 -0
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/.github/workflows/typing.yml +0 -0
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/.gitignore +0 -0
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/.vscode/settings.json +0 -0
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/.vscode/tasks.json +0 -0
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/LICENSE +0 -0
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/README.md +0 -0
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/pytest.ini +0 -0
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/requirements.txt +0 -0
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/src/solarlog_cli/__init__.py +0 -0
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/src/solarlog_cli/py.typed +0 -0
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/src/solarlog_cli/solarlog_exceptions.py +0 -0
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/tests/__init__.py +0 -0
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/tests/conftest.py +0 -0
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/tests/fixtures/basic_data.json +0 -0
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/tests/fixtures/basic_data_during_update.json +0 -0
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/tests/fixtures/basic_data_no_power.json +0 -0
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/tests/fixtures/device_data_1.json +0 -0
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/tests/fixtures/device_data_2.json +0 -0
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/tests/fixtures/device_data_3.json +0 -0
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/tests/fixtures/device_data_4.json +0 -0
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/tests/fixtures/device_list.json +0 -0
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/tests/fixtures/energy_per_inverter.json +0 -0
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/tests/fixtures/extended_data.json +0 -0
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/tests/fixtures/power_per_inverter.json +0 -0
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/tests/ruff.toml +0 -0
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/tests/syrupy.py +0 -0
- {solarlog_cli-0.2.0 → solarlog_cli-0.2.2}/tests/test_solarlog_cli.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: solarlog_cli
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
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
|
|
@@ -137,7 +137,7 @@ class Client:
|
|
|
137
137
|
return data
|
|
138
138
|
|
|
139
139
|
async def get_energy(self, data: SolarlogData) -> SolarlogData:
|
|
140
|
-
"""Get
|
|
140
|
+
"""Get energy data from Solar-Log"""
|
|
141
141
|
|
|
142
142
|
raw_data: dict = await self.execute_http_request({878: None})
|
|
143
143
|
|
|
@@ -14,20 +14,22 @@ _LOGGER = logging.getLogger(__name__)
|
|
|
14
14
|
class SolarLogConnector:
|
|
15
15
|
"""Connector class to access Solar-Log."""
|
|
16
16
|
|
|
17
|
-
def __init__(
|
|
17
|
+
def __init__(
|
|
18
18
|
self,
|
|
19
19
|
host: str,
|
|
20
20
|
extended_data: bool = False,
|
|
21
21
|
tz: str = "",
|
|
22
|
-
device_enabled: dict[int, bool] =
|
|
22
|
+
device_enabled: dict[int, bool] | None = None,
|
|
23
23
|
):
|
|
24
24
|
self.client = Client(host)
|
|
25
25
|
self.extended_data: bool = extended_data
|
|
26
26
|
|
|
27
27
|
self._device_list: dict[int, InverterData] = {}
|
|
28
|
-
if device_enabled
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
if device_enabled is None:
|
|
29
|
+
device_enabled = {}
|
|
30
|
+
|
|
31
|
+
for key, value in device_enabled.items():
|
|
32
|
+
self._device_list |= {key: InverterData(enabled=value)}
|
|
31
33
|
|
|
32
34
|
self.timezone: tzinfo = timezone.utc if tz == "" else ZoneInfo(tz)
|
|
33
35
|
|
|
@@ -60,21 +62,21 @@ class SolarLogConnector:
|
|
|
60
62
|
#calculated values (for downward compatibility)
|
|
61
63
|
data.alternator_loss = data.power_dc - data.power_ac
|
|
62
64
|
if data.power_dc != 0:
|
|
63
|
-
data.efficiency = data.power_ac / data.power_dc
|
|
65
|
+
data.efficiency = round(data.power_ac / data.power_dc *100, 1)
|
|
64
66
|
if data.power_ac != 0:
|
|
65
|
-
data.usage = data.consumption_ac / data.power_ac
|
|
67
|
+
data.usage = round(data.consumption_ac / data.power_ac * 100, 1)
|
|
66
68
|
data.power_available = data.power_ac - data.consumption_ac
|
|
67
69
|
else:
|
|
68
70
|
data.usage = 0.0
|
|
69
71
|
data.power_available = 0.0
|
|
70
72
|
if data.total_power != 0:
|
|
71
|
-
data.capacity = data.power_dc / data.total_power
|
|
73
|
+
data.capacity = round(data.power_dc / data.total_power * 100, 1)
|
|
72
74
|
|
|
73
75
|
return data
|
|
74
76
|
|
|
75
77
|
async def update_device_list(self) -> dict[int, InverterData]:
|
|
76
78
|
"""Update list of devices."""
|
|
77
|
-
if not self.extended_data
|
|
79
|
+
if not self.extended_data:
|
|
78
80
|
return {}
|
|
79
81
|
|
|
80
82
|
devices = await self.client.get_device_list()
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"""Models for SolarLog."""
|
|
2
|
-
from dataclasses import dataclass
|
|
2
|
+
from dataclasses import dataclass, field
|
|
3
3
|
from datetime import datetime
|
|
4
4
|
|
|
5
5
|
from mashumaro import DataClassDictMixin
|
|
@@ -12,7 +12,7 @@ class InverterData():
|
|
|
12
12
|
name: str = ""
|
|
13
13
|
enabled: bool = False
|
|
14
14
|
current_power: float | None = None
|
|
15
|
-
consumption_year: float | None
|
|
15
|
+
consumption_year: float | None= None
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
@dataclass
|
|
@@ -40,13 +40,13 @@ class SolarlogData(DataClassDictMixin):
|
|
|
40
40
|
yield_total: float
|
|
41
41
|
|
|
42
42
|
#calculated values
|
|
43
|
-
alternator_loss: float
|
|
43
|
+
alternator_loss: float = 0
|
|
44
44
|
capacity: float | None = None
|
|
45
45
|
efficiency: float | None = None
|
|
46
|
-
power_available: float
|
|
46
|
+
power_available: float = 0
|
|
47
47
|
usage: float | None = None
|
|
48
48
|
|
|
49
49
|
#extended data
|
|
50
|
-
inverter_data: dict[int, InverterData]
|
|
50
|
+
inverter_data: dict[int, InverterData] = field(default_factory=dict)
|
|
51
51
|
production_year: float | None = None
|
|
52
52
|
self_consumption_year: float | None = None
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
# name: test_update_data[asyncio]
|
|
3
3
|
dict({
|
|
4
4
|
'alternator_loss': 100,
|
|
5
|
-
'capacity':
|
|
5
|
+
'capacity': 27.9,
|
|
6
6
|
'consumption_ac': 3110,
|
|
7
7
|
'consumption_day': 47819,
|
|
8
8
|
'consumption_month': 697471,
|
|
9
9
|
'consumption_total': 28385247,
|
|
10
10
|
'consumption_year': 4218251,
|
|
11
11
|
'consumption_yesterday': 94350,
|
|
12
|
-
'efficiency':
|
|
12
|
+
'efficiency': 96.7,
|
|
13
13
|
'inverter_data': dict({
|
|
14
14
|
0: dict({
|
|
15
15
|
'consumption_year': 4227027.0,
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
'production_year': 8852462,
|
|
44
44
|
'self_consumption_year': 2071,
|
|
45
45
|
'total_power': 10720,
|
|
46
|
-
'usage':
|
|
46
|
+
'usage': 107.6,
|
|
47
47
|
'voltage_ac': 0,
|
|
48
48
|
'voltage_dc': 492,
|
|
49
49
|
'yield_day': 17490,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|