python-openhab-rest-client 0.1.1__tar.gz → 0.2.0__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.1.1/python_openhab_rest_client.egg-info → python_openhab_rest_client-0.2.0}/PKG-INFO +114 -88
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/README.md +113 -87
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/Actions.py +1 -1
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/Addons.py +5 -10
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/Auth.py +27 -24
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/ChannelTypes.py +2 -2
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/Client.py +1 -1
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/ConfigDescriptions.py +2 -2
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/Discovery.py +45 -3
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/Events.py +1 -1
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/Iconsets.py +1 -1
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/Inbox.py +1 -1
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/Items.py +14 -14
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/Links.py +2 -2
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/Logging.py +6 -4
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/ModuleTypes.py +2 -2
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/Persistence.py +27 -14
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/ProfileTypes.py +1 -1
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/Rules.py +21 -22
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/Services.py +22 -8
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/Sitemaps.py +13 -13
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/Systeminfo.py +4 -12
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/Tags.py +14 -17
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/Templates.py +4 -4
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/ThingTypes.py +5 -8
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/Things.py +14 -21
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/Transformations.py +3 -3
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/UI.py +5 -5
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/UUID.py +1 -1
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/Voice.py +20 -21
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/tests/Actions.py +3 -3
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/tests/Addons.py +14 -14
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/tests/Auth.py +18 -21
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/tests/ChannelTypes.py +7 -7
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/tests/ConfigDescriptions.py +6 -6
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/tests/Discovery.py +15 -6
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/tests/Events.py +3 -3
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/tests/Iconsets.py +3 -3
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/tests/Inbox.py +3 -3
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/tests/Items.py +34 -25
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/tests/Links.py +21 -11
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/tests/Logging.py +6 -6
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/tests/ModuleTypes.py +2 -2
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/tests/Persistence.py +18 -18
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/tests/ProfileTypes.py +3 -3
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/tests/Rules.py +11 -11
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/tests/Services.py +9 -9
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/tests/Sitemaps.py +23 -13
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/tests/Systeminfo.py +1 -1
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/tests/Tags.py +10 -10
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/tests/Templates.py +6 -6
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/tests/ThingEvents.py +2 -2
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/tests/ThingTypes.py +6 -6
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/tests/Things.py +18 -18
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/tests/Transformations.py +4 -4
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/tests/UI.py +5 -5
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/tests/UUID.py +1 -1
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/tests/Voice.py +16 -10
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0/python_openhab_rest_client.egg-info}/PKG-INFO +114 -88
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/setup.py +1 -1
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/tests/Actions.py +1 -1
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/tests/Auth.py +2 -1
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/tests/ChannelTypes.py +3 -3
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/tests/ConfigDescriptions.py +2 -2
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/tests/Discovery.py +1 -1
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/tests/Events.py +2 -2
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/tests/Iconsets.py +1 -1
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/tests/Inbox.py +1 -1
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/tests/Items.py +1 -1
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/tests/Links.py +2 -2
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/tests/Logging.py +2 -2
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/tests/ModuleTypes.py +2 -2
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/tests/Persistence.py +2 -2
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/tests/Rules.py +3 -3
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/tests/Services.py +1 -1
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/tests/Sitemaps.py +1 -1
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/tests/Templates.py +2 -2
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/tests/ThingTypes.py +1 -1
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/tests/Things.py +3 -3
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/tests/UUID.py +1 -1
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/tests/Voice.py +20 -13
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/LICENSE +0 -0
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/Audio.py +0 -0
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/__init__.py +0 -0
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/tests/Audio.py +0 -0
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/tests/ChannelEvents.py +0 -0
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/tests/InboxEvents.py +0 -0
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/tests/ItemEvents.py +0 -0
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/tests/LinkEvents.py +0 -0
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/openhab/tests/__init__.py +0 -0
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/python_openhab_rest_client.egg-info/SOURCES.txt +0 -0
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/python_openhab_rest_client.egg-info/dependency_links.txt +0 -0
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/python_openhab_rest_client.egg-info/requires.txt +0 -0
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/python_openhab_rest_client.egg-info/top_level.txt +0 -0
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/setup.cfg +0 -0
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/tests/Addons.py +0 -0
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/tests/Audio.py +0 -0
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/tests/ChannelEvents.py +0 -0
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/tests/InboxEvents.py +0 -0
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/tests/ItemEvents.py +0 -0
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/tests/LinkEvents.py +0 -0
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/tests/ProfileTypes.py +0 -0
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/tests/Systeminfo.py +0 -0
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/tests/Tags.py +0 -0
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/tests/ThingEvents.py +0 -0
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/tests/Transformations.py +0 -0
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/tests/UI.py +0 -0
- {python_openhab_rest_client-0.1.1 → python_openhab_rest_client-0.2.0}/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.
|
|
3
|
+
Version: 0.2.0
|
|
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
|
|
@@ -68,7 +68,7 @@ pip install python-openhab-rest-client
|
|
|
68
68
|
|
|
69
69
|
## Usage
|
|
70
70
|
|
|
71
|
-
Basically, you always need the `OpenHABClient`. Regardless of whether you carry out a normal `REST request` or one via `SSE`.
|
|
71
|
+
Basically, you always need the `OpenHABClient`. Regardless of whether you carry out a normal `REST request` or one via `SSE`.
|
|
72
72
|
|
|
73
73
|
### Authentication
|
|
74
74
|
|
|
@@ -142,6 +142,40 @@ with response as events:
|
|
|
142
142
|
print("Event could not be converted to JSON")
|
|
143
143
|
```
|
|
144
144
|
|
|
145
|
+
### Tests
|
|
146
|
+
|
|
147
|
+
There is also a test function for each function. This means that every class that you import also has a test class that you can import. These tests work with a try-catch, as well as with a print output. Neither the value of the REST API nor something like True or False is returned. Effectively, however, the actual function is called from this test function and also executed in full, unless an exception is thrown.
|
|
148
|
+
|
|
149
|
+
In other words... For example, if you use the following import,
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
from openhab import Items
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
then the test class to be imported would be the following:
|
|
156
|
+
|
|
157
|
+
```python
|
|
158
|
+
from openhab.tests import ItemsTest
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
From e.g. the following function
|
|
162
|
+
|
|
163
|
+
```python
|
|
164
|
+
|
|
165
|
+
itemsAPI = Items(client)
|
|
166
|
+
itemsAPI.sendCommand("testSwitch", "ON")
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
then becomes the following function for the test:
|
|
170
|
+
|
|
171
|
+
```python
|
|
172
|
+
|
|
173
|
+
itemsTest = ItemsTest(client)
|
|
174
|
+
itemsTest.testSendCommand("testSwitch", "ON")
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
However, both would also really execute a sendCommand in openHAB. The test classes test whether a function can be executed. In the end, it can only not be executed if the endpoint does not exist or has been implemented incorrectly. However, a non-existent endpoint can also occur, for example, if the name of the item is incorrect.
|
|
178
|
+
|
|
145
179
|
## Full list of Methods
|
|
146
180
|
|
|
147
181
|
### OpenHABClient
|
|
@@ -153,6 +187,8 @@ with response as events:
|
|
|
153
187
|
##### Constructor
|
|
154
188
|
|
|
155
189
|
```python
|
|
190
|
+
from openhab import OpenHABClient
|
|
191
|
+
|
|
156
192
|
OpenHABClient(url: str, username: str = None, password: str = None, token: str = None)
|
|
157
193
|
```
|
|
158
194
|
###### Parameters:
|
|
@@ -262,8 +298,7 @@ The `Actions` class provides methods to interact with the OpenHAB actions API. I
|
|
|
262
298
|
#### Initialization
|
|
263
299
|
|
|
264
300
|
```python
|
|
265
|
-
from
|
|
266
|
-
from actions import Actions
|
|
301
|
+
from openhab import OpenHABClient, Actions
|
|
267
302
|
|
|
268
303
|
client = OpenHABClient("http://openhab-server:8080", username="user", password="pass")
|
|
269
304
|
actions = Actions(client)
|
|
@@ -431,8 +466,7 @@ The `Audio` class provides methods for interacting with the OpenHAB audio API. I
|
|
|
431
466
|
#### Initialization
|
|
432
467
|
|
|
433
468
|
```python
|
|
434
|
-
from
|
|
435
|
-
from audio import Audio
|
|
469
|
+
from openhab import OpenHABClient, Audio
|
|
436
470
|
|
|
437
471
|
client = OpenHABClient("http://openhab-server:8080", username="user", password="pass")
|
|
438
472
|
audio = Audio(client)
|
|
@@ -515,8 +549,7 @@ The `Auth` class provides methods for handling authentication in OpenHAB, includ
|
|
|
515
549
|
#### Initialization
|
|
516
550
|
|
|
517
551
|
```python
|
|
518
|
-
from
|
|
519
|
-
from auth import Auth
|
|
552
|
+
from openhab import OpenHABClient, Auth
|
|
520
553
|
|
|
521
554
|
client = OpenHABClient("http://openhab-server:8080", username="user", password="pass")
|
|
522
555
|
auth = Auth(client)
|
|
@@ -524,7 +557,7 @@ auth = Auth(client)
|
|
|
524
557
|
|
|
525
558
|
#### Methods
|
|
526
559
|
|
|
527
|
-
##### `
|
|
560
|
+
##### `getAPITokens(language: str = None) -> dict`
|
|
528
561
|
|
|
529
562
|
Retrieves the API tokens associated with the authenticated user.
|
|
530
563
|
|
|
@@ -537,11 +570,11 @@ Retrieves the API tokens associated with the authenticated user.
|
|
|
537
570
|
###### Example:
|
|
538
571
|
|
|
539
572
|
```python
|
|
540
|
-
tokens = auth.
|
|
573
|
+
tokens = auth.getAPITokens()
|
|
541
574
|
print(tokens)
|
|
542
575
|
```
|
|
543
576
|
|
|
544
|
-
##### `
|
|
577
|
+
##### `revokeAPIToken(tokenName: str, language: str = None) -> dict`
|
|
545
578
|
|
|
546
579
|
Revokes a specific API token associated with the authenticated user.
|
|
547
580
|
|
|
@@ -555,7 +588,7 @@ Revokes a specific API token associated with the authenticated user.
|
|
|
555
588
|
###### Example:
|
|
556
589
|
|
|
557
590
|
```python
|
|
558
|
-
response = auth.
|
|
591
|
+
response = auth.revokeAPIToken("my_token")
|
|
559
592
|
print(response)
|
|
560
593
|
```
|
|
561
594
|
|
|
@@ -594,14 +627,14 @@ sessions = auth.getSessions()
|
|
|
594
627
|
print(sessions)
|
|
595
628
|
```
|
|
596
629
|
|
|
597
|
-
##### `getToken(grantType: str, code: str = None,
|
|
630
|
+
##### `getToken(grantType: str, code: str = None, redirectURI: str = None, clientID: str = None, refreshToken: str = None, codeVerifier: str = None, language: str = None) -> dict`
|
|
598
631
|
|
|
599
632
|
Obtains access and refresh tokens.
|
|
600
633
|
|
|
601
634
|
**Parameters:**
|
|
602
635
|
- `grantType` (str): The type of grant being requested.
|
|
603
636
|
- `code` (str, optional): Authorization code for authentication.
|
|
604
|
-
- `
|
|
637
|
+
- `redirectURI` (str, optional): Redirect URI for OAuth authentication.
|
|
605
638
|
- `clientID` (str, optional): Client ID for authentication.
|
|
606
639
|
- `refreshToken` (str, optional): Refresh token for token renewal.
|
|
607
640
|
- `codeVerifier` (str, optional): Code verifier for PKCE authentication.
|
|
@@ -616,7 +649,7 @@ Obtains access and refresh tokens.
|
|
|
616
649
|
token_response = auth.getToken(
|
|
617
650
|
grantType="authorization_code",
|
|
618
651
|
code="auth_code",
|
|
619
|
-
|
|
652
|
+
redirectURI="http://localhost/callback",
|
|
620
653
|
clientID="client123",
|
|
621
654
|
codeVerifier="verifier123"
|
|
622
655
|
)
|
|
@@ -630,11 +663,10 @@ The `ChannelTypes` class provides methods to interact with OpenHAB's channel typ
|
|
|
630
663
|
#### Initialization
|
|
631
664
|
|
|
632
665
|
```python
|
|
633
|
-
from
|
|
634
|
-
from channel_types import ChannelTypes
|
|
666
|
+
from openhab import OpenHABClient, ChannelTypes
|
|
635
667
|
|
|
636
668
|
client = OpenHABClient("http://openhab-server:8080", username="user", password="pass")
|
|
637
|
-
|
|
669
|
+
channelTypes = ChannelTypes(client)
|
|
638
670
|
```
|
|
639
671
|
|
|
640
672
|
#### Methods
|
|
@@ -657,12 +689,12 @@ channels = channel_types.getAllChannelTypes(language="en", prefixes="zwave")
|
|
|
657
689
|
print(channels)
|
|
658
690
|
```
|
|
659
691
|
|
|
660
|
-
##### `
|
|
692
|
+
##### `getChannelTypeByUID(channelTypeUID: str, language: str = None) -> dict`
|
|
661
693
|
|
|
662
694
|
Retrieves details of a specific channel type by its UID.
|
|
663
695
|
|
|
664
696
|
**Parameters:**
|
|
665
|
-
- `
|
|
697
|
+
- `channelTypeUID` (str): The unique identifier of the channel type.
|
|
666
698
|
- `language` (str, optional): The preferred language for the response.
|
|
667
699
|
|
|
668
700
|
**Returns:**
|
|
@@ -671,16 +703,16 @@ Retrieves details of a specific channel type by its UID.
|
|
|
671
703
|
###### Example:
|
|
672
704
|
|
|
673
705
|
```python
|
|
674
|
-
|
|
675
|
-
print(
|
|
706
|
+
channelDetails = channelTypes.getChannelTypeByUID("zwave:switch_binary", language="en")
|
|
707
|
+
print(channelDetails)
|
|
676
708
|
```
|
|
677
709
|
|
|
678
|
-
##### `getLinkableItemTypes(
|
|
710
|
+
##### `getLinkableItemTypes(channelTypeUID: str) -> list`
|
|
679
711
|
|
|
680
712
|
Retrieves the item types that can be linked to a specified trigger channel type.
|
|
681
713
|
|
|
682
714
|
**Parameters:**
|
|
683
|
-
- `
|
|
715
|
+
- `channelTypeUID` (str): The unique identifier of the channel type.
|
|
684
716
|
|
|
685
717
|
**Returns:**
|
|
686
718
|
- `list`: A list of item types that can be linked to the given channel type.
|
|
@@ -688,8 +720,8 @@ Retrieves the item types that can be linked to a specified trigger channel type.
|
|
|
688
720
|
###### Example:
|
|
689
721
|
|
|
690
722
|
```python
|
|
691
|
-
|
|
692
|
-
print(
|
|
723
|
+
linkableItems = channelTypes.getLinkableItemTypes("zwave:switch_binary")
|
|
724
|
+
print(linkableItems)
|
|
693
725
|
```
|
|
694
726
|
|
|
695
727
|
### ConfigDescriptions
|
|
@@ -699,11 +731,10 @@ The `ConfigDescriptions` class provides methods to interact with OpenHAB's confi
|
|
|
699
731
|
#### Initialization
|
|
700
732
|
|
|
701
733
|
```python
|
|
702
|
-
from
|
|
703
|
-
from config_descriptions import ConfigDescriptions
|
|
734
|
+
from openhab import OpenHABClient, ConfigDescriptions
|
|
704
735
|
|
|
705
736
|
client = OpenHABClient("http://openhab-server:8080", username="user", password="pass")
|
|
706
|
-
|
|
737
|
+
configDescriptions = ConfigDescriptions(client)
|
|
707
738
|
```
|
|
708
739
|
|
|
709
740
|
#### Methods
|
|
@@ -722,7 +753,7 @@ Retrieves all available configuration descriptions.
|
|
|
722
753
|
###### Example:
|
|
723
754
|
|
|
724
755
|
```python
|
|
725
|
-
configs =
|
|
756
|
+
configs = configDescriptions.getAllConfigDescriptions(language="en", scheme="thing")
|
|
726
757
|
print(configs)
|
|
727
758
|
```
|
|
728
759
|
|
|
@@ -740,7 +771,7 @@ Retrieves a specific configuration description by its URI.
|
|
|
740
771
|
###### Example:
|
|
741
772
|
|
|
742
773
|
```python
|
|
743
|
-
|
|
774
|
+
configDetails = configDescriptions.getConfigDescriptionByURI("thing-type:zwave:device", language="en")
|
|
744
775
|
print(config_details)
|
|
745
776
|
```
|
|
746
777
|
|
|
@@ -751,8 +782,7 @@ The `Discovery` class provides methods to interact with OpenHAB's discovery serv
|
|
|
751
782
|
#### Initialization
|
|
752
783
|
|
|
753
784
|
```python
|
|
754
|
-
from
|
|
755
|
-
from discovery import Discovery
|
|
785
|
+
from openhab import OpenHABClient, Discovery
|
|
756
786
|
|
|
757
787
|
client = OpenHABClient("http://openhab-server:8080", username="user", password="pass")
|
|
758
788
|
discovery = Discovery(client)
|
|
@@ -797,8 +827,7 @@ The `Events` class provides methods to interact with OpenHAB's event service. It
|
|
|
797
827
|
#### Initialization
|
|
798
828
|
|
|
799
829
|
```python
|
|
800
|
-
from
|
|
801
|
-
from events import Events
|
|
830
|
+
from openhab import OpenHABClient, Events
|
|
802
831
|
|
|
803
832
|
client = OpenHABClient("http://openhab-server:8080", username="user", password="pass")
|
|
804
833
|
events = Events(client)
|
|
@@ -833,16 +862,16 @@ Initiates a new item state tracker connection.
|
|
|
833
862
|
###### Example:
|
|
834
863
|
|
|
835
864
|
```python
|
|
836
|
-
|
|
837
|
-
print(
|
|
865
|
+
connectionID = events.initiateStateTracker()
|
|
866
|
+
print(connectionID)
|
|
838
867
|
```
|
|
839
868
|
|
|
840
|
-
##### `
|
|
869
|
+
##### `updateSSEConnectionItems(connectionID: str, items: list) -> str`
|
|
841
870
|
|
|
842
871
|
Changes the list of items an SSE connection will receive state updates for.
|
|
843
872
|
|
|
844
873
|
**Parameters:**
|
|
845
|
-
- `
|
|
874
|
+
- `connectionID` (str): The ID of the existing connection.
|
|
846
875
|
- `items` (list): A list of item names to subscribe to for state updates.
|
|
847
876
|
|
|
848
877
|
**Returns:**
|
|
@@ -851,8 +880,8 @@ Changes the list of items an SSE connection will receive state updates for.
|
|
|
851
880
|
###### Example:
|
|
852
881
|
|
|
853
882
|
```python
|
|
854
|
-
|
|
855
|
-
print(
|
|
883
|
+
successMessage = events.updateSSEConnectionItems(connectionID, ["item1", "item2"])
|
|
884
|
+
print(successMessage)
|
|
856
885
|
```
|
|
857
886
|
|
|
858
887
|
#### `ItemEvents` Class
|
|
@@ -1081,8 +1110,7 @@ The `Iconsets` class provides methods to interact with OpenHAB's icon sets. It a
|
|
|
1081
1110
|
#### Initialization
|
|
1082
1111
|
|
|
1083
1112
|
```python
|
|
1084
|
-
from
|
|
1085
|
-
from iconsets import Iconsets
|
|
1113
|
+
from openhab import OpenHABClient, Iconsets
|
|
1086
1114
|
|
|
1087
1115
|
client = OpenHABClient("http://openhab-server:8080", username="user", password="pass")
|
|
1088
1116
|
iconsets = Iconsets(client)
|
|
@@ -1114,8 +1142,7 @@ The `Inbox` class provides methods to interact with the inbox of discovered thin
|
|
|
1114
1142
|
#### Initialization
|
|
1115
1143
|
|
|
1116
1144
|
```python
|
|
1117
|
-
from
|
|
1118
|
-
from inbox import Inbox
|
|
1145
|
+
from openhab import OpenHABClient, Inbox
|
|
1119
1146
|
|
|
1120
1147
|
client = OpenHABClient("http://openhab-server:8080", username="user", password="pass")
|
|
1121
1148
|
inbox = Inbox(client)
|
|
@@ -1136,8 +1163,8 @@ Gets all discovered things, optionally including ignored ones.
|
|
|
1136
1163
|
###### Example:
|
|
1137
1164
|
|
|
1138
1165
|
```python
|
|
1139
|
-
|
|
1140
|
-
print(
|
|
1166
|
+
discoveredThings = inbox.getAllDiscoveredThings()
|
|
1167
|
+
print(discoveredThings)
|
|
1141
1168
|
```
|
|
1142
1169
|
|
|
1143
1170
|
##### `removeDiscoveryResult(thingUID: str) -> dict`
|
|
@@ -1217,8 +1244,7 @@ The `Items` class provides methods for managing OpenHAB items via the REST API.
|
|
|
1217
1244
|
#### **Initilization**
|
|
1218
1245
|
|
|
1219
1246
|
```python
|
|
1220
|
-
from
|
|
1221
|
-
from items import Items
|
|
1247
|
+
from openhab import OpenHABClient, Items
|
|
1222
1248
|
|
|
1223
1249
|
client = OpenHABClient("http://openhab-server:8080", username="user", password="pass")
|
|
1224
1250
|
items = Items(client)
|
|
@@ -1242,8 +1268,8 @@ Retrieves all available items.
|
|
|
1242
1268
|
**Example:**
|
|
1243
1269
|
|
|
1244
1270
|
```python
|
|
1245
|
-
|
|
1246
|
-
print(
|
|
1271
|
+
allItems = items.getAllItems(language="de", type="Switch")
|
|
1272
|
+
print(allItems)
|
|
1247
1273
|
```
|
|
1248
1274
|
|
|
1249
1275
|
##### `addOrUpdateItems(items: list) -> dict`
|
|
@@ -1272,8 +1298,8 @@ Gets the details of a single item.
|
|
|
1272
1298
|
**Example:**
|
|
1273
1299
|
|
|
1274
1300
|
```python
|
|
1275
|
-
|
|
1276
|
-
print(
|
|
1301
|
+
itemData = items.getItem("LivingRoomLight")
|
|
1302
|
+
print(itemData)
|
|
1277
1303
|
```
|
|
1278
1304
|
|
|
1279
1305
|
##### `addOrUpdateItem(itemName: str, itemData: dict, ...) -> dict`
|
|
@@ -1288,8 +1314,8 @@ Adds or updates an item.
|
|
|
1288
1314
|
**Example:**
|
|
1289
1315
|
|
|
1290
1316
|
```python
|
|
1291
|
-
|
|
1292
|
-
response = items.addOrUpdateItem("NewLight",
|
|
1317
|
+
newItem = {"type": "Switch", "label": "New Light"}
|
|
1318
|
+
response = items.addOrUpdateItem("NewLight", newItem)
|
|
1293
1319
|
print(response)
|
|
1294
1320
|
```
|
|
1295
1321
|
|
|
@@ -1388,8 +1414,8 @@ Returns the item of a specific semantic class.
|
|
|
1388
1414
|
**Example:**
|
|
1389
1415
|
|
|
1390
1416
|
```python
|
|
1391
|
-
|
|
1392
|
-
print(
|
|
1417
|
+
semanticItem = items.getSemanticItem("Thermostat", "Point")
|
|
1418
|
+
print(semanticItem)
|
|
1393
1419
|
```
|
|
1394
1420
|
|
|
1395
1421
|
##### `getItemState(itemName: str) -> dict`
|
|
@@ -1583,44 +1609,44 @@ Retrieves a list of available persistence services.
|
|
|
1583
1609
|
|
|
1584
1610
|
**Returns:** A list of persistence services with their IDs, labels, and types.
|
|
1585
1611
|
|
|
1586
|
-
##### `getServiceConfiguration(
|
|
1612
|
+
##### `getServiceConfiguration(serviceID: str) -> dict`
|
|
1587
1613
|
|
|
1588
1614
|
Retrieves the configuration of a specific persistence service.
|
|
1589
1615
|
|
|
1590
|
-
- `
|
|
1616
|
+
- `serviceID` *(str)* – The ID of the persistence service.
|
|
1591
1617
|
|
|
1592
1618
|
**Returns:** A dictionary containing the service configuration.
|
|
1593
1619
|
|
|
1594
|
-
##### `setServiceConfiguration(
|
|
1620
|
+
##### `setServiceConfiguration(serviceID: str, config: dict) -> dict`
|
|
1595
1621
|
|
|
1596
1622
|
Sets the configuration of a persistence service.
|
|
1597
1623
|
|
|
1598
|
-
- `
|
|
1624
|
+
- `serviceID` *(str)* – The ID of the persistence service.
|
|
1599
1625
|
- `config` *(dict)* – The configuration data for the service.
|
|
1600
1626
|
|
|
1601
1627
|
**Returns:** The API response after modifying the configuration.
|
|
1602
1628
|
|
|
1603
|
-
##### `deleteServiceConfiguration(
|
|
1629
|
+
##### `deleteServiceConfiguration(serviceID: str) -> dict`
|
|
1604
1630
|
|
|
1605
1631
|
Deletes the configuration of a persistence service.
|
|
1606
1632
|
|
|
1607
|
-
- `
|
|
1633
|
+
- `serviceID` *(str)* – The ID of the persistence service.
|
|
1608
1634
|
|
|
1609
1635
|
**Returns:** The API response after deleting the configuration.
|
|
1610
1636
|
|
|
1611
|
-
##### `getItemsForService(
|
|
1637
|
+
##### `getItemsForService(serviceID: str) -> dict`
|
|
1612
1638
|
|
|
1613
1639
|
Retrieves a list of items available in a specific persistence service.
|
|
1614
1640
|
|
|
1615
|
-
- `
|
|
1641
|
+
- `serviceID` *(str)* – The ID of the persistence service.
|
|
1616
1642
|
|
|
1617
1643
|
**Returns:** A list of items with their last and earliest timestamps.
|
|
1618
1644
|
|
|
1619
|
-
##### `getItemPersistenceData(
|
|
1645
|
+
##### `getItemPersistenceData(serviceID: str, itemName: str, startTime: str = None, endTime: str = None, page: int = 1, pageLength: int = 50) -> dict`
|
|
1620
1646
|
|
|
1621
1647
|
Retrieves persistence data for a specific item from a persistence service.
|
|
1622
1648
|
|
|
1623
|
-
- `
|
|
1649
|
+
- `serviceID` *(str)* – The ID of the persistence service.
|
|
1624
1650
|
- `itemName` *(str)* – The name of the item.
|
|
1625
1651
|
- `startTime` *(Optional, str)* – The start time for the data. Defaults to one day before `endTime`.
|
|
1626
1652
|
- `endTime` *(Optional, str)* – The end time for the data. Defaults to the current time.
|
|
@@ -1629,22 +1655,22 @@ Retrieves persistence data for a specific item from a persistence service.
|
|
|
1629
1655
|
|
|
1630
1656
|
**Returns:** The retrieved data points of the item.
|
|
1631
1657
|
|
|
1632
|
-
##### `storeItemData(
|
|
1658
|
+
##### `storeItemData(serviceID: str, itemName: str, time: str, state: str) -> dict`
|
|
1633
1659
|
|
|
1634
1660
|
Stores persistence data for a specific item.
|
|
1635
1661
|
|
|
1636
|
-
- `
|
|
1662
|
+
- `serviceID` *(str)* – The ID of the persistence service.
|
|
1637
1663
|
- `itemName` *(str)* – The name of the item.
|
|
1638
1664
|
- `time` *(str)* – The timestamp for the stored data.
|
|
1639
1665
|
- `state` *(str)* – The state value to be stored.
|
|
1640
1666
|
|
|
1641
1667
|
**Returns:** The API response after storing the data.
|
|
1642
1668
|
|
|
1643
|
-
##### `deleteItemData(
|
|
1669
|
+
##### `deleteItemData(serviceID: str, itemName: str, startTime: str, endTime: str) -> dict`
|
|
1644
1670
|
|
|
1645
1671
|
Deletes persistence data for a specific item within a given time range.
|
|
1646
1672
|
|
|
1647
|
-
- `
|
|
1673
|
+
- `serviceID` *(str)* – The ID of the persistence service.
|
|
1648
1674
|
- `itemName` *(str)* – The name of the item.
|
|
1649
1675
|
- `startTime` *(str)* – The start time of the data to be deleted.
|
|
1650
1676
|
- `endTime` *(str)* – The end time of the data to be deleted.
|
|
@@ -1832,12 +1858,12 @@ Retrieves a specific sitemap by name.
|
|
|
1832
1858
|
|
|
1833
1859
|
**Returns:** The sitemap object (JSON).
|
|
1834
1860
|
|
|
1835
|
-
##### `getSitemapPage(sitemapName: str,
|
|
1861
|
+
##### `getSitemapPage(sitemapName: str, pageID: str, subscriptionID: str = None, includeHidden: bool = False) -> dict`
|
|
1836
1862
|
|
|
1837
1863
|
Retrieves the data for a specific page within a sitemap.
|
|
1838
1864
|
|
|
1839
1865
|
- `sitemapName` *(str)* – The name of the sitemap.
|
|
1840
|
-
- `
|
|
1866
|
+
- `pageID` *(str)* – The ID of the page.
|
|
1841
1867
|
- `subscriptionID` *(Optional, str)* – Query parameter for the subscription ID.
|
|
1842
1868
|
- `includeHidden` *(Optional, bool, default=False)* – Whether hidden widgets should be included.
|
|
1843
1869
|
|
|
@@ -1854,13 +1880,13 @@ Retrieves data for an entire sitemap.
|
|
|
1854
1880
|
|
|
1855
1881
|
**Returns:** The complete sitemap (JSON).
|
|
1856
1882
|
|
|
1857
|
-
##### `getSitemapEvents(subscriptionID: str, sitemap: str = None,
|
|
1883
|
+
##### `getSitemapEvents(subscriptionID: str, sitemap: str = None, pageID: str = None) -> dict`
|
|
1858
1884
|
|
|
1859
1885
|
Retrieves events for a specific sitemap or page.
|
|
1860
1886
|
|
|
1861
1887
|
- `subscriptionID` *(str)* – The ID of the subscription.
|
|
1862
1888
|
- `sitemap` *(Optional, str)* – The name of the sitemap.
|
|
1863
|
-
- `
|
|
1889
|
+
- `pageID` *(Optional, str)* – The ID of the page.
|
|
1864
1890
|
|
|
1865
1891
|
**Returns:** The events (JSON).
|
|
1866
1892
|
|
|
@@ -1894,13 +1920,13 @@ Retrieves general system information.
|
|
|
1894
1920
|
|
|
1895
1921
|
**Returns:** A dictionary containing system information (JSON).
|
|
1896
1922
|
|
|
1897
|
-
##### `
|
|
1923
|
+
##### `getUoMInfo(language: str = None) -> dict`
|
|
1898
1924
|
|
|
1899
|
-
Retrieves all supported units of measurement (
|
|
1925
|
+
Retrieves all supported units of measurement (UoM) and their system units.
|
|
1900
1926
|
|
|
1901
1927
|
- `language` *(Optional, str)* – Language setting for the `Accept-Language` header.
|
|
1902
1928
|
|
|
1903
|
-
**Returns:** A dictionary containing
|
|
1929
|
+
**Returns:** A dictionary containing UoM information (JSON).
|
|
1904
1930
|
|
|
1905
1931
|
### Tags
|
|
1906
1932
|
|
|
@@ -1981,11 +2007,11 @@ The `ThingTypes` class provides methods to retrieve available thing types via th
|
|
|
1981
2007
|
|
|
1982
2008
|
#### Methods
|
|
1983
2009
|
|
|
1984
|
-
##### `getAllThingTypes(
|
|
2010
|
+
##### `getAllThingTypes(bindingID: str = None, language: str = None) -> list`
|
|
1985
2011
|
|
|
1986
2012
|
Retrieves all available thing types without configuration descriptions, channels, and properties.
|
|
1987
2013
|
|
|
1988
|
-
- `
|
|
2014
|
+
- `bindingID` *(Optional, str)* – Filter the results by a specific binding ID.
|
|
1989
2015
|
- `language` *(Optional, str)* – Language setting for the `Accept-Language` header.
|
|
1990
2016
|
|
|
1991
2017
|
**Returns:** A list of thing types (JSON).
|
|
@@ -2262,7 +2288,7 @@ Gets the default voice used by the system.
|
|
|
2262
2288
|
|
|
2263
2289
|
**Returns:** A dictionary with details of the default voice.
|
|
2264
2290
|
|
|
2265
|
-
##### `startDialog()`
|
|
2291
|
+
##### `startDialog(sourceID: str, ksID: str = None, sttID: str = None, ttsID: str = None, voiceID: str = None, hliIDs: str = None, sinkID: str = None, keyword: str = None, listeningItem: str = None)`
|
|
2266
2292
|
|
|
2267
2293
|
Starts dialog processing for a given audio source.
|
|
2268
2294
|
|
|
@@ -2279,7 +2305,7 @@ Starts dialog processing for a given audio source.
|
|
|
2279
2305
|
|
|
2280
2306
|
**Returns:** The response from the server.
|
|
2281
2307
|
|
|
2282
|
-
##### `stopDialog()`
|
|
2308
|
+
##### `stopDialog(sourceID: str)`
|
|
2283
2309
|
|
|
2284
2310
|
Stops dialog processing for a given audio source.
|
|
2285
2311
|
|
|
@@ -2288,7 +2314,7 @@ Stops dialog processing for a given audio source.
|
|
|
2288
2314
|
|
|
2289
2315
|
**Returns:** The response from the server.
|
|
2290
2316
|
|
|
2291
|
-
##### `getInterpreters()`
|
|
2317
|
+
##### `getInterpreters(language: str = None)`
|
|
2292
2318
|
|
|
2293
2319
|
Gets the list of all interpreters.
|
|
2294
2320
|
|
|
@@ -2297,7 +2323,7 @@ Gets the list of all interpreters.
|
|
|
2297
2323
|
|
|
2298
2324
|
**Returns:** A list of interpreters if successful.
|
|
2299
2325
|
|
|
2300
|
-
##### `interpretText()`
|
|
2326
|
+
##### `interpretText(text: str, language: str, IDs: list = None)`
|
|
2301
2327
|
|
|
2302
2328
|
Sends a text to the default human language interpreter.
|
|
2303
2329
|
|
|
@@ -2308,7 +2334,7 @@ Sends a text to the default human language interpreter.
|
|
|
2308
2334
|
|
|
2309
2335
|
**Returns:** The response from the server.
|
|
2310
2336
|
|
|
2311
|
-
##### `getInterpreter()`
|
|
2337
|
+
##### `getInterpreter(interpreterID: str, language: str = None)`
|
|
2312
2338
|
|
|
2313
2339
|
Gets a single interpreter.
|
|
2314
2340
|
|
|
@@ -2318,7 +2344,7 @@ Gets a single interpreter.
|
|
|
2318
2344
|
|
|
2319
2345
|
**Returns:** The details of the interpreter.
|
|
2320
2346
|
|
|
2321
|
-
##### `interpretTextBatch()`
|
|
2347
|
+
##### `interpretTextBatch(text: str, language: str, IDs: list)`
|
|
2322
2348
|
|
|
2323
2349
|
Sends a text to a given human language interpreter(s).
|
|
2324
2350
|
|
|
@@ -2329,7 +2355,7 @@ Sends a text to a given human language interpreter(s).
|
|
|
2329
2355
|
|
|
2330
2356
|
**Returns:** The response from the server.
|
|
2331
2357
|
|
|
2332
|
-
##### `listenAndAnswer()`
|
|
2358
|
+
##### `listenAndAnswer(sourceID: str, sttID: str, ttsID: str, voiceID: str, hliIDs: list = None, sinkID: str = None, listeningItem: str = None)`
|
|
2333
2359
|
|
|
2334
2360
|
Executes a simple dialog sequence without keyword spotting for a given audio source.
|
|
2335
2361
|
|
|
@@ -2344,7 +2370,7 @@ Executes a simple dialog sequence without keyword spotting for a given audio sou
|
|
|
2344
2370
|
|
|
2345
2371
|
**Returns:** The response from the server.
|
|
2346
2372
|
|
|
2347
|
-
##### `sayText()`
|
|
2373
|
+
##### `sayText(text: str, voiceID: str, sinkID: str, volume: str = '100')`
|
|
2348
2374
|
|
|
2349
2375
|
Speaks a given text with a given voice through the given audio sink.
|
|
2350
2376
|
|