python-openhab-rest-client 0.1.2__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.
Files changed (108) hide show
  1. {python_openhab_rest_client-0.1.2/python_openhab_rest_client.egg-info → python_openhab_rest_client-0.2.0}/PKG-INFO +1 -1
  2. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/Actions.py +1 -1
  3. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/Addons.py +5 -10
  4. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/Auth.py +27 -24
  5. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/ChannelTypes.py +2 -2
  6. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/Client.py +1 -1
  7. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/ConfigDescriptions.py +2 -2
  8. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/Discovery.py +45 -3
  9. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/Events.py +1 -1
  10. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/Iconsets.py +1 -1
  11. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/Inbox.py +1 -1
  12. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/Items.py +14 -14
  13. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/Links.py +2 -2
  14. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/Logging.py +6 -4
  15. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/ModuleTypes.py +2 -2
  16. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/Persistence.py +20 -12
  17. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/ProfileTypes.py +1 -1
  18. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/Rules.py +10 -11
  19. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/Services.py +22 -8
  20. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/Sitemaps.py +13 -13
  21. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/Systeminfo.py +4 -12
  22. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/Tags.py +14 -17
  23. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/Templates.py +4 -4
  24. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/ThingTypes.py +5 -8
  25. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/Things.py +13 -18
  26. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/Transformations.py +3 -3
  27. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/UI.py +5 -5
  28. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/UUID.py +1 -1
  29. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/Voice.py +3 -13
  30. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/tests/Actions.py +3 -3
  31. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/tests/Addons.py +14 -14
  32. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/tests/Auth.py +18 -21
  33. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/tests/ChannelTypes.py +7 -7
  34. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/tests/ConfigDescriptions.py +6 -6
  35. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/tests/Discovery.py +15 -6
  36. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/tests/Events.py +3 -3
  37. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/tests/Iconsets.py +3 -3
  38. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/tests/Inbox.py +3 -3
  39. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/tests/Items.py +34 -25
  40. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/tests/Links.py +21 -11
  41. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/tests/Logging.py +6 -6
  42. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/tests/ModuleTypes.py +2 -2
  43. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/tests/Persistence.py +18 -18
  44. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/tests/ProfileTypes.py +3 -3
  45. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/tests/Rules.py +11 -11
  46. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/tests/Services.py +9 -9
  47. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/tests/Sitemaps.py +23 -13
  48. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/tests/Systeminfo.py +1 -1
  49. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/tests/Tags.py +10 -10
  50. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/tests/Templates.py +6 -6
  51. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/tests/ThingEvents.py +2 -2
  52. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/tests/ThingTypes.py +6 -6
  53. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/tests/Things.py +18 -18
  54. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/tests/Transformations.py +4 -4
  55. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/tests/UI.py +5 -5
  56. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/tests/UUID.py +1 -1
  57. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/tests/Voice.py +8 -7
  58. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0/python_openhab_rest_client.egg-info}/PKG-INFO +1 -1
  59. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/setup.py +1 -1
  60. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/tests/Actions.py +1 -1
  61. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/tests/Auth.py +2 -1
  62. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/tests/ChannelTypes.py +3 -3
  63. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/tests/ConfigDescriptions.py +2 -2
  64. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/tests/Discovery.py +1 -1
  65. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/tests/Events.py +2 -2
  66. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/tests/Iconsets.py +1 -1
  67. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/tests/Inbox.py +1 -1
  68. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/tests/Items.py +1 -1
  69. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/tests/Links.py +2 -2
  70. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/tests/Logging.py +2 -2
  71. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/tests/ModuleTypes.py +2 -2
  72. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/tests/Persistence.py +2 -2
  73. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/tests/Rules.py +3 -3
  74. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/tests/Services.py +1 -1
  75. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/tests/Sitemaps.py +1 -1
  76. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/tests/Templates.py +2 -2
  77. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/tests/ThingTypes.py +1 -1
  78. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/tests/Things.py +3 -3
  79. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/tests/UUID.py +1 -1
  80. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/tests/Voice.py +2 -2
  81. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/LICENSE +0 -0
  82. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/README.md +0 -0
  83. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/Audio.py +0 -0
  84. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/__init__.py +0 -0
  85. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/tests/Audio.py +0 -0
  86. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/tests/ChannelEvents.py +0 -0
  87. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/tests/InboxEvents.py +0 -0
  88. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/tests/ItemEvents.py +0 -0
  89. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/tests/LinkEvents.py +0 -0
  90. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/openhab/tests/__init__.py +0 -0
  91. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/python_openhab_rest_client.egg-info/SOURCES.txt +0 -0
  92. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/python_openhab_rest_client.egg-info/dependency_links.txt +0 -0
  93. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/python_openhab_rest_client.egg-info/requires.txt +0 -0
  94. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/python_openhab_rest_client.egg-info/top_level.txt +0 -0
  95. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/setup.cfg +0 -0
  96. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/tests/Addons.py +0 -0
  97. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/tests/Audio.py +0 -0
  98. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/tests/ChannelEvents.py +0 -0
  99. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/tests/InboxEvents.py +0 -0
  100. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/tests/ItemEvents.py +0 -0
  101. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/tests/LinkEvents.py +0 -0
  102. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/tests/ProfileTypes.py +0 -0
  103. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/tests/Systeminfo.py +0 -0
  104. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/tests/Tags.py +0 -0
  105. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/tests/ThingEvents.py +0 -0
  106. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/tests/Transformations.py +0 -0
  107. {python_openhab_rest_client-0.1.2 → python_openhab_rest_client-0.2.0}/tests/UI.py +0 -0
  108. {python_openhab_rest_client-0.1.2 → 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.1.2
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
@@ -12,7 +12,7 @@ class Actions:
12
12
  """
13
13
  self.client = client
14
14
 
15
- def getAllActions(self, thingUID: str, language: str = None) -> list:
15
+ def getActions(self, thingUID: str, language: str = None) -> list:
16
16
  """
17
17
  Get all available actions for provided thing UID.
18
18
 
@@ -179,20 +179,17 @@ class Addons:
179
179
 
180
180
  return {"error": f"Unexpected response: {status_code}"}
181
181
 
182
- def installAddon(self, addonID: str, serviceID: str = None, language: str = None) -> dict:
182
+ def installAddon(self, addonID: str, serviceID: str = None) -> dict:
183
183
  """
184
184
  Installs an add-on by its ID.
185
185
 
186
186
  :param addonID: The unique identifier of the add-on.
187
187
  :param serviceID: Optional service ID to specify the target service.
188
- :param language: Optional language preference for the response.
189
188
 
190
189
  :return: A dictionary containing the installation status.
191
190
  """
192
191
  data = {"serviceId": serviceID} if serviceID else {}
193
192
  header = {"Content-Type": "application/json"}
194
- if language:
195
- header["Accept-Language"] = language
196
193
 
197
194
  try:
198
195
  response = self.client.post(
@@ -220,20 +217,17 @@ class Addons:
220
217
 
221
218
  return {"error": f"Unexpected response: {status_code}"}
222
219
 
223
- def uninstallAddon(self, addonID: str, serviceID: str = None, language: str = None) -> dict:
220
+ def uninstallAddon(self, addonID: str, serviceID: str = None) -> dict:
224
221
  """
225
222
  Uninstalls an add-on by its ID.
226
223
 
227
224
  :param addonID: The unique identifier of the add-on.
228
225
  :param serviceID: Optional service ID to specify the target service.
229
- :param language: Optional language preference for the response.
230
226
 
231
227
  :return: A dictionary containing the uninstallation status.
232
228
  """
233
229
  data = {"serviceId": serviceID} if serviceID else {}
234
230
  header = {"Content-Type": "application/json"}
235
- if language:
236
- header["Accept-Language"] = language
237
231
 
238
232
  try:
239
233
  response = self.client.post(
@@ -329,7 +323,7 @@ class Addons:
329
323
 
330
324
  return {"error": f"Unexpected response: {status_code}"}
331
325
 
332
- def getAddonTypes(self, language: str = None) -> dict:
326
+ def getAddonTypes(self, serviceID: str = None, language: str = None) -> dict:
333
327
  """
334
328
  Retrieves a list of all available add-on types.
335
329
 
@@ -337,13 +331,14 @@ class Addons:
337
331
 
338
332
  :return: A dictionary containing available add-on types.
339
333
  """
334
+ params = {"serviceId": serviceID} if serviceID else {}
340
335
  header = {"Content-Type": "application/json"}
341
336
  if language:
342
337
  header["Accept-Language"] = language
343
338
 
344
339
  try:
345
340
  response = self.client.get(
346
- "/addons/types", header=header, params=None)
341
+ "/addons/types", header=header, params=params)
347
342
 
348
343
  if isinstance(response, dict) and "status" in response:
349
344
  status_code = response["status"]
@@ -13,7 +13,7 @@ class Auth:
13
13
  """
14
14
  self.client = client
15
15
 
16
- def getAPITokens(self, language: str = None) -> dict:
16
+ def getAPITokens(self) -> dict:
17
17
  """
18
18
  Retrieve the API tokens associated with the authenticated user.
19
19
 
@@ -22,8 +22,6 @@ class Auth:
22
22
  :return: JSON response from the server.
23
23
  """
24
24
  header = {"Content-Type": "application/json"}
25
- if language:
26
- header["Accept-Language"] = language
27
25
 
28
26
  try:
29
27
  response = self.client.get("/auth/apitokens", header=header)
@@ -54,7 +52,7 @@ class Auth:
54
52
 
55
53
  return {"error": f"Unexpected response: {status_code}"}
56
54
 
57
- def revokeAPIToken(self, tokenName: str, language: str = None) -> dict:
55
+ def revokeAPIToken(self, tokenName: str) -> dict:
58
56
  """
59
57
  Revoke a specific API token associated with the authenticated user.
60
58
 
@@ -64,8 +62,6 @@ class Auth:
64
62
  :return: JSON response from the server.
65
63
  """
66
64
  header = {"Content-Type": "application/json"}
67
- if language:
68
- header["Accept-Language"] = language
69
65
 
70
66
  try:
71
67
  response = self.client.delete(
@@ -97,22 +93,25 @@ class Auth:
97
93
 
98
94
  return {"error": f"Unexpected response: {status_code}"}
99
95
 
100
- def logout(self, refreshToken: str, language: str = None) -> dict:
96
+ def logout(self, refreshToken: str, sessionID: str) -> dict:
101
97
  """
102
98
  Terminate the session associated with a refresh token.
103
99
 
104
100
  :param refreshToken: The refresh token used to delete the session.
105
- :param language: (Optional) Language setting for the API request.
101
+ :param id: The user ID associated with the refresh token.
106
102
 
107
103
  :return: JSON response from the server.
108
104
  """
109
105
  header = {"Content-Type": "application/x-www-form-urlencoded"}
110
- if language:
111
- header["Accept-Language"] = language
106
+
107
+ data = {
108
+ "refresh_token": refreshToken,
109
+ "id": sessionID
110
+ }
112
111
 
113
112
  try:
114
113
  response = self.client.post(
115
- "/auth/logout", header=header, data=json.dumps({"refresh_token": refreshToken}))
114
+ "/auth/logout", header=header, data=data)
116
115
 
117
116
  if isinstance(response, dict) and "status" in response:
118
117
  status_code = response["status"]
@@ -140,17 +139,13 @@ class Auth:
140
139
 
141
140
  return {"error": f"Unexpected response: {status_code}"}
142
141
 
143
- def getSessions(self, language: str = None) -> dict:
142
+ def getSessions(self) -> dict:
144
143
  """
145
144
  Retrieve the sessions associated with the authenticated user.
146
145
 
147
- :param language: (Optional) Language setting for the API request.
148
-
149
146
  :return: JSON response from the server.
150
147
  """
151
148
  header = {"Content-Type": "application/json"}
152
- if language:
153
- header["Accept-Language"] = language
154
149
 
155
150
  try:
156
151
  response = self.client.get("/auth/sessions", header=header)
@@ -181,17 +176,18 @@ class Auth:
181
176
 
182
177
  return {"error": f"Unexpected response: {status_code}"}
183
178
 
184
- def getToken(self, grantType: str, code: str = None, redirectURI: str = None, clientID: str = None, refreshToken: str = None, codeVerifier: str = None, language: str = None) -> dict:
179
+ def getToken(self, useCookie: bool = False, grantType: str = None, code: str = None, redirectURI: str = None, clientID: str = None,
180
+ refreshToken: str = None, codeVerifier: str = None) -> dict:
185
181
  """
186
182
  Obtain access and refresh tokens.
187
183
 
188
- :param grantType: The type of grant being requested.
184
+ :param useCookie: (Optional) Whether to use cookies for the session.
185
+ :param grantType: (Optional) The type of grant being requested.
189
186
  :param code: (Optional) Authorization code for authentication.
190
187
  :param redirectUri: (Optional) Redirect URI for OAuth authentication.
191
188
  :param clientID: (Optional) Client ID for authentication.
192
189
  :param refreshToken: (Optional) Refresh token for token renewal.
193
190
  :param codeVerifier: (Optional) Code verifier for PKCE authentication.
194
- :param language: (Optional) Language setting for the API request.
195
191
 
196
192
  :return: JSON response from the server.
197
193
  """
@@ -200,6 +196,11 @@ class Auth:
200
196
  "Accept": "application/json"
201
197
  }
202
198
 
199
+ params = {
200
+ "useCookie": useCookie
201
+ }
202
+
203
+ # Body mit den erforderlichen Parametern
203
204
  body = {
204
205
  "grant_type": grantType,
205
206
  "code": code,
@@ -208,15 +209,17 @@ class Auth:
208
209
  "refresh_token": refreshToken,
209
210
  "code_verifier": codeVerifier
210
211
  }
211
- # Remove all None values
212
+
213
+ # Entferne alle None-Werte aus dem Body
212
214
  body = {k: v for k, v in body.items() if v is not None}
213
215
 
214
- # Encode as application/x-www-form-urlencoded
216
+ # Kodierung als application/x-www-form-urlencoded
215
217
  encodedBody = urlencode(body)
216
218
 
217
219
  try:
220
+ # Request mit den encoded Daten senden
218
221
  response = self.client.post(
219
- "/auth/token", header=header, data=encodedBody)
222
+ "/auth/token", header=header, data=encodedBody, params=params)
220
223
 
221
224
  if isinstance(response, dict) and "status" in response:
222
225
  status_code = response["status"]
@@ -234,8 +237,8 @@ class Auth:
234
237
  return {"error": f"Request error: {str(err)}"}
235
238
 
236
239
  if status_code == 200:
237
- return {"message": "OK"}
240
+ return response # Gebe die gesamte Antwort zurück
238
241
  elif status_code == 400:
239
242
  return {"error": "Invalid request parameters."}
240
243
 
241
- return {"error": f"Unexpected response: {status_code}"}
244
+ return {"error": f"Unexpected response: {status_code}"}
@@ -11,7 +11,7 @@ class ChannelTypes:
11
11
  """
12
12
  self.client = client
13
13
 
14
- def getAllChannelTypes(self, language: str = None, prefixes: str = None) -> list:
14
+ def getChannelTypes(self, prefixes: str = None, language: str = None) -> list:
15
15
  """
16
16
  Retrieves all available channel types.
17
17
 
@@ -50,7 +50,7 @@ class ChannelTypes:
50
50
 
51
51
  return {"error": f"Unexpected response: {status_code}"}
52
52
 
53
- def getChannelTypeByUID(self, channelTypeUID: str, language: str = None) -> dict:
53
+ def getChannelType(self, channelTypeUID: str, language: str = None) -> dict:
54
54
  """
55
55
  Retrieves the item types the given trigger channel type UID can be linked to.
56
56
 
@@ -213,7 +213,7 @@ class OpenHABClient:
213
213
 
214
214
  :return: The response from the PUT request.
215
215
  """
216
- return self.__executeRequest(header, endpoint, "put", data=data)
216
+ return self.__executeRequest(header, endpoint, "put", data=data, params=params)
217
217
 
218
218
  def delete(self, endpoint: str, header: dict = None, data=None, params: dict = None):
219
219
  """
@@ -11,7 +11,7 @@ class ConfigDescriptions:
11
11
  """
12
12
  self.client = client
13
13
 
14
- def getAllConfigDescriptions(self, language: str = None, scheme: str = None) -> list:
14
+ def getConfigDescriptions(self, scheme: str = None, language: str = None) -> list:
15
15
  """
16
16
  Retrieves all available config descriptions.
17
17
 
@@ -50,7 +50,7 @@ class ConfigDescriptions:
50
50
 
51
51
  return {"error": f"Unexpected response: {status_code}"}
52
52
 
53
- def getConfigDescriptionByURI(self, uri: str, language: str = None) -> dict:
53
+ def getConfigDescription(self, uri: str, language: str = None) -> dict:
54
54
  """
55
55
  Retrieves a config description by URI.
56
56
 
@@ -11,7 +11,7 @@ class Discovery:
11
11
  """
12
12
  self.client = client
13
13
 
14
- def getAllDiscoveryBindings(self) -> list:
14
+ def getDiscoveryBindings(self) -> list:
15
15
  """
16
16
  Gets all bindings that support discovery.
17
17
 
@@ -38,17 +38,59 @@ class Discovery:
38
38
 
39
39
  return {"error": f"Unexpected response: {status_code}"}
40
40
 
41
- def startBindingScan(self, bindingID: str) -> int:
41
+ def getBindingInfo(self, bindingID: str, language: str = None) -> dict:
42
+ """
43
+ Gets information about the discovery services for a binding.
44
+
45
+ :param bindingId: The ID of the binding to get discovery information for.
46
+ :param language: Optional language parameter for the response (Accept-Language header).
47
+
48
+ :return: Information about the discovery service for the specified binding.
49
+ """
50
+ headers = {}
51
+ if language:
52
+ headers["Accept-Language"] = language
53
+
54
+ try:
55
+ response = self.client.get(
56
+ f"/discovery/bindings/{bindingID}/info", headers=headers)
57
+
58
+ if isinstance(response, dict) and "status" in response:
59
+ status_code = response["status"]
60
+ else:
61
+ return response
62
+
63
+ except requests.exceptions.HTTPError as err:
64
+ status_code = err.response.status_code
65
+ if status_code == 404:
66
+ return {"error": "Discovery service not found."}
67
+ elif status_code != 200:
68
+ return {"error": f"HTTP error {status_code}: {str(err)}"}
69
+
70
+ except requests.exceptions.RequestException as err:
71
+ return {"error": f"Request error: {str(err)}"}
72
+
73
+ if status_code == 200:
74
+ return response
75
+
76
+ return {"error": f"Unexpected response: {status_code}"}
77
+
78
+ def startBindingScan(self, bindingID: str, input: str = None) -> int:
42
79
  """
43
80
  Starts asynchronous discovery process for a binding and returns the timeout in seconds of the discovery operation.
44
81
 
45
82
  :param bindingID: The ID of the binding for which the discovery is to be started.
83
+ :param input: An input parameter to start the discovery.
46
84
 
47
85
  :return: Timeout duration of the discovery operation in seconds.
48
86
  """
87
+ params = {
88
+ "input": input
89
+ }
90
+
49
91
  try:
50
92
  response = self.client.post(
51
- f"/discovery/bindings/{bindingID}/scan")
93
+ f"/discovery/bindings/{bindingID}/scan", header={"Accept": "text/plain"}, params=params)
52
94
 
53
95
  if isinstance(response, dict) and "status" in response:
54
96
  status_code = response["status"]
@@ -12,7 +12,7 @@ class Events:
12
12
  """
13
13
  self.client = client
14
14
 
15
- def getAllEvents(self, topics: str = None) -> list:
15
+ def getEvents(self, topics: str = None) -> list:
16
16
  """
17
17
  Get all available events, optionally filtered by topic.
18
18
 
@@ -11,7 +11,7 @@ class Iconsets:
11
11
  """
12
12
  self.client = client
13
13
 
14
- def getAllIconsets(self, language: str = None) -> list:
14
+ def getIconsets(self, language: str = None) -> list:
15
15
  """
16
16
  Gets all icon sets.
17
17
 
@@ -11,7 +11,7 @@ class Inbox:
11
11
  """
12
12
  self.client = client
13
13
 
14
- def getAllDiscoveredThings(self, includeIgnored: bool = True) -> list:
14
+ def getDiscoveredThings(self, includeIgnored: bool = True) -> list:
15
15
  """
16
16
  Get all discovered things.
17
17
 
@@ -12,30 +12,30 @@ class Items:
12
12
  """
13
13
  self.client = client
14
14
 
15
- def getAllItems(
15
+ def getItems(
16
16
  self,
17
- language: str = None,
18
17
  type: str = None,
19
18
  tags: str = None,
20
19
  metadata: str = ".*",
21
20
  recursive: bool = False,
22
21
  fields: str = None,
23
22
  staticDataOnly: bool = False,
23
+ language: str = None
24
24
  ):
25
25
  """
26
26
  Get all available items.
27
27
 
28
- :param language: Optional; Language filter for header "Accept-Language".
29
28
  :param type: Optional; Item type filter.
30
29
  :param tags: Optional; Item tag filter.
31
30
  :param metadata: Optional; Metadata selector (default: .*).
32
31
  :param recursive: Optional; Whether to fetch group members recursively (default: False).
33
32
  :param fields: Optional; Limit to specific fields (comma-separated).
34
33
  :param staticDataOnly: Optional; Only returns cached data (default: False).
34
+ :param language: Optional; Language filter for header "Accept-Language".
35
35
 
36
36
  :return: A dictionary or list containing the item data as returned by the API.
37
37
  """
38
- header = {}
38
+ header = {"Accept": "application/json"}
39
39
  if language:
40
40
  header["Accept-Language"] = language
41
41
 
@@ -83,7 +83,7 @@ class Items:
83
83
  """
84
84
  try:
85
85
  response = self.client.put(
86
- "/items", data=json.dumps(items), header={"Content-Type": "application/json"})
86
+ "/items", data=json.dumps(items), header={"Content-Type": "application/json", "Accept": "*/*"})
87
87
 
88
88
  if isinstance(response, dict) and "status" in response:
89
89
  status_code = response["status"]
@@ -107,18 +107,18 @@ class Items:
107
107
 
108
108
  return {"error": f"Unexpected response: {status_code}"}
109
109
 
110
- def getItem(self, itemName: str, language: str = None, metadata: str = ".*", recursive: bool = True):
110
+ def getItem(self, itemName: str, metadata: str = ".*", recursive: bool = True, language: str = None):
111
111
  """
112
112
  Gets a single item.
113
113
 
114
114
  :param itemName: The name of the item.
115
- :param language: Optional; Language filter for header "Accept-Language".
116
115
  :param metadata: Optional; Metadata selector (default: .*).
117
116
  :param recursive: Optional; Whether to fetch group members recursively (default: True).
117
+ :param language: Optional; Language filter for header "Accept-Language".
118
118
 
119
119
  :return: A dictionary containing the requested item data.
120
120
  """
121
- header = {}
121
+ header = {"Accept": "application/json"}
122
122
  if language:
123
123
  header["Accept-Language"] = language
124
124
 
@@ -163,7 +163,7 @@ class Items:
163
163
 
164
164
  :return: A response object or confirmation that the item was successfully added or updated.
165
165
  """
166
- header = {"Content-Type": "application/json"}
166
+ header = {"Content-Type": "application/json", "Accept": "*/"}
167
167
  if language:
168
168
  header["Accept-Language"] = language
169
169
 
@@ -212,7 +212,7 @@ class Items:
212
212
  """
213
213
  try:
214
214
  response = self.client.post(f"/items/{itemName}", header={
215
- "Content-Type": "text/plain; charset=utf-8", "Accept": "text/plain"}, data=command)
215
+ "Content-Type": "text/plain"}, data=command)
216
216
 
217
217
  if isinstance(response, dict) and "status" in response:
218
218
  status_code = response["status"]
@@ -496,7 +496,7 @@ class Items:
496
496
 
497
497
  :return: A dictionary containing the semantic item data.
498
498
  """
499
- header = {}
499
+ header = {"Accept": "application/json"}
500
500
  if language:
501
501
  header["Accept-Language"] = language
502
502
 
@@ -534,8 +534,9 @@ class Items:
534
534
 
535
535
  :return: A dictionary containing the current state of the item.
536
536
  """
537
+ header = {"Accept": "text/plain"}
537
538
  try:
538
- response = self.client.get(f"/items/{itemName}/state")
539
+ response = self.client.get(f"/items/{itemName}/state", header=header)
539
540
 
540
541
  if isinstance(response, dict) and "status" in response:
541
542
  status_code = response["status"]
@@ -569,8 +570,7 @@ class Items:
569
570
 
570
571
  :return: A response object or confirmation that the state was successfully updated.
571
572
  """
572
- header = {"Content-Type": "text/plain; charset=utf-8",
573
- "Accept": "text/plain"}
573
+ header = {"Content-Type": "text/plain"}
574
574
  if language:
575
575
  header["Accept-Language"] = language
576
576
 
@@ -13,7 +13,7 @@ class Links:
13
13
  """
14
14
  self.client = client
15
15
 
16
- def getAllLinks(self, channelUID: str = None, itemName: str = None) -> list:
16
+ def getLinks(self, channelUID: str = None, itemName: str = None) -> list:
17
17
  """
18
18
  Gets all available links.
19
19
 
@@ -50,7 +50,7 @@ class Links:
50
50
 
51
51
  return {"error": f"Unexpected response: {status_code}"}
52
52
 
53
- def getIndividualLink(self, itemName: str, channelUID: str) -> dict:
53
+ def getLink(self, itemName: str, channelUID: str) -> dict:
54
54
  """
55
55
  Retrieves an individual link.
56
56
 
@@ -12,14 +12,15 @@ class Logging:
12
12
  """
13
13
  self.client = client
14
14
 
15
- def getAllLoggers(self) -> dict:
15
+ def getLoggers(self) -> dict:
16
16
  """
17
17
  Get all loggers.
18
18
 
19
19
  :return: A list of loggers with names and levels.
20
20
  """
21
+ header = {"Accept": "application/json"}
21
22
  try:
22
- response = self.client.get("/logging")
23
+ response = self.client.get("/logging", header=header)
23
24
 
24
25
  if isinstance(response, dict) and "status" in response:
25
26
  status_code = response["status"]
@@ -39,7 +40,7 @@ class Logging:
39
40
 
40
41
  return {"error": f"Unexpected response: {status_code}"}
41
42
 
42
- def getSingleLogger(self, loggerName: str) -> dict:
43
+ def getLogger(self, loggerName: str) -> dict:
43
44
  """
44
45
  Get a single logger.
45
46
 
@@ -47,8 +48,9 @@ class Logging:
47
48
 
48
49
  :return: The logger with the specified name and level.
49
50
  """
51
+
50
52
  try:
51
- response = self.client.get(f"/logging/{loggerName}")
53
+ response = self.client.get(f"/logging/{loggerName}", header={"Accept": "application/json"})
52
54
 
53
55
  if isinstance(response, dict) and "status" in response:
54
56
  status_code = response["status"]
@@ -21,7 +21,7 @@ class ModuleTypes:
21
21
 
22
22
  :return: A list of module types.
23
23
  """
24
- header = {"Content-Type": "application/json"}
24
+ header = {"Accept": "application/json"}
25
25
  if language:
26
26
  header["Accept-Language"] = language
27
27
 
@@ -62,7 +62,7 @@ class ModuleTypes:
62
62
 
63
63
  :return: A dictionary with the module type information.
64
64
  """
65
- header = {"Content-Type": "application/json"}
65
+ header = {"Accept": "application/json"}
66
66
  if language:
67
67
  header["Accept-Language"] = language
68
68