Skip to content

Commit

Permalink
Merge pull request #25 from djtimca/develop
Browse files Browse the repository at this point in the history
Incorporate all PR Changes, add support for OmniHub
  • Loading branch information
djtimca authored Jun 6, 2022
2 parents 35a1a4e + b99ac82 commit 904fa33
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 15 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@ Integration library for Hayward Omnilogic pool controllers to allow easy integra

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

'''
```
$ pip install omnilogic
'''
```

## Using it

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

'''
```
from omnilogic import OmniLogic
'''
```

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

'''
```
api_client = OmniLogic(username, password)
telemetry_data = await api_client.get_telemetry_data()

```

## Functions

Expand Down
27 changes: 19 additions & 8 deletions omnilogic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import asyncio
import logging

# import config
import aiohttp

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

if type(config_item["Backyard"]["Sensor"]) == dict:
site_telem["Unit-of-Temperature"] = config_item["Backyard"]["Sensor"][
"Units"
]
if "Sensor" in config_item["Backyard"]:
sensors = config_item["Backyard"]["Sensor"]
else:
for sensor in config_item["Backyard"]["Sensor"]:
if sensor["Name"] == "AirSensor":
site_telem["Unit-of-Temperature"] = sensor["Units"]
sensors = config_item["Backyard"]["Body-of-water"]["Sensor"]

hasAirSensor = False

if type(sensors) == dict:
site_telem["Unit-of-Temperature"] = sensors["Units"]

if sensors["Name"] == "AirSensor":
hasAirSensor = True
else:
for sensor in sensors:
if sensor["Name"] == "AirSensor":
site_telem["Unit-of-Temperature"] = sensor["Units"]
hasAirSensor = True

if hasAirSensor == False:
del site_telem["airTemp"]

telem_list.append(site_telem)

else:
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
keywords = ['OmniLogic', 'Hayward', 'Pool', 'Spa'],
install_requires=[
'xmltodict',
'config',
'aiohttp',
],
classifiers=[
Expand Down

0 comments on commit 904fa33

Please sign in to comment.