pyialarm
Advanced tools
+1
-1
| Metadata-Version: 2.1 | ||
| Name: pyialarm | ||
| Version: 2.0.0 | ||
| Version: 2.1.0 | ||
| Summary: A simple library to interface with iAlarm systems, built for use with Home-Assistant | ||
@@ -5,0 +5,0 @@ Home-page: https://github.com/RyuzakiKK/pyialarm |
| Metadata-Version: 2.1 | ||
| Name: pyialarm | ||
| Version: 2.0.0 | ||
| Version: 2.1.0 | ||
| Summary: A simple library to interface with iAlarm systems, built for use with Home-Assistant | ||
@@ -5,0 +5,0 @@ Home-page: https://github.com/RyuzakiKK/pyialarm |
@@ -1,2 +0,2 @@ | ||
| dicttoxml | ||
| dicttoxml2 | ||
| xmltodict |
+28
-15
@@ -7,10 +7,5 @@ import logging | ||
| import dicttoxml | ||
| import dicttoxml2 | ||
| import xmltodict | ||
| # TODO Workaround for https://github.com/quandyfactory/dicttoxml/issues/91 | ||
| # Remove when dicttoxml 1.7.5 is released | ||
| import collections | ||
| collections.Iterable = collections.abc.Iterable | ||
| log = logging.getLogger(__name__) | ||
@@ -71,5 +66,3 @@ # dicttoxml is very verbose at INFO level | ||
| command['Offset'] = 'S32,0,0|%d' % offset | ||
| root_dict = self._create_root_dict(xpath, command) | ||
| self._send_dict(root_dict) | ||
| response = self._receive() | ||
| response = self._send_request_raw(xpath, command) | ||
@@ -90,7 +83,19 @@ if partial_list is None: | ||
| def _send_request_raw(self, xpath, command) -> dict: | ||
| root_dict = self._create_root_dict(xpath, command) | ||
| try: | ||
| self._send_dict(root_dict) | ||
| response = self._receive() | ||
| except ConnectionError as err: | ||
| log.debug("Failed to send request, retrying with a new connection: %s", err) | ||
| self._close_connection() | ||
| # The alarm can start to drop responses if we send multiple requests back-to-back | ||
| time.sleep(1) | ||
| self._send_dict(root_dict) | ||
| response = self._receive() | ||
| return response | ||
| def _send_request(self, xpath, command) -> dict: | ||
| root_dict = self._create_root_dict(xpath, command) | ||
| self._send_dict(root_dict) | ||
| response = self._receive() | ||
| self._close_connection() | ||
| response = self._send_request_raw(xpath, command) | ||
| return self._clean_response_dict(response, xpath) | ||
@@ -144,2 +149,5 @@ | ||
| # The alarm can start to drop responses if we send multiple different requests back-to-back | ||
| time.sleep(1) | ||
| command = OrderedDict() | ||
@@ -186,3 +194,3 @@ command['Total'] = None | ||
| def _send_dict(self, root_dict) -> None: | ||
| xml = dicttoxml.dicttoxml(root_dict, attr_type=False, root=False) | ||
| xml = dicttoxml2.dicttoxml(root_dict, attr_type=False, root=False) | ||
@@ -278,5 +286,8 @@ self.ensure_connection_is_open() | ||
| if __name__ == "__main__": | ||
| ialarm = IAlarm("192.168.40.200") | ||
| # ialarm.disarm() | ||
| import time | ||
@@ -286,5 +297,7 @@ for ii in range(30): | ||
| print(ialarm.get_status()) | ||
| except ConnectionError: | ||
| except ConnectionError as e: | ||
| print(e) | ||
| print("no connection") | ||
| print(ialarm.sock) | ||
| time.sleep(15) | ||
| print("-----------") |
+2
-2
| from setuptools import setup | ||
| __version__ = '2.0.0' | ||
| __version__ = '2.1.0' | ||
@@ -23,3 +23,3 @@ setup( | ||
| include_package_data=True, | ||
| install_requires=['dicttoxml', 'xmltodict'], | ||
| install_requires=['dicttoxml2', 'xmltodict'], | ||
| ) |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
24039
1.88%272
3.42%