ihcsdk 2.8.9__tar.gz → 2.8.10__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.
- {ihcsdk-2.8.9 → ihcsdk-2.8.10}/PKG-INFO +8 -2
- {ihcsdk-2.8.9 → ihcsdk-2.8.10}/ihcsdk/ihcclient.py +1 -1
- {ihcsdk-2.8.9 → ihcsdk-2.8.10}/ihcsdk/ihcconnection.py +21 -2
- {ihcsdk-2.8.9 → ihcsdk-2.8.10}/ihcsdk/ihccontroller.py +4 -0
- {ihcsdk-2.8.9 → ihcsdk-2.8.10}/ihcsdk.egg-info/PKG-INFO +8 -2
- {ihcsdk-2.8.9 → ihcsdk-2.8.10}/setup.py +1 -1
- {ihcsdk-2.8.9 → ihcsdk-2.8.10}/MANIFEST.in +0 -0
- {ihcsdk-2.8.9 → ihcsdk-2.8.10}/ihcsdk/__init__.py +0 -0
- {ihcsdk-2.8.9 → ihcsdk-2.8.10}/ihcsdk/certs/ihc.crt +0 -0
- {ihcsdk-2.8.9 → ihcsdk-2.8.10}/ihcsdk/certs/ihc3.crt +0 -0
- {ihcsdk-2.8.9 → ihcsdk-2.8.10}/ihcsdk/ihcsslconnection.py +0 -0
- {ihcsdk-2.8.9 → ihcsdk-2.8.10}/ihcsdk.egg-info/SOURCES.txt +0 -0
- {ihcsdk-2.8.9 → ihcsdk-2.8.10}/ihcsdk.egg-info/dependency_links.txt +0 -0
- {ihcsdk-2.8.9 → ihcsdk-2.8.10}/ihcsdk.egg-info/requires.txt +0 -0
- {ihcsdk-2.8.9 → ihcsdk-2.8.10}/ihcsdk.egg-info/top_level.txt +0 -0
- {ihcsdk-2.8.9 → ihcsdk-2.8.10}/license.txt +0 -0
- {ihcsdk-2.8.9 → ihcsdk-2.8.10}/pyproject.toml +0 -0
- {ihcsdk-2.8.9 → ihcsdk-2.8.10}/readme.md +0 -0
- {ihcsdk-2.8.9 → ihcsdk-2.8.10}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: ihcsdk
|
|
3
|
-
Version: 2.8.
|
|
3
|
+
Version: 2.8.10
|
|
4
4
|
Summary: IHC Python SDK
|
|
5
5
|
Home-page: https://github.com/dingusdk/PythonIhcSdk
|
|
6
6
|
Author: Jens Nielsen
|
|
@@ -8,5 +8,11 @@ License: GPL-3.0
|
|
|
8
8
|
License-File: license.txt
|
|
9
9
|
Requires-Dist: requests
|
|
10
10
|
Requires-Dist: cryptography
|
|
11
|
+
Dynamic: author
|
|
12
|
+
Dynamic: description
|
|
13
|
+
Dynamic: home-page
|
|
14
|
+
Dynamic: license
|
|
15
|
+
Dynamic: requires-dist
|
|
16
|
+
Dynamic: summary
|
|
11
17
|
|
|
12
18
|
SDK for connection to the LK IHC Controller. Made for interfacing to home assistant
|
|
@@ -356,7 +356,7 @@ class IHCSoapClient:
|
|
|
356
356
|
case "WSBooleanValue":
|
|
357
357
|
result = resource_value.find("./ns2:value", IHCSoapClient.ihcns).text == "true"
|
|
358
358
|
case "WSIntegerValue":
|
|
359
|
-
result = int(
|
|
359
|
+
result = int(resource_value.find("./ns2:integer", IHCSoapClient.ihcns).text)
|
|
360
360
|
case "WSFloatingPointValue":
|
|
361
361
|
result = round(float(resource_value.find("./ns2:floatingPointValue", IHCSoapClient.ihcns).text), 2)
|
|
362
362
|
case "WSEnumValue":
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
# pylint: disable=too-few-public-methods
|
|
4
4
|
import logging
|
|
5
5
|
import requests
|
|
6
|
+
import time
|
|
6
7
|
import xml.etree.ElementTree
|
|
7
8
|
|
|
8
9
|
from urllib.parse import urlparse
|
|
@@ -10,8 +11,7 @@ from urllib3.util import Retry
|
|
|
10
11
|
from requests.adapters import HTTPAdapter
|
|
11
12
|
|
|
12
13
|
_LOGGER = logging.getLogger(__name__)
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
class IHCConnection(object):
|
|
16
16
|
"""Implements a http connection to the controller"""
|
|
17
17
|
|
|
@@ -35,6 +35,10 @@ class IHCConnection(object):
|
|
|
35
35
|
allowed_methods={"POST"},
|
|
36
36
|
)
|
|
37
37
|
self.session.mount("http://", HTTPAdapter(max_retries=self.retries))
|
|
38
|
+
# default minimum time between calls in seconds (0 will not rate limit)
|
|
39
|
+
self.min_interval: float = 0.0
|
|
40
|
+
self.last_call_time:float = 0
|
|
41
|
+
self.logtiming = False
|
|
38
42
|
|
|
39
43
|
def cert_verify(self):
|
|
40
44
|
return None
|
|
@@ -50,6 +54,7 @@ class IHCConnection(object):
|
|
|
50
54
|
"SOAPAction": action,
|
|
51
55
|
}
|
|
52
56
|
try:
|
|
57
|
+
self.rateLimit()
|
|
53
58
|
_LOGGER.debug("soap payload %s", payload)
|
|
54
59
|
self.last_exception = None
|
|
55
60
|
response = self.session.post(
|
|
@@ -75,3 +80,17 @@ class IHCConnection(object):
|
|
|
75
80
|
self.last_exception = exp
|
|
76
81
|
self.last_response = response
|
|
77
82
|
return False
|
|
83
|
+
|
|
84
|
+
def rateLimit( self):
|
|
85
|
+
""" Rate limit the calls to this function."""
|
|
86
|
+
current_time: float = time.time()
|
|
87
|
+
time_since_last_call: float = current_time - self.last_call_time
|
|
88
|
+
if self.logtiming:
|
|
89
|
+
_LOGGER.warning("time since last call %f sec", time_since_last_call)
|
|
90
|
+
# If not enough time has passed, sleep for the remaining time
|
|
91
|
+
if time_since_last_call < self.min_interval:
|
|
92
|
+
sleep_time:float = self.min_interval - time_since_last_call
|
|
93
|
+
_LOGGER.debug("Ratelimiting for %f sec", sleep_time)
|
|
94
|
+
time.sleep(sleep_time)
|
|
95
|
+
# Update the last call time and call the function
|
|
96
|
+
self.last_call_time = time.time()
|
|
@@ -70,6 +70,10 @@ class IHCController:
|
|
|
70
70
|
TODO call disconnect on ihcclient
|
|
71
71
|
"""
|
|
72
72
|
self._notifyrunning = False
|
|
73
|
+
# wait for notify thread to finish
|
|
74
|
+
while self._notifythread.is_alive():
|
|
75
|
+
time.sleep(0.1) # Optional sleep to prevent busy waiting
|
|
76
|
+
self.client.connection.session.close()
|
|
73
77
|
|
|
74
78
|
def get_runtime_value(self, ihcid: int):
|
|
75
79
|
"""Get runtime value with re-authenticate if needed"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: ihcsdk
|
|
3
|
-
Version: 2.8.
|
|
3
|
+
Version: 2.8.10
|
|
4
4
|
Summary: IHC Python SDK
|
|
5
5
|
Home-page: https://github.com/dingusdk/PythonIhcSdk
|
|
6
6
|
Author: Jens Nielsen
|
|
@@ -8,5 +8,11 @@ License: GPL-3.0
|
|
|
8
8
|
License-File: license.txt
|
|
9
9
|
Requires-Dist: requests
|
|
10
10
|
Requires-Dist: cryptography
|
|
11
|
+
Dynamic: author
|
|
12
|
+
Dynamic: description
|
|
13
|
+
Dynamic: home-page
|
|
14
|
+
Dynamic: license
|
|
15
|
+
Dynamic: requires-dist
|
|
16
|
+
Dynamic: summary
|
|
11
17
|
|
|
12
18
|
SDK for connection to the LK IHC Controller. Made for interfacing to home assistant
|
|
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
|