Skip to content

Commit 35a1a4e

Browse files
authored
Merge pull request #24 from djtimca/develop
Add error catching for XML conversion and JSON conversion
2 parents ae70b53 + c537dfb commit 35a1a4e

File tree

5 files changed

+1297
-8
lines changed

5 files changed

+1297
-8
lines changed

omnilogic.egg-info/PKG-INFO

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
Metadata-Version: 2.1
22
Name: omnilogic
3-
Version: 0.4.4
3+
Version: 0.4.5
44
Summary: Integration for the Hayward OmniLogic pool control system
55
Home-page: https://github.com/djtimca/omnilogic-api
66
Author: Tim Empringham
77
Author-email: [email protected]
88
License: apache-2.0
9-
Download-URL: https://github.com/djtimca/omnilogic-api/archive/v_044.tar.gz
9+
Download-URL: https://github.com/djtimca/omnilogic-api/archive/v_045.tar.gz
1010
Description: # Hayward OmniLogic Integration
1111
Integration library for Hayward Omnilogic pool controllers to allow easy integration through their API to your home automation system.
1212

omnilogic/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,6 @@ dmypy.json
134134
# VSCode config
135135
.vscode/
136136

137+
# Testing Files
138+
test.py
139+
test_data/

omnilogic/__init__.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,11 @@ def alarms_to_json(self, alarms):
716716
return alarmslist
717717

718718
def telemetry_to_json(self, telemetry, config_data, site_alarms):
719-
telemetryXML = ElementTree.fromstring(telemetry)
719+
try:
720+
telemetryXML = ElementTree.fromstring(telemetry)
721+
except:
722+
raise OmniLogicException("Error loading Hayward data.")
723+
720724
backyard = {}
721725

722726
BOW = {}
@@ -1045,9 +1049,11 @@ async def get_telemetry_data(self):
10451049
# def get_alarm_list(self):
10461050

10471051
def convert_to_json(self, xmlString):
1048-
my_dict = xmltodict.parse(xmlString)
1049-
json_data = json.dumps(my_dict)
1050-
# print(json_data)
1052+
try:
1053+
my_dict = xmltodict.parse(xmlString)
1054+
json_data = json.dumps(my_dict)
1055+
except:
1056+
raise OmniLogicException("Error converting Hayward data to JSON.")
10511057

10521058
return json.loads(json_data)["Response"]["MSPConfig"]
10531059

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
setup(
77
name = 'omnilogic',
88
packages = ['omnilogic'],
9-
version = '0.4.5',
9+
version = '0.4.6',
1010
license='apache-2.0',
1111
description = 'Integration for the Hayward OmniLogic pool control system',
1212
long_description = long_description,
1313
long_description_content_type = "text/markdown",
1414
author = 'Tim Empringham',
1515
author_email = '[email protected]',
1616
url = 'https://github.com/djtimca/omnilogic-api',
17-
download_url = 'https://github.com/djtimca/omnilogic-api/archive/v_045.tar.gz',
17+
download_url = 'https://github.com/djtimca/omnilogic-api/archive/v_046.tar.gz',
1818
keywords = ['OmniLogic', 'Hayward', 'Pool', 'Spa'],
1919
install_requires=[
2020
'xmltodict',

0 commit comments

Comments
 (0)