ics_2000_python 0.1.3__tar.gz → 0.1.4__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.
Files changed (23) hide show
  1. {ics_2000_python-0.1.3 → ics_2000_python-0.1.4}/PKG-INFO +1 -1
  2. {ics_2000_python-0.1.3 → ics_2000_python-0.1.4}/ics_2000/config.py +4 -1
  3. ics_2000_python-0.1.4/ics_2000/entities/blind_device.py +74 -0
  4. {ics_2000_python-0.1.3 → ics_2000_python-0.1.4}/ics_2000/hub.py +5 -2
  5. {ics_2000_python-0.1.3 → ics_2000_python-0.1.4}/ics_2000/model/device_config.py +6 -0
  6. {ics_2000_python-0.1.3 → ics_2000_python-0.1.4}/pyproject.toml +1 -1
  7. {ics_2000_python-0.1.3 → ics_2000_python-0.1.4}/LICENSE +0 -0
  8. {ics_2000_python-0.1.3 → ics_2000_python-0.1.4}/README.md +0 -0
  9. {ics_2000_python-0.1.3 → ics_2000_python-0.1.4}/ics_2000/__init__.py +0 -0
  10. {ics_2000_python-0.1.3 → ics_2000_python-0.1.4}/ics_2000/command.py +0 -0
  11. {ics_2000_python-0.1.3 → ics_2000_python-0.1.4}/ics_2000/encryption.py +0 -0
  12. {ics_2000_python-0.1.3 → ics_2000_python-0.1.4}/ics_2000/entities/__init__.py +0 -0
  13. {ics_2000_python-0.1.3 → ics_2000_python-0.1.4}/ics_2000/entities/color_temperature_device.py +0 -0
  14. {ics_2000_python-0.1.3 → ics_2000_python-0.1.4}/ics_2000/entities/device.py +0 -0
  15. {ics_2000_python-0.1.3 → ics_2000_python-0.1.4}/ics_2000/entities/dim_device.py +0 -0
  16. {ics_2000_python-0.1.3 → ics_2000_python-0.1.4}/ics_2000/entities/entity.py +0 -0
  17. {ics_2000_python-0.1.3 → ics_2000_python-0.1.4}/ics_2000/entities/switch_device.py +0 -0
  18. {ics_2000_python-0.1.3 → ics_2000_python-0.1.4}/ics_2000/exceptions.py +0 -0
  19. {ics_2000_python-0.1.3 → ics_2000_python-0.1.4}/ics_2000/model/__init__.py +0 -0
  20. {ics_2000_python-0.1.3 → ics_2000_python-0.1.4}/ics_2000/model/device_data.py +0 -0
  21. {ics_2000_python-0.1.3 → ics_2000_python-0.1.4}/ics_2000/model/entity_type.py +0 -0
  22. {ics_2000_python-0.1.3 → ics_2000_python-0.1.4}/ics_2000/model/smart_meter_data.py +0 -0
  23. {ics_2000_python-0.1.3 → ics_2000_python-0.1.4}/ics_2000/model/smart_meter_data_current.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: ics_2000_python
3
- Version: 0.1.3
3
+ Version: 0.1.4
4
4
  Summary:
5
5
  Keywords: ics_2000,ics-2000,klikaanklikuit
6
6
  Author: iiTzArcur
@@ -1,3 +1,4 @@
1
+
1
2
  from .model.device_config import DeviceConfig
2
3
 
3
4
 
@@ -94,8 +95,10 @@ device_configs: dict[int, DeviceConfig] = {
94
95
  model_name="AWMT Buil-in wall switch",
95
96
  ),
96
97
  23: DeviceConfig(
97
- disabled=True,
98
98
  model_name="Somfy Actuator",
99
+ index_open=0,
100
+ index_my=1,
101
+ index_close=2,
99
102
  ),
100
103
  24: DeviceConfig(
101
104
  model_name="KAKU dimmable lightbulb",
@@ -0,0 +1,74 @@
1
+ from ..model import device_data
2
+ from ..model.device_config import DeviceConfig
3
+ from .device import Device
4
+
5
+
6
+ class BlindDevice(Device):
7
+ def __init__(self, hub, device_data: device_data.DeviceData, device_config: DeviceConfig):
8
+ super().__init__(hub, device_data, device_config)
9
+
10
+ if device_config.index_open is None:
11
+ raise ValueError(
12
+ f"index_open not defined for '{self.device_data.name}'"
13
+ )
14
+ if device_config.index_close is None:
15
+ raise ValueError(
16
+ f"index_close not defined for '{self.device_data.name}'"
17
+ )
18
+ if device_config.index_my is None:
19
+ raise ValueError(
20
+ f"index_my not defined for '{self.device_data.name}'"
21
+ )
22
+
23
+ def open(self, send_local: bool = False) -> None:
24
+ """Turn off the device.
25
+
26
+ Args:
27
+ send_local: Use the ip_address set on the hub to talk to the device
28
+ send_local set to false, because it triggers a time out.
29
+ """
30
+ if self.device_config.index_open is None:
31
+ return
32
+
33
+ self.get_hub().change_status(
34
+ self.entity_id,
35
+ self.device_config.index_open,
36
+ 0,
37
+ self.is_group,
38
+ send_local,
39
+ )
40
+
41
+ def close(self, send_local: bool = False) -> None:
42
+ """Turn off the device.
43
+
44
+ Args:
45
+ send_local: Use the ip_address set on the hub to talk to the device
46
+ send_local set to false, because it triggers a timeout.
47
+ """
48
+ if self.device_config.index_close is None:
49
+ return
50
+
51
+ self.get_hub().change_status(
52
+ self.entity_id,
53
+ self.device_config.index_close,
54
+ 0,
55
+ self.is_group,
56
+ send_local,
57
+ )
58
+ def stop(self, send_local: bool = False) -> None:
59
+ """Turn off the device.
60
+
61
+ Args:
62
+ send_local: Use the ip_address set on the hub to talk to the device
63
+ send_local set to false, because it triggers a timeout.
64
+ """
65
+ if self.device_config.index_my is None:
66
+ return
67
+
68
+ self.get_hub().change_status(
69
+ self.entity_id,
70
+ self.device_config.index_my,
71
+ 0,
72
+ self.is_group,
73
+ send_local,
74
+ )
@@ -6,6 +6,7 @@ from ics_2000.exceptions import InvalidAuthException, InvalidHomeException, Inva
6
6
  from .command import Command
7
7
  from .encryption import decrypt
8
8
  from .config import API_URL, device_configs
9
+ from .entities.blind_device import BlindDevice
9
10
  from .entities.color_temperature_device import ColorTemperatureDevice
10
11
  from .entities.device import Device
11
12
  from .entities.dim_device import DimDevice
@@ -27,7 +28,7 @@ class Hub:
27
28
  def __init__(self, email: str, password: str):
28
29
  self.homes = []
29
30
  self.devices: list[
30
- Device | DimDevice | SwitchDevice | ColorTemperatureDevice
31
+ Device | DimDevice | SwitchDevice | ColorTemperatureDevice | BlindDevice
31
32
  ] = []
32
33
  """List of available devices within the authenticated home"""
33
34
  self.aes_key: str | None = None
@@ -120,7 +121,7 @@ class Hub:
120
121
 
121
122
  def get_devices(
122
123
  self,
123
- ) -> list[Device | DimDevice | SwitchDevice | ColorTemperatureDevice]:
124
+ ) -> list[Device | DimDevice | SwitchDevice | ColorTemperatureDevice | BlindDevice]:
124
125
  """Gets all devices connected to the hub"""
125
126
  if self.home_id is None:
126
127
  raise NoHomeSelectedException()
@@ -157,6 +158,8 @@ class Hub:
157
158
 
158
159
  elif device_config.on_off_function is not None:
159
160
  self.devices.append(SwitchDevice(self, device_data, device_config))
161
+ elif device_config.index_open is not None and device_config.index_close is not None and device_config.index_my is not None:
162
+ self.devices.append(BlindDevice(self, device_data, device_config))
160
163
  else:
161
164
  self.devices.append(Device(self, device_data, device_config))
162
165
  return self.devices
@@ -11,6 +11,9 @@ class DeviceConfig:
11
11
  color_temperature_function: Optional[int] = None,
12
12
  max_brightness: Optional[int] = None,
13
13
  max_color_temperature: Optional[int] = None,
14
+ index_open: Optional[int] = None,
15
+ index_close: Optional[int] = None,
16
+ index_my: Optional[int] = None,
14
17
  ):
15
18
  self.disabled = disabled
16
19
  self.model_name = model_name
@@ -19,3 +22,6 @@ class DeviceConfig:
19
22
  self.color_temperature_function = color_temperature_function
20
23
  self.max_brightness = max_brightness
21
24
  self.max_color_temperature = max_color_temperature
25
+ self.index_open = index_open
26
+ self.index_close = index_close
27
+ self.index_my = index_my
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "ics_2000_python"
3
- version = "0.1.3"
3
+ version = "0.1.4"
4
4
  description = ""
5
5
  authors = ["iiTzArcur <zefanjaj@gmail.com>"]
6
6
  readme = "README.md"
File without changes