pywmspro 0.3.2__tar.gz → 0.3.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.
- {pywmspro-0.3.2 → pywmspro-0.3.4}/PKG-INFO +1 -1
- {pywmspro-0.3.2 → pywmspro-0.3.4}/wmspro/action.py +41 -7
- {pywmspro-0.3.2 → pywmspro-0.3.4}/wmspro/webcontrol.py +8 -0
- {pywmspro-0.3.2 → pywmspro-0.3.4}/.github/workflows/release.yaml +0 -0
- {pywmspro-0.3.2 → pywmspro-0.3.4}/.github/workflows/ruff.yaml +0 -0
- {pywmspro-0.3.2 → pywmspro-0.3.4}/.gitignore +0 -0
- {pywmspro-0.3.2 → pywmspro-0.3.4}/.python-version +0 -0
- {pywmspro-0.3.2 → pywmspro-0.3.4}/LICENSE +0 -0
- {pywmspro-0.3.2 → pywmspro-0.3.4}/README.md +0 -0
- {pywmspro-0.3.2 → pywmspro-0.3.4}/pyproject.toml +0 -0
- {pywmspro-0.3.2 → pywmspro-0.3.4}/simulator/simulator.py +0 -0
- {pywmspro-0.3.2 → pywmspro-0.3.4}/uv.lock +0 -0
- {pywmspro-0.3.2 → pywmspro-0.3.4}/wmspro/__init__.py +0 -0
- {pywmspro-0.3.2 → pywmspro-0.3.4}/wmspro/const.py +0 -0
- {pywmspro-0.3.2 → pywmspro-0.3.4}/wmspro/destination.py +0 -0
- {pywmspro-0.3.2 → pywmspro-0.3.4}/wmspro/room.py +0 -0
- {pywmspro-0.3.2 → pywmspro-0.3.4}/wmspro/scene.py +0 -0
|
@@ -6,6 +6,22 @@ from .const import (
|
|
|
6
6
|
)
|
|
7
7
|
|
|
8
8
|
|
|
9
|
+
class ActionList(list):
|
|
10
|
+
def __init__(self, control) -> None:
|
|
11
|
+
super().__init__()
|
|
12
|
+
self._control = control
|
|
13
|
+
|
|
14
|
+
async def __call__(
|
|
15
|
+
self, responseType=WMS_WebControl_pro_API_responseType.Instant
|
|
16
|
+
) -> Any:
|
|
17
|
+
if len(self) == 0:
|
|
18
|
+
raise ValueError("ActionList is empty")
|
|
19
|
+
return await self._control._action(
|
|
20
|
+
actions=self,
|
|
21
|
+
responseType=responseType,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
|
|
9
25
|
class Action:
|
|
10
26
|
def __init__(
|
|
11
27
|
self, dest, id: int, actionType: int, actionDescription: int, **kwargs
|
|
@@ -18,6 +34,7 @@ class Action:
|
|
|
18
34
|
)
|
|
19
35
|
self._attrs = kwargs
|
|
20
36
|
self._params = {}
|
|
37
|
+
self._overwrites = {}
|
|
21
38
|
|
|
22
39
|
def __str__(self) -> str:
|
|
23
40
|
return self.actionDescription.name
|
|
@@ -57,22 +74,39 @@ class Action:
|
|
|
57
74
|
# --- Public methods ---
|
|
58
75
|
|
|
59
76
|
def __getattr__(self, name: str) -> Any:
|
|
77
|
+
if name in self._overwrites:
|
|
78
|
+
return self._overwrites[name]
|
|
79
|
+
if name.startswith("wms__"):
|
|
80
|
+
name = name[5:]
|
|
60
81
|
return self._attrs.get(name)
|
|
61
82
|
|
|
62
83
|
def __getitem__(self, name: str) -> Any:
|
|
63
84
|
return self._params.get(name)
|
|
64
85
|
|
|
86
|
+
def __setitem__(self, name: str, value: Any) -> None:
|
|
87
|
+
if name in self._attrs:
|
|
88
|
+
self._overwrites[name] = value
|
|
89
|
+
elif name in self._params:
|
|
90
|
+
self._params[name] = value
|
|
91
|
+
|
|
92
|
+
def __delitem__(self, name: str) -> None:
|
|
93
|
+
if name in self._overwrites:
|
|
94
|
+
del self._overwrites[name]
|
|
95
|
+
|
|
96
|
+
def prep(self, **kwargs) -> ActionList:
|
|
97
|
+
actionList = ActionList(self._dest._control)
|
|
98
|
+
actionList.append({
|
|
99
|
+
"destinationId": self._dest.id,
|
|
100
|
+
"actionId": self.id,
|
|
101
|
+
"parameters": kwargs,
|
|
102
|
+
})
|
|
103
|
+
return actionList
|
|
104
|
+
|
|
65
105
|
async def __call__(
|
|
66
106
|
self, responseType=WMS_WebControl_pro_API_responseType.Instant, **kwargs
|
|
67
107
|
) -> Any:
|
|
68
108
|
return await self._dest._control._action(
|
|
69
|
-
actions=
|
|
70
|
-
{
|
|
71
|
-
"destinationId": self._dest.id,
|
|
72
|
-
"actionId": self.id,
|
|
73
|
-
"parameters": kwargs,
|
|
74
|
-
}
|
|
75
|
-
],
|
|
109
|
+
actions=self.prep(**kwargs),
|
|
76
110
|
responseType=responseType,
|
|
77
111
|
)
|
|
78
112
|
|
|
@@ -159,6 +159,14 @@ async def async_main_test():
|
|
|
159
159
|
)
|
|
160
160
|
print(response)
|
|
161
161
|
|
|
162
|
+
action_list = action.prep(percentage=100)
|
|
163
|
+
action_list += action.prep(percentage=0)
|
|
164
|
+
print(action_list)
|
|
165
|
+
response = await action_list(
|
|
166
|
+
responseType=WMS_WebControl_pro_API_responseType.Detailed
|
|
167
|
+
)
|
|
168
|
+
print(response)
|
|
169
|
+
|
|
162
170
|
pprint.pprint(control.diag())
|
|
163
171
|
|
|
164
172
|
|
|
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
|