Skip to content

Commit 904fa33

Browse files
authored
Merge pull request #25 from djtimca/develop
Incorporate all PR Changes, add support for OmniHub
2 parents 35a1a4e + b99ac82 commit 904fa33

File tree

3 files changed

+25
-15
lines changed

3 files changed

+25
-15
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,25 @@ Integration library for Hayward Omnilogic pool controllers to allow easy integra
77

88
To download OmniLogic, either fork this github repo or simply use PyPi via pip.
99

10-
'''
10+
```
1111
$ pip install omnilogic
12-
'''
12+
```
1313

1414
## Using it
1515

1616
OmniLogic provides just the core actions, you will need to code your own specific use of the returned data.
1717

18-
'''
18+
```
1919
from omnilogic import OmniLogic
20-
'''
20+
```
2121

2222
A simple example to return the status of your pool equipment is:
2323

24-
'''
24+
```
2525
api_client = OmniLogic(username, password)
2626
2727
telemetry_data = await api_client.get_telemetry_data()
28-
28+
```
2929

3030
## Functions
3131

omnilogic/__init__.py

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import asyncio
99
import logging
1010

11-
# import config
1211
import aiohttp
1312

1413
HAYWARD_API_URL = "https://www.haywardomnilogic.com/HAAPI/HomeAutomation/API.ashx"
@@ -1024,15 +1023,27 @@ async def get_telemetry_data(self):
10241023
site_telem["Unit-of-Measurement"] = config_item["System"]["Units"]
10251024
site_telem["Alarms"] = site_alarms
10261025

1027-
if type(config_item["Backyard"]["Sensor"]) == dict:
1028-
site_telem["Unit-of-Temperature"] = config_item["Backyard"]["Sensor"][
1029-
"Units"
1030-
]
1026+
if "Sensor" in config_item["Backyard"]:
1027+
sensors = config_item["Backyard"]["Sensor"]
10311028
else:
1032-
for sensor in config_item["Backyard"]["Sensor"]:
1033-
if sensor["Name"] == "AirSensor":
1034-
site_telem["Unit-of-Temperature"] = sensor["Units"]
1029+
sensors = config_item["Backyard"]["Body-of-water"]["Sensor"]
10351030

1031+
hasAirSensor = False
1032+
1033+
if type(sensors) == dict:
1034+
site_telem["Unit-of-Temperature"] = sensors["Units"]
1035+
1036+
if sensors["Name"] == "AirSensor":
1037+
hasAirSensor = True
1038+
else:
1039+
for sensor in sensors:
1040+
if sensor["Name"] == "AirSensor":
1041+
site_telem["Unit-of-Temperature"] = sensor["Units"]
1042+
hasAirSensor = True
1043+
1044+
if hasAirSensor == False:
1045+
del site_telem["airTemp"]
1046+
10361047
telem_list.append(site_telem)
10371048

10381049
else:

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
keywords = ['OmniLogic', 'Hayward', 'Pool', 'Spa'],
1919
install_requires=[
2020
'xmltodict',
21-
'config',
2221
'aiohttp',
2322
],
2423
classifiers=[

0 commit comments

Comments
 (0)