python-homewizard-energy 8.0.0a6__tar.gz → 8.0.0b2__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.
- {python_homewizard_energy-8.0.0a6 → python_homewizard_energy-8.0.0b2}/PKG-INFO +12 -7
- {python_homewizard_energy-8.0.0a6 → python_homewizard_energy-8.0.0b2}/README.md +11 -6
- {python_homewizard_energy-8.0.0a6 → python_homewizard_energy-8.0.0b2}/homewizard_energy/models.py +13 -2
- {python_homewizard_energy-8.0.0a6 → python_homewizard_energy-8.0.0b2}/pyproject.toml +1 -1
- {python_homewizard_energy-8.0.0a6 → python_homewizard_energy-8.0.0b2}/LICENSE +0 -0
- {python_homewizard_energy-8.0.0a6 → python_homewizard_energy-8.0.0b2}/homewizard_energy/__init__.py +0 -0
- {python_homewizard_energy-8.0.0a6 → python_homewizard_energy-8.0.0b2}/homewizard_energy/const.py +0 -0
- {python_homewizard_energy-8.0.0a6 → python_homewizard_energy-8.0.0b2}/homewizard_energy/errors.py +0 -0
- {python_homewizard_energy-8.0.0a6 → python_homewizard_energy-8.0.0b2}/homewizard_energy/homewizard_energy.py +0 -0
- {python_homewizard_energy-8.0.0a6 → python_homewizard_energy-8.0.0b2}/homewizard_energy/py.typed +0 -0
- {python_homewizard_energy-8.0.0a6 → python_homewizard_energy-8.0.0b2}/homewizard_energy/v1/__init__.py +0 -0
- {python_homewizard_energy-8.0.0a6 → python_homewizard_energy-8.0.0b2}/homewizard_energy/v1/const.py +0 -0
- {python_homewizard_energy-8.0.0a6 → python_homewizard_energy-8.0.0b2}/homewizard_energy/v2/__init__.py +0 -0
- {python_homewizard_energy-8.0.0a6 → python_homewizard_energy-8.0.0b2}/homewizard_energy/v2/cacert.py +0 -0
- {python_homewizard_energy-8.0.0a6 → python_homewizard_energy-8.0.0b2}/homewizard_energy/v2/const.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: python-homewizard-energy
|
|
3
|
-
Version: 8.0.
|
|
3
|
+
Version: 8.0.0b2
|
|
4
4
|
Summary: Asynchronous Python client for the HomeWizard Energy
|
|
5
5
|
Home-page: https://github.com/homewizard/python-homewizard-energy
|
|
6
6
|
License: Apache-2.0
|
|
@@ -44,6 +44,8 @@ python3 -m pip install python-homewizard-energy
|
|
|
44
44
|
```
|
|
45
45
|
|
|
46
46
|
## Example
|
|
47
|
+
|
|
48
|
+
### API v1
|
|
47
49
|
```python
|
|
48
50
|
import asyncio
|
|
49
51
|
from homewizard_energy import HomeWizardEnergyV1V1
|
|
@@ -55,15 +57,18 @@ async def main():
|
|
|
55
57
|
|
|
56
58
|
async with HomeWizardEnergyV1(host=IP_ADDRESS) as api:
|
|
57
59
|
|
|
58
|
-
|
|
60
|
+
# Get device information, like firmware version
|
|
59
61
|
print(await api.device())
|
|
60
62
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
print(
|
|
63
|
+
# Get measurements, like energy or water usage
|
|
64
|
+
measurement = await api.measurement()
|
|
65
|
+
print(measurement.energy_import_kwh)
|
|
66
|
+
|
|
67
|
+
# Get all data and remap v1 data to new v2 structure
|
|
68
|
+
print(await api.combined())
|
|
64
69
|
|
|
65
|
-
|
|
66
|
-
await api.
|
|
70
|
+
# Turn on the Energy Socket outlet
|
|
71
|
+
await api.state(power_on=True)
|
|
67
72
|
|
|
68
73
|
|
|
69
74
|
asyncio.run(main())
|
|
@@ -19,6 +19,8 @@ python3 -m pip install python-homewizard-energy
|
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
## Example
|
|
22
|
+
|
|
23
|
+
### API v1
|
|
22
24
|
```python
|
|
23
25
|
import asyncio
|
|
24
26
|
from homewizard_energy import HomeWizardEnergyV1V1
|
|
@@ -30,15 +32,18 @@ async def main():
|
|
|
30
32
|
|
|
31
33
|
async with HomeWizardEnergyV1(host=IP_ADDRESS) as api:
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
# Get device information, like firmware version
|
|
34
36
|
print(await api.device())
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
print(
|
|
38
|
+
# Get measurements, like energy or water usage
|
|
39
|
+
measurement = await api.measurement()
|
|
40
|
+
print(measurement.energy_import_kwh)
|
|
41
|
+
|
|
42
|
+
# Get all data and remap v1 data to new v2 structure
|
|
43
|
+
print(await api.combined())
|
|
39
44
|
|
|
40
|
-
|
|
41
|
-
await api.
|
|
45
|
+
# Turn on the Energy Socket outlet
|
|
46
|
+
await api.state(power_on=True)
|
|
42
47
|
|
|
43
48
|
|
|
44
49
|
asyncio.run(main())
|
{python_homewizard_energy-8.0.0a6 → python_homewizard_energy-8.0.0b2}/homewizard_energy/models.py
RENAMED
|
@@ -4,7 +4,7 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
from dataclasses import dataclass, field
|
|
6
6
|
from datetime import datetime
|
|
7
|
-
from enum import
|
|
7
|
+
from enum import StrEnum
|
|
8
8
|
from typing import Any
|
|
9
9
|
|
|
10
10
|
from mashumaro.config import BaseConfig
|
|
@@ -432,12 +432,23 @@ class Measurement(BaseModel):
|
|
|
432
432
|
|
|
433
433
|
return d
|
|
434
434
|
|
|
435
|
+
@classmethod
|
|
436
|
+
def __post_deserialize__(cls, obj: Measurement) -> Measurement:
|
|
437
|
+
"""Post deserialize hook for Measurement object."""
|
|
438
|
+
_ = cls # Unused
|
|
439
|
+
|
|
440
|
+
# Some smart meters report a tariff other than 1, 2, 3 or 4, which is invalid
|
|
441
|
+
if obj.tariff not in (1, 2, 3, 4):
|
|
442
|
+
obj.tariff = None
|
|
443
|
+
|
|
444
|
+
return obj
|
|
445
|
+
|
|
435
446
|
|
|
436
447
|
@dataclass(kw_only=True)
|
|
437
448
|
class ExternalDevice(BaseModel):
|
|
438
449
|
"""Represents externally connected device."""
|
|
439
450
|
|
|
440
|
-
class DeviceType(
|
|
451
|
+
class DeviceType(StrEnum):
|
|
441
452
|
"""Device type allocations."""
|
|
442
453
|
|
|
443
454
|
GAS_METER = "gas_meter"
|
|
File without changes
|
{python_homewizard_energy-8.0.0a6 → python_homewizard_energy-8.0.0b2}/homewizard_energy/__init__.py
RENAMED
|
File without changes
|
{python_homewizard_energy-8.0.0a6 → python_homewizard_energy-8.0.0b2}/homewizard_energy/const.py
RENAMED
|
File without changes
|
{python_homewizard_energy-8.0.0a6 → python_homewizard_energy-8.0.0b2}/homewizard_energy/errors.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_homewizard_energy-8.0.0a6 → python_homewizard_energy-8.0.0b2}/homewizard_energy/py.typed
RENAMED
|
File without changes
|
|
File without changes
|
{python_homewizard_energy-8.0.0a6 → python_homewizard_energy-8.0.0b2}/homewizard_energy/v1/const.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_homewizard_energy-8.0.0a6 → python_homewizard_energy-8.0.0b2}/homewizard_energy/v2/cacert.py
RENAMED
|
File without changes
|
{python_homewizard_energy-8.0.0a6 → python_homewizard_energy-8.0.0b2}/homewizard_energy/v2/const.py
RENAMED
|
File without changes
|