python-openhab-rest-client 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.
- {python_openhab_rest_client-0.2.0/python_openhab_rest_client.egg-info → python_openhab_rest_client-0.2.2}/PKG-INFO +1 -1
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Actions.py +2 -2
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Addons.py +10 -13
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Audio.py +4 -4
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Auth.py +4 -6
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/ChannelTypes.py +3 -4
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Client.py +9 -6
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/ConfigDescriptions.py +2 -2
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Discovery.py +4 -4
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Iconsets.py +5 -2
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Inbox.py +1 -1
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Logging.py +1 -2
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Sitemaps.py +2 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/ItemEvents.py +1 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Links.py +2 -2
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2/python_openhab_rest_client.egg-info}/PKG-INFO +1 -1
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/setup.py +1 -1
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Discovery.py +1 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Links.py +1 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/LICENSE +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/README.md +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Events.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Items.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Links.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/ModuleTypes.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Persistence.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/ProfileTypes.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Rules.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Services.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Systeminfo.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Tags.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Templates.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/ThingTypes.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Things.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Transformations.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/UI.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/UUID.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Voice.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/__init__.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Actions.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Addons.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Audio.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Auth.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/ChannelEvents.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/ChannelTypes.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/ConfigDescriptions.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Discovery.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Events.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Iconsets.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Inbox.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/InboxEvents.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Items.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/LinkEvents.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Logging.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/ModuleTypes.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Persistence.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/ProfileTypes.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Rules.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Services.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Sitemaps.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Systeminfo.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Tags.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Templates.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/ThingEvents.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/ThingTypes.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Things.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Transformations.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/UI.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/UUID.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Voice.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/__init__.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/python_openhab_rest_client.egg-info/SOURCES.txt +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/python_openhab_rest_client.egg-info/dependency_links.txt +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/python_openhab_rest_client.egg-info/requires.txt +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/python_openhab_rest_client.egg-info/top_level.txt +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/setup.cfg +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Actions.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Addons.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Audio.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Auth.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/ChannelEvents.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/ChannelTypes.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/ConfigDescriptions.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Events.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Iconsets.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Inbox.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/InboxEvents.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/ItemEvents.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Items.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/LinkEvents.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Logging.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/ModuleTypes.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Persistence.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/ProfileTypes.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Rules.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Services.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Sitemaps.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Systeminfo.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Tags.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Templates.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/ThingEvents.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/ThingTypes.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Things.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Transformations.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/UI.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/UUID.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Voice.py +0 -0
- {python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: python-openhab-rest-client
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: A Python client for the openHAB REST API. This library enables easy interaction with the openHAB REST API to control smart home devices, retrieve status information, and process events.
|
|
5
5
|
Home-page: https://github.com/Michdo93/python-openhab-rest-client
|
|
6
6
|
Author: Michael Christian Dörflinger
|
|
@@ -21,7 +21,7 @@ class Actions:
|
|
|
21
21
|
|
|
22
22
|
:return: A list of actions.
|
|
23
23
|
"""
|
|
24
|
-
header = {"
|
|
24
|
+
header = {"Accept": "application/json"}
|
|
25
25
|
if language:
|
|
26
26
|
header["Accept-Language"] = language
|
|
27
27
|
|
|
@@ -65,7 +65,7 @@ class Actions:
|
|
|
65
65
|
|
|
66
66
|
:return: A response from the server.
|
|
67
67
|
"""
|
|
68
|
-
header = {"Content-Type": "application/json"}
|
|
68
|
+
header = {"Content-Type": "application/json", "Accept": "application/json"}
|
|
69
69
|
if language:
|
|
70
70
|
header["Accept-Language"] = language
|
|
71
71
|
|
|
@@ -23,7 +23,7 @@ class Addons:
|
|
|
23
23
|
:return: A dictionary containing the add-ons data.
|
|
24
24
|
"""
|
|
25
25
|
params = {"serviceId": serviceID} if serviceID else {}
|
|
26
|
-
header = {"
|
|
26
|
+
header = {"Accept": "application/json"}
|
|
27
27
|
if language:
|
|
28
28
|
header["Accept-Language"] = language
|
|
29
29
|
|
|
@@ -63,7 +63,7 @@ class Addons:
|
|
|
63
63
|
:return: A dictionary containing details of the specified add-on.
|
|
64
64
|
"""
|
|
65
65
|
params = {"serviceId": serviceID} if serviceID else {}
|
|
66
|
-
header = {"
|
|
66
|
+
header = {"Accept": "application/json"}
|
|
67
67
|
if language:
|
|
68
68
|
header["Accept-Language"] = language
|
|
69
69
|
|
|
@@ -106,7 +106,7 @@ class Addons:
|
|
|
106
106
|
|
|
107
107
|
try:
|
|
108
108
|
response = self.client.get(
|
|
109
|
-
f"/addons/{addonID}/config", header={"
|
|
109
|
+
f"/addons/{addonID}/config", header={"Accept": "application/json"}, params=params)
|
|
110
110
|
|
|
111
111
|
if isinstance(response, dict) and "status" in response:
|
|
112
112
|
status_code = response["status"]
|
|
@@ -151,7 +151,7 @@ class Addons:
|
|
|
151
151
|
|
|
152
152
|
try:
|
|
153
153
|
response = self.client.put(
|
|
154
|
-
f"/addons/{addonID}/config", header={"Content-Type": "application/json"}, data=json.dumps(data))
|
|
154
|
+
f"/addons/{addonID}/config", header={"Content-Type": "application/json", "Accept": "application/json"}, data=json.dumps(data))
|
|
155
155
|
|
|
156
156
|
if isinstance(response, dict) and "status" in response:
|
|
157
157
|
status_code = response["status"]
|
|
@@ -189,11 +189,10 @@ class Addons:
|
|
|
189
189
|
:return: A dictionary containing the installation status.
|
|
190
190
|
"""
|
|
191
191
|
data = {"serviceId": serviceID} if serviceID else {}
|
|
192
|
-
header = {"Content-Type": "application/json"}
|
|
193
192
|
|
|
194
193
|
try:
|
|
195
194
|
response = self.client.post(
|
|
196
|
-
f"/addons/{addonID}/install",
|
|
195
|
+
f"/addons/{addonID}/install", data=data)
|
|
197
196
|
|
|
198
197
|
if isinstance(response, dict) and "status" in response:
|
|
199
198
|
status_code = response["status"]
|
|
@@ -227,11 +226,10 @@ class Addons:
|
|
|
227
226
|
:return: A dictionary containing the uninstallation status.
|
|
228
227
|
"""
|
|
229
228
|
data = {"serviceId": serviceID} if serviceID else {}
|
|
230
|
-
header = {"Content-Type": "application/json"}
|
|
231
229
|
|
|
232
230
|
try:
|
|
233
231
|
response = self.client.post(
|
|
234
|
-
f"/addons/{addonID}/uninstall",
|
|
232
|
+
f"/addons/{addonID}/uninstall", data=data)
|
|
235
233
|
|
|
236
234
|
if isinstance(response, dict) and "status" in response:
|
|
237
235
|
status_code = response["status"]
|
|
@@ -263,7 +261,7 @@ class Addons:
|
|
|
263
261
|
|
|
264
262
|
:return: A dictionary containing the available add-on services.
|
|
265
263
|
"""
|
|
266
|
-
header = {"
|
|
264
|
+
header = {"Accept": "application/json"}
|
|
267
265
|
if language:
|
|
268
266
|
header["Accept-Language"] = language
|
|
269
267
|
|
|
@@ -297,7 +295,7 @@ class Addons:
|
|
|
297
295
|
|
|
298
296
|
:return: A dictionary containing suggested add-ons.
|
|
299
297
|
"""
|
|
300
|
-
header = {"
|
|
298
|
+
header = {"Accept": "application/json"}
|
|
301
299
|
if language:
|
|
302
300
|
header["Accept-Language"] = language
|
|
303
301
|
|
|
@@ -332,7 +330,7 @@ class Addons:
|
|
|
332
330
|
:return: A dictionary containing available add-on types.
|
|
333
331
|
"""
|
|
334
332
|
params = {"serviceId": serviceID} if serviceID else {}
|
|
335
|
-
header = {"
|
|
333
|
+
header = {"Accept": "application/json"}
|
|
336
334
|
if language:
|
|
337
335
|
header["Accept-Language"] = language
|
|
338
336
|
|
|
@@ -374,8 +372,7 @@ class Addons:
|
|
|
374
372
|
endpoint = f"/addons/url/{encoded_url}/install"
|
|
375
373
|
|
|
376
374
|
try:
|
|
377
|
-
response = self.client.post(
|
|
378
|
-
endpoint, header={"Content-Type": "text/plain"}, data=None)
|
|
375
|
+
response = self.client.post(endpoint, data=None)
|
|
379
376
|
|
|
380
377
|
if isinstance(response, dict) and "status" in response:
|
|
381
378
|
status_code = response["status"]
|
|
@@ -19,7 +19,7 @@ class Audio:
|
|
|
19
19
|
|
|
20
20
|
:return: A dictionary containing information about the default sink.
|
|
21
21
|
"""
|
|
22
|
-
header = {"
|
|
22
|
+
header = {"Accept": "application/json"}
|
|
23
23
|
if language:
|
|
24
24
|
header["Accept-Language"] = language
|
|
25
25
|
|
|
@@ -56,7 +56,7 @@ class Audio:
|
|
|
56
56
|
|
|
57
57
|
:return: A dictionary containing information about the default source.
|
|
58
58
|
"""
|
|
59
|
-
header = {"
|
|
59
|
+
header = {"Accept": "application/json"}
|
|
60
60
|
if language:
|
|
61
61
|
header["Accept-Language"] = language
|
|
62
62
|
|
|
@@ -93,7 +93,7 @@ class Audio:
|
|
|
93
93
|
|
|
94
94
|
:return: A list of available sinks.
|
|
95
95
|
"""
|
|
96
|
-
header = {"
|
|
96
|
+
header = {"Accept": "application/json"}
|
|
97
97
|
if language:
|
|
98
98
|
header["Accept-Language"] = language
|
|
99
99
|
|
|
@@ -126,7 +126,7 @@ class Audio:
|
|
|
126
126
|
|
|
127
127
|
:return: A list of available sources.
|
|
128
128
|
"""
|
|
129
|
-
header = {"
|
|
129
|
+
header = {"Accept": "application/json"}
|
|
130
130
|
if language:
|
|
131
131
|
header["Accept-Language"] = language
|
|
132
132
|
|
|
@@ -21,7 +21,7 @@ class Auth:
|
|
|
21
21
|
|
|
22
22
|
:return: JSON response from the server.
|
|
23
23
|
"""
|
|
24
|
-
header = {"
|
|
24
|
+
header = {"Accept": "application/json"}
|
|
25
25
|
|
|
26
26
|
try:
|
|
27
27
|
response = self.client.get("/auth/apitokens", header=header)
|
|
@@ -61,11 +61,9 @@ class Auth:
|
|
|
61
61
|
|
|
62
62
|
:return: JSON response from the server.
|
|
63
63
|
"""
|
|
64
|
-
header = {"Content-Type": "application/json"}
|
|
65
|
-
|
|
66
64
|
try:
|
|
67
65
|
response = self.client.delete(
|
|
68
|
-
f"/auth/apitokens/{tokenName}"
|
|
66
|
+
f"/auth/apitokens/{tokenName}")
|
|
69
67
|
|
|
70
68
|
if isinstance(response, dict) and "status" in response:
|
|
71
69
|
status_code = response["status"]
|
|
@@ -145,7 +143,7 @@ class Auth:
|
|
|
145
143
|
|
|
146
144
|
:return: JSON response from the server.
|
|
147
145
|
"""
|
|
148
|
-
header = {"
|
|
146
|
+
header = {"Accept": "application/json"}
|
|
149
147
|
|
|
150
148
|
try:
|
|
151
149
|
response = self.client.get("/auth/sessions", header=header)
|
|
@@ -197,7 +195,7 @@ class Auth:
|
|
|
197
195
|
}
|
|
198
196
|
|
|
199
197
|
params = {
|
|
200
|
-
"useCookie": useCookie
|
|
198
|
+
"useCookie": str(useCookie).lower()
|
|
201
199
|
}
|
|
202
200
|
|
|
203
201
|
# Body mit den erforderlichen Parametern
|
{python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/ChannelTypes.py
RENAMED
|
@@ -20,7 +20,7 @@ class ChannelTypes:
|
|
|
20
20
|
|
|
21
21
|
:return: A list of channel types.
|
|
22
22
|
"""
|
|
23
|
-
header = {}
|
|
23
|
+
header = {"Accept": "application/json"}
|
|
24
24
|
if language:
|
|
25
25
|
header["Accept-Language"] = language
|
|
26
26
|
|
|
@@ -59,7 +59,7 @@ class ChannelTypes:
|
|
|
59
59
|
|
|
60
60
|
:return: Details of the specific channel type.
|
|
61
61
|
"""
|
|
62
|
-
header = {}
|
|
62
|
+
header = {"Accept": "application/json"}
|
|
63
63
|
if language:
|
|
64
64
|
header["Accept-Language"] = language
|
|
65
65
|
|
|
@@ -97,10 +97,9 @@ class ChannelTypes:
|
|
|
97
97
|
|
|
98
98
|
:return: A list of item types.
|
|
99
99
|
"""
|
|
100
|
-
|
|
101
100
|
try:
|
|
102
101
|
response = self.client.get(
|
|
103
|
-
f"/channel-types/{channelTypeUID}/linkableItemTypes")
|
|
102
|
+
f"/channel-types/{channelTypeUID}/linkableItemTypes", header={"Accept": "application/json"})
|
|
104
103
|
|
|
105
104
|
if isinstance(response, dict) and "status" in response:
|
|
106
105
|
status_code = response["status"]
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import requests
|
|
2
|
-
import json
|
|
3
|
-
|
|
4
2
|
|
|
5
3
|
class OpenHABClient:
|
|
6
4
|
def __init__(self, url: str, username: str = None, password: str = None, token: str = None):
|
|
@@ -158,10 +156,11 @@ class OpenHABClient:
|
|
|
158
156
|
|
|
159
157
|
:return: The response object with the SSE stream.
|
|
160
158
|
"""
|
|
159
|
+
self.session.headers.update({})
|
|
161
160
|
if self.username is not None and self.password is not None:
|
|
162
|
-
return
|
|
161
|
+
return requests.get(url, auth=self.auth, headers={}, stream=True)
|
|
163
162
|
else:
|
|
164
|
-
return
|
|
163
|
+
return requests.get(url, headers={}, stream=True)
|
|
165
164
|
|
|
166
165
|
def __executeSSE(self, url: str, header: dict = {}):
|
|
167
166
|
"""
|
|
@@ -172,10 +171,14 @@ class OpenHABClient:
|
|
|
172
171
|
|
|
173
172
|
:return: The response object with the SSE stream.
|
|
174
173
|
"""
|
|
174
|
+
if header is None:
|
|
175
|
+
header = {}
|
|
176
|
+
|
|
177
|
+
self.session.headers.update(header)
|
|
175
178
|
if self.username is not None and self.password is not None:
|
|
176
|
-
return
|
|
179
|
+
return requests.get(url, auth=self.auth, headers=header, stream=True)
|
|
177
180
|
else:
|
|
178
|
-
return
|
|
181
|
+
return requests.get(url, headers=header, stream=True)
|
|
179
182
|
|
|
180
183
|
def get(self, endpoint: str, header: dict = None, params: dict = None):
|
|
181
184
|
"""
|
{python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/ConfigDescriptions.py
RENAMED
|
@@ -20,7 +20,7 @@ class ConfigDescriptions:
|
|
|
20
20
|
|
|
21
21
|
:return: A list of configuration descriptions.
|
|
22
22
|
"""
|
|
23
|
-
header = {}
|
|
23
|
+
header = {"Accept": "application/json"}
|
|
24
24
|
if language:
|
|
25
25
|
header["Accept-Language"] = language
|
|
26
26
|
|
|
@@ -59,7 +59,7 @@ class ConfigDescriptions:
|
|
|
59
59
|
|
|
60
60
|
:return: Details of the specific configuration description.
|
|
61
61
|
"""
|
|
62
|
-
header = {}
|
|
62
|
+
header = {"Accept": "application/json"}
|
|
63
63
|
if language:
|
|
64
64
|
header["Accept-Language"] = language
|
|
65
65
|
|
|
@@ -18,7 +18,7 @@ class Discovery:
|
|
|
18
18
|
:return: Eine Liste der Bindings als Strings.
|
|
19
19
|
"""
|
|
20
20
|
try:
|
|
21
|
-
response = self.client.get("/discovery")
|
|
21
|
+
response = self.client.get("/discovery", header={"Accept": "application/json"})
|
|
22
22
|
|
|
23
23
|
if isinstance(response, dict) and "status" in response:
|
|
24
24
|
status_code = response["status"]
|
|
@@ -47,13 +47,13 @@ class Discovery:
|
|
|
47
47
|
|
|
48
48
|
:return: Information about the discovery service for the specified binding.
|
|
49
49
|
"""
|
|
50
|
-
|
|
50
|
+
header = {"Accept": "application/json"}
|
|
51
51
|
if language:
|
|
52
|
-
|
|
52
|
+
header["Accept-Language"] = language
|
|
53
53
|
|
|
54
54
|
try:
|
|
55
55
|
response = self.client.get(
|
|
56
|
-
f"/discovery/bindings/{bindingID}/info",
|
|
56
|
+
f"/discovery/bindings/{bindingID}/info", header=header)
|
|
57
57
|
|
|
58
58
|
if isinstance(response, dict) and "status" in response:
|
|
59
59
|
status_code = response["status"]
|
|
@@ -19,9 +19,12 @@ class Iconsets:
|
|
|
19
19
|
|
|
20
20
|
:return: A list of icon sets with details such as ID, label, description and supported formats.
|
|
21
21
|
"""
|
|
22
|
+
header = {"Accept": "application/json"}
|
|
23
|
+
if language:
|
|
24
|
+
header["Accept-Language"] = language
|
|
25
|
+
|
|
22
26
|
try:
|
|
23
|
-
response = self.client.get(
|
|
24
|
-
"/iconsets", header={"Accept-Language": language} if language else {})
|
|
27
|
+
response = self.client.get("/iconsets", header=header)
|
|
25
28
|
|
|
26
29
|
if isinstance(response, dict) and "status" in response:
|
|
27
30
|
status_code = response["status"]
|
|
@@ -21,7 +21,7 @@ class Inbox:
|
|
|
21
21
|
"""
|
|
22
22
|
try:
|
|
23
23
|
response = self.client.get(
|
|
24
|
-
"/inbox", params={"includeIgnored": str(includeIgnored).lower()})
|
|
24
|
+
"/inbox", header={"Accept": "application/json"}, params={"includeIgnored": str(includeIgnored).lower()})
|
|
25
25
|
|
|
26
26
|
if isinstance(response, dict) and "status" in response:
|
|
27
27
|
status_code = response["status"]
|
|
@@ -18,9 +18,8 @@ class Logging:
|
|
|
18
18
|
|
|
19
19
|
:return: A list of loggers with names and levels.
|
|
20
20
|
"""
|
|
21
|
-
header = {"Accept": "application/json"}
|
|
22
21
|
try:
|
|
23
|
-
response = self.client.get("/logging", header=
|
|
22
|
+
response = self.client.get("/logging", header={"Accept": "application/json"})
|
|
24
23
|
|
|
25
24
|
if isinstance(response, dict) and "status" in response:
|
|
26
25
|
status_code = response["status"]
|
|
@@ -85,6 +85,7 @@ class Sitemaps:
|
|
|
85
85
|
:param pageID: The ID of the page.
|
|
86
86
|
:param subscriptionID: Optional query parameter for the subscription ID.
|
|
87
87
|
:param includeHidden: Whether hidden widgets should be included.
|
|
88
|
+
:param language: Optional language setting (as header).
|
|
88
89
|
|
|
89
90
|
:return: The sitemap page (JSON).
|
|
90
91
|
"""
|
|
@@ -130,6 +131,7 @@ class Sitemaps:
|
|
|
130
131
|
:param sitemapName: The name of the sitemap.
|
|
131
132
|
:param subscriptionID: Optional query parameter for the subscription ID.
|
|
132
133
|
:param includeHidden: Whether hidden widgets should be included.
|
|
134
|
+
:param language: Optional language setting (as header).
|
|
133
135
|
|
|
134
136
|
:return: The complete sitemap (JSON).
|
|
135
137
|
"""
|
{python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Links.py
RENAMED
|
@@ -55,10 +55,10 @@ class LinksTest:
|
|
|
55
55
|
|
|
56
56
|
def testDeleteAllLinks(self, object: str):
|
|
57
57
|
""" Test deleting all links """
|
|
58
|
-
print("\n~~~~ Test #5:
|
|
58
|
+
print("\n~~~~ Test #5: deleteAllLinks(object) ~~~~\n")
|
|
59
59
|
|
|
60
60
|
try:
|
|
61
|
-
orphanLinks = self.linksAPI.
|
|
61
|
+
orphanLinks = self.linksAPI.deleteAllLinks(object)
|
|
62
62
|
print(json.dumps(orphanLinks, indent=2))
|
|
63
63
|
except Exception as e:
|
|
64
64
|
print(f"Error retrieving orphan links: {e}")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: python-openhab-rest-client
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: A Python client for the openHAB REST API. This library enables easy interaction with the openHAB REST API to control smart home devices, retrieve status information, and process events.
|
|
5
5
|
Home-page: https://github.com/Michdo93/python-openhab-rest-client
|
|
6
6
|
Author: Michael Christian Dörflinger
|
|
@@ -21,5 +21,6 @@ if __name__ == "__main__":
|
|
|
21
21
|
linksTest.testGetLink(itemName, channelUID) # Test#2
|
|
22
22
|
linksTest.testUnlinkItemFromChannel(itemName, channelUID) # Test#3
|
|
23
23
|
linksTest.testLinkItemToChannel(itemName, channelUID) # Test#4
|
|
24
|
+
linksTest.testDeleteAllLinks(itemName)
|
|
24
25
|
linksTest.testGetOrphanLinks() # Test#5
|
|
25
26
|
linksTest.testPurgeUnusedLinks() # Test#6
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/ModuleTypes.py
RENAMED
|
File without changes
|
{python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Persistence.py
RENAMED
|
File without changes
|
{python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/ProfileTypes.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/Transformations.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Actions.py
RENAMED
|
File without changes
|
{python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Addons.py
RENAMED
|
File without changes
|
{python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Audio.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/ChannelEvents.py
RENAMED
|
File without changes
|
{python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/ChannelTypes.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Discovery.py
RENAMED
|
File without changes
|
{python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Events.py
RENAMED
|
File without changes
|
{python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Iconsets.py
RENAMED
|
File without changes
|
{python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Inbox.py
RENAMED
|
File without changes
|
{python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/InboxEvents.py
RENAMED
|
File without changes
|
{python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Items.py
RENAMED
|
File without changes
|
{python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/LinkEvents.py
RENAMED
|
File without changes
|
{python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Logging.py
RENAMED
|
File without changes
|
{python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/ModuleTypes.py
RENAMED
|
File without changes
|
{python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Persistence.py
RENAMED
|
File without changes
|
{python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/ProfileTypes.py
RENAMED
|
File without changes
|
{python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Rules.py
RENAMED
|
File without changes
|
{python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Services.py
RENAMED
|
File without changes
|
{python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Sitemaps.py
RENAMED
|
File without changes
|
{python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Systeminfo.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Templates.py
RENAMED
|
File without changes
|
{python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/ThingEvents.py
RENAMED
|
File without changes
|
{python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/ThingTypes.py
RENAMED
|
File without changes
|
{python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Things.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/Voice.py
RENAMED
|
File without changes
|
{python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/openhab/tests/__init__.py
RENAMED
|
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
|
{python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/ChannelEvents.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/ConfigDescriptions.py
RENAMED
|
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
|
{python_openhab_rest_client-0.2.0 → python_openhab_rest_client-0.2.2}/tests/Transformations.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|