ics_2000_python 0.1.4__tar.gz → 0.1.5__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.
- {ics_2000_python-0.1.4 → ics_2000_python-0.1.5}/PKG-INFO +1 -1
- {ics_2000_python-0.1.4 → ics_2000_python-0.1.5}/ics_2000/command.py +3 -2
- {ics_2000_python-0.1.4 → ics_2000_python-0.1.5}/ics_2000/config.py +0 -2
- {ics_2000_python-0.1.4 → ics_2000_python-0.1.5}/ics_2000/encryption.py +1 -0
- {ics_2000_python-0.1.4 → ics_2000_python-0.1.5}/ics_2000/entities/blind_device.py +7 -10
- {ics_2000_python-0.1.4 → ics_2000_python-0.1.5}/ics_2000/entities/color_temperature_device.py +2 -1
- {ics_2000_python-0.1.4 → ics_2000_python-0.1.5}/ics_2000/entities/device.py +3 -2
- {ics_2000_python-0.1.4 → ics_2000_python-0.1.5}/ics_2000/entities/dim_device.py +2 -1
- {ics_2000_python-0.1.4 → ics_2000_python-0.1.5}/ics_2000/entities/entity.py +2 -2
- {ics_2000_python-0.1.4 → ics_2000_python-0.1.5}/ics_2000/hub.py +20 -6
- {ics_2000_python-0.1.4 → ics_2000_python-0.1.5}/ics_2000/model/device_config.py +9 -9
- {ics_2000_python-0.1.4 → ics_2000_python-0.1.5}/ics_2000/model/device_data.py +2 -5
- {ics_2000_python-0.1.4 → ics_2000_python-0.1.5}/ics_2000/model/entity_type.py +1 -1
- {ics_2000_python-0.1.4 → ics_2000_python-0.1.5}/ics_2000/model/smart_meter_data.py +1 -2
- {ics_2000_python-0.1.4 → ics_2000_python-0.1.5}/ics_2000/model/smart_meter_data_current.py +1 -4
- {ics_2000_python-0.1.4 → ics_2000_python-0.1.5}/pyproject.toml +1 -1
- {ics_2000_python-0.1.4 → ics_2000_python-0.1.5}/LICENSE +0 -0
- {ics_2000_python-0.1.4 → ics_2000_python-0.1.5}/README.md +0 -0
- {ics_2000_python-0.1.4 → ics_2000_python-0.1.5}/ics_2000/__init__.py +0 -0
- {ics_2000_python-0.1.4 → ics_2000_python-0.1.5}/ics_2000/entities/__init__.py +0 -0
- {ics_2000_python-0.1.4 → ics_2000_python-0.1.5}/ics_2000/entities/switch_device.py +1 -1
- {ics_2000_python-0.1.4 → ics_2000_python-0.1.5}/ics_2000/exceptions.py +0 -0
- {ics_2000_python-0.1.4 → ics_2000_python-0.1.5}/ics_2000/model/__init__.py +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import json
|
|
2
|
-
from typing import List
|
|
3
2
|
import socket
|
|
3
|
+
|
|
4
4
|
import requests
|
|
5
|
+
|
|
5
6
|
from .config import API_URL
|
|
6
7
|
from .encryption import encrypt
|
|
7
8
|
from .model.entity_type import Entity_Type
|
|
@@ -16,7 +17,7 @@ class Command:
|
|
|
16
17
|
value: int | float,
|
|
17
18
|
aes_key: str,
|
|
18
19
|
entity_type: Entity_Type,
|
|
19
|
-
device_functions:
|
|
20
|
+
device_functions: list[int | float] = [],
|
|
20
21
|
):
|
|
21
22
|
self.hub_mac = hub_mac
|
|
22
23
|
self.device_id = device_id
|
|
@@ -4,21 +4,17 @@ from .device import Device
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class BlindDevice(Device):
|
|
7
|
-
def __init__(
|
|
7
|
+
def __init__(
|
|
8
|
+
self, hub, device_data: device_data.DeviceData, device_config: DeviceConfig
|
|
9
|
+
):
|
|
8
10
|
super().__init__(hub, device_data, device_config)
|
|
9
11
|
|
|
10
12
|
if device_config.index_open is None:
|
|
11
|
-
raise ValueError(
|
|
12
|
-
f"index_open not defined for '{self.device_data.name}'"
|
|
13
|
-
)
|
|
13
|
+
raise ValueError(f"index_open not defined for '{self.device_data.name}'")
|
|
14
14
|
if device_config.index_close is None:
|
|
15
|
-
raise ValueError(
|
|
16
|
-
f"index_close not defined for '{self.device_data.name}'"
|
|
17
|
-
)
|
|
15
|
+
raise ValueError(f"index_close not defined for '{self.device_data.name}'")
|
|
18
16
|
if device_config.index_my is None:
|
|
19
|
-
raise ValueError(
|
|
20
|
-
f"index_my not defined for '{self.device_data.name}'"
|
|
21
|
-
)
|
|
17
|
+
raise ValueError(f"index_my not defined for '{self.device_data.name}'")
|
|
22
18
|
|
|
23
19
|
def open(self, send_local: bool = False) -> None:
|
|
24
20
|
"""Turn off the device.
|
|
@@ -55,6 +51,7 @@ class BlindDevice(Device):
|
|
|
55
51
|
self.is_group,
|
|
56
52
|
send_local,
|
|
57
53
|
)
|
|
54
|
+
|
|
58
55
|
def stop(self, send_local: bool = False) -> None:
|
|
59
56
|
"""Turn off the device.
|
|
60
57
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
from typing import TYPE_CHECKING
|
|
2
|
-
|
|
3
|
-
from ..model.device_data import DeviceData
|
|
2
|
+
|
|
4
3
|
from ..model.device_config import DeviceConfig
|
|
4
|
+
from ..model.device_data import DeviceData
|
|
5
|
+
from .entity import Entity
|
|
5
6
|
|
|
6
7
|
if TYPE_CHECKING:
|
|
7
8
|
from ..hub import Hub
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
from typing import TYPE_CHECKING
|
|
2
|
+
|
|
3
|
+
from ..model.device_config import DeviceConfig
|
|
2
4
|
from ..model.device_data import DeviceData
|
|
3
5
|
from .switch_device import SwitchDevice
|
|
4
|
-
from ..model.device_config import DeviceConfig
|
|
5
6
|
|
|
6
7
|
if TYPE_CHECKING:
|
|
7
8
|
from ..hub import Hub
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import
|
|
1
|
+
from typing import TYPE_CHECKING
|
|
2
2
|
|
|
3
3
|
from ..model.device_data import DeviceData
|
|
4
4
|
from ..model.entity_type import EntityType
|
|
@@ -25,7 +25,7 @@ class Entity:
|
|
|
25
25
|
self.device_data = device_data
|
|
26
26
|
self.is_group = entity_type == "group"
|
|
27
27
|
|
|
28
|
-
def get_status(self) ->
|
|
28
|
+
def get_status(self) -> list[int]:
|
|
29
29
|
return self._hub.get_device_status(self.entity_id)
|
|
30
30
|
|
|
31
31
|
def get_hub(self) -> "Hub":
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
from datetime import datetime
|
|
2
1
|
import json
|
|
2
|
+
from datetime import datetime
|
|
3
|
+
|
|
3
4
|
import requests
|
|
4
5
|
|
|
5
|
-
from ics_2000.exceptions import
|
|
6
|
+
from ics_2000.exceptions import (
|
|
7
|
+
InvalidAuthException,
|
|
8
|
+
InvalidHomeException,
|
|
9
|
+
InvalidMacOrAuthException,
|
|
10
|
+
NoHomeSelectedException,
|
|
11
|
+
)
|
|
12
|
+
|
|
6
13
|
from .command import Command
|
|
7
|
-
from .encryption import decrypt
|
|
8
14
|
from .config import API_URL, device_configs
|
|
15
|
+
from .encryption import decrypt
|
|
9
16
|
from .entities.blind_device import BlindDevice
|
|
10
17
|
from .entities.color_temperature_device import ColorTemperatureDevice
|
|
11
18
|
from .entities.device import Device
|
|
@@ -73,7 +80,9 @@ class Hub:
|
|
|
73
80
|
data = response.json()
|
|
74
81
|
if data is not None:
|
|
75
82
|
self.homes = data.get("homes", [])
|
|
76
|
-
return dict(
|
|
83
|
+
return dict(
|
|
84
|
+
[(home.get("home_id"), home.get("home_name")) for home in self.homes]
|
|
85
|
+
)
|
|
77
86
|
|
|
78
87
|
def select_home(self, home_id: str) -> None:
|
|
79
88
|
home = next(home for home in self.homes if home.get("home_id") == home_id)
|
|
@@ -95,7 +104,7 @@ class Hub:
|
|
|
95
104
|
"email": self.email,
|
|
96
105
|
"mac": self.mac,
|
|
97
106
|
"password_hash": self.password,
|
|
98
|
-
"home_id":
|
|
107
|
+
"home_id": self.home_id,
|
|
99
108
|
},
|
|
100
109
|
)
|
|
101
110
|
data = []
|
|
@@ -127,6 +136,7 @@ class Hub:
|
|
|
127
136
|
raise NoHomeSelectedException()
|
|
128
137
|
|
|
129
138
|
entities = self.get_raw_devices_data(True, False)
|
|
139
|
+
print(entities)
|
|
130
140
|
for device in entities:
|
|
131
141
|
device_data = DeviceData(
|
|
132
142
|
home_id=self.home_id,
|
|
@@ -158,7 +168,11 @@ class Hub:
|
|
|
158
168
|
|
|
159
169
|
elif device_config.on_off_function is not None:
|
|
160
170
|
self.devices.append(SwitchDevice(self, device_data, device_config))
|
|
161
|
-
elif
|
|
171
|
+
elif (
|
|
172
|
+
device_config.index_open is not None
|
|
173
|
+
and device_config.index_close is not None
|
|
174
|
+
and device_config.index_my is not None
|
|
175
|
+
):
|
|
162
176
|
self.devices.append(BlindDevice(self, device_data, device_config))
|
|
163
177
|
else:
|
|
164
178
|
self.devices.append(Device(self, device_data, device_config))
|
|
@@ -5,15 +5,15 @@ class DeviceConfig:
|
|
|
5
5
|
def __init__(
|
|
6
6
|
self,
|
|
7
7
|
model_name: str,
|
|
8
|
-
disabled:
|
|
9
|
-
on_off_function:
|
|
10
|
-
dim_function:
|
|
11
|
-
color_temperature_function:
|
|
12
|
-
max_brightness:
|
|
13
|
-
max_color_temperature:
|
|
14
|
-
index_open:
|
|
15
|
-
index_close:
|
|
16
|
-
index_my:
|
|
8
|
+
disabled: bool | None = None,
|
|
9
|
+
on_off_function: int | None = None,
|
|
10
|
+
dim_function: int | None = None,
|
|
11
|
+
color_temperature_function: int | None = None,
|
|
12
|
+
max_brightness: int | None = None,
|
|
13
|
+
max_color_temperature: int | None = None,
|
|
14
|
+
index_open: int | None = None,
|
|
15
|
+
index_close: int | None = None,
|
|
16
|
+
index_my: int | None = None,
|
|
17
17
|
):
|
|
18
18
|
self.disabled = disabled
|
|
19
19
|
self.model_name = model_name
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
from typing import Dict
|
|
2
|
-
|
|
3
|
-
|
|
4
1
|
class DeviceData:
|
|
5
2
|
def __init__(
|
|
6
3
|
self,
|
|
@@ -9,8 +6,8 @@ class DeviceData:
|
|
|
9
6
|
name: str,
|
|
10
7
|
device: int,
|
|
11
8
|
isGroup: bool,
|
|
12
|
-
status:
|
|
13
|
-
data:
|
|
9
|
+
status: dict[str, dict[str, int]],
|
|
10
|
+
data: dict[str, dict[str, int]],
|
|
14
11
|
):
|
|
15
12
|
self.home_id = home_id
|
|
16
13
|
self.id = id
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
from typing import Union
|
|
2
1
|
from datetime import datetime
|
|
3
2
|
|
|
4
3
|
Precision = str
|
|
@@ -7,7 +6,7 @@ Precision = str
|
|
|
7
6
|
class SmartMeterData:
|
|
8
7
|
def __init__(
|
|
9
8
|
self,
|
|
10
|
-
date:
|
|
9
|
+
date: datetime | str | int,
|
|
11
10
|
power_consumed_low_tariff: float,
|
|
12
11
|
power_consumed: float,
|
|
13
12
|
power_produced_low_tariff: float,
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
from typing import List
|
|
2
|
-
|
|
3
|
-
|
|
4
1
|
class SmartMeterDataCurrent:
|
|
5
2
|
def __init__(
|
|
6
3
|
self,
|
|
@@ -11,7 +8,7 @@ class SmartMeterDataCurrent:
|
|
|
11
8
|
current_consumption: float,
|
|
12
9
|
current_production: float,
|
|
13
10
|
gas: float,
|
|
14
|
-
raw_data_array:
|
|
11
|
+
raw_data_array: list[float],
|
|
15
12
|
):
|
|
16
13
|
self.power_consumed_low_tariff = power_consumed_low_tariff
|
|
17
14
|
self.power_consumed = power_consumed
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|